http://stackoverflow.com/q/26156760
score: 4
has comment: http://stackoverflow.com/comment/41005918
has comment: http://stackoverflow.com/comment/41006130
accepted answer: http://stackoverflow.com/a/26157910
has comment: http://stackoverflow.com/comment/41005471
has comment: http://stackoverflow.com/comment/41006183
tagged with: instantiation
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41021580
has comment: http://stackoverflow.com/comment/41006269
has comment: http://stackoverflow.com/comment/41005806
has comment: http://stackoverflow.com/comment/41005966
has answer: http://stackoverflow.com/a/26170921
has comment: http://stackoverflow.com/comment/41006023
tagged with: java
has comment: http://stackoverflow.com/comment/41005403
has comment: http://stackoverflow.com/comment/41005627
has comment: http://stackoverflow.com/comment/41005331
type: Question
has comment: http://stackoverflow.com/comment/41005043
upvote count: 4
possible better answer: http://stackoverflow.com/a/26170921
has comment: http://stackoverflow.com/comment/41005688
has comment: http://stackoverflow.com/comment/41006339
has comment: http://stackoverflow.com/comment/41004612
has body: Usually when generics are explains say something like this: List&lt;?&gt; list = new ArrayList&lt;?&gt;(); This code(above) produce error because compiler doesn't know which type to instantiate. but List&lt;Set&lt;?&gt;&gt; list = new ArrayList&lt;Set&lt;?&gt;&gt;(); this(above) compiles good and this: List&lt;Set&lt;?&gt;&gt; list = new ArrayList&lt;Set&lt;String&gt;&gt;(); doesn't compile. I am confusing about it. Can you clarify full right to don't mess about these things. P.S. I know that List&lt;Number&gt; list = new ArrayList&lt;Integer&gt;(); will not compile and I understand why.
answer count: 2
has comment: http://stackoverflow.com/comment/41004881
has comment: http://stackoverflow.com/comment/41005229
has answer: http://stackoverflow.com/a/26157910
downvote count: 0
has comment: http://stackoverflow.com/comment/41005723
has comment: http://stackoverflow.com/comment/41006064
tagged with: wildcard
has title: nested wild cards and subtyping. How to understand when types are compatible?
favorite count: 0
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/41005588
has comment: http://stackoverflow.com/comment/41005015
has comment: http://stackoverflow.com/comment/41006043
tagged with: generics

http://stackoverflow.com/q/26058178
has answer: http://stackoverflow.com/a/26058679
type: Question
answer count: 2
downvote count: 0
tagged with: javascript
favorite count: 0
has title: how to read excel file using servlet jsp
has body: I had tried to read excel file from jsp to servlet in apache tomcat. The below code has been receive excel file from apache folder after write the file and get that file.I need to dont write in apache tomcat.How to directly read excel file values. The following code is MyServletUpload.java . import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.text.SimpleDateFormat; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import com.mysql.jdbc.Statement; import com.ppts.webwatcher.Validation.Urlvalidation; import com.ppts.webwatcher.setting.DBConnector; import com.ppts.webwatcher.webdownload.Webpagedownload; @WebServlet("/MyservletUpload") public class MyservletUpload extends HttpServlet { private static final long serialVersionUID = 1L; private static final String DATA_DIRECTORY = "data"; private static final int MAX_MEMORY_SIZE = 1024 * 1024 * 2; private static final int MAX_REQUEST_SIZE = 1024 * 1024; /** * @see HttpServlet#HttpServlet() */ public MyservletUpload() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletRe…
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26058319

http://stackoverflow.com/q/26118322
score: 1
possible better answer: http://stackoverflow.com/a/26118409
upvote count: 1
has answer: http://stackoverflow.com/a/26118409
type: AnsweredQuestion
tagged with: oop
linked to: http://stackoverflow.com/q/1858380
has comment: http://stackoverflow.com/comment/40933230
tagged with: java
has body: If i have a interface car that is to be implemented on various classes called BMW , AUDI etc . Now i want all of them to have a string instance color in which their colors should be stored . As they all can have a different colors I can not define a variable in interface for it as obligatorily final thus its value would not change as per the need of classes . so is there any way by which i can ensure that the color is used in every class . Also please let me know that why are the variables in the interface always final ie what would be the problem if they were not final variables . I have already reffed to following questions but none was satisfactory Why are interface variables static and final by default? Interface Variables Variables in Interface and Few others too.
linked to: http://stackoverflow.com/q/2430756
has answer: http://stackoverflow.com/a/26118440
type: Question
accepted answer: http://stackoverflow.com/a/26118505
has answer: http://stackoverflow.com/a/26119033
has comment: http://stackoverflow.com/comment/40933525
downvote count: 0
has answer: http://stackoverflow.com/a/26119697
tagged with: inheritance
favorite count: 0
has title: How To ensure that a variable is used in all the child classes?
has comment: http://stackoverflow.com/comment/40933500
answer count: 5
has comment: http://stackoverflow.com/comment/40933257
has comment: http://stackoverflow.com/comment/40933761
has answer: http://stackoverflow.com/a/26118505
linked to: http://stackoverflow.com/q/16406485

http://stackoverflow.com/comment/40889096
type: AnswerComment
comment on: http://stackoverflow.com/a/26093347
has text: Actually the data is sort of a dump from a csv file which I update monthly so this mechanism doesnt really suit my needs
type: Comment
score: 0

http://stackoverflow.com/comment/40991919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26149834
has text: Why not declare a `TestCase` interface or abstract class and implement it for both `A` and `B`?
score: 0

http://stackoverflow.com/a/26100029
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26099937
type: Answer
has body: Add that code in styles.xml and set theme for SettingsActivity class in manifest . like this : android:theme="@style/PreferencesTheme" change background color according to you.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26099937

http://stackoverflow.com/q/26110748
tagged with: html-parsing
answer count: 1
has comment: http://stackoverflow.com/comment/40920326
has answer: http://stackoverflow.com/a/26111195
has comment: http://stackoverflow.com/comment/40920720
has title: Getting a block of text using Jsoup
score: 0
tagged with: java
tagged with: jsoup
type: UnansweredQuestion
type: Question
has body: Basically what I'm attempting to do is input the song and artist in the url which will then bring me to the page with the song's lyrics I'm then going to find the correct way to get those lyrics. I'm new to using Jsoup. So far the issue I've been having is I can't figure out the correct way to get the lyrics. I've tried getting the first "div" after the "b" but it doesn't seem to work out the way I plan. public static void search() throws MalformedURLException { Scanner search = new Scanner(System.in); String artist; String song; artist = search.nextLine(); artist = artist.toLowerCase(); System.out.println("Artist saved"); song = search.nextLine(); song = song.toLowerCase(); System.out.println("Song saved"); artist = artist.replaceAll(" ", ""); System.out.println(artist); song = song.replaceAll(" ", ""); System.out.println(song); try { Document doc; doc = Jsoup.connect("http://www.azlyrics.com/lyrics/"+artist+"/"+song+".html").get(); System.out.println(doc.title()); for(Element element : doc.select("div")) { if(element.hasText()) { System.out.println(element.text()); break; } } } catch (IOException e){ e.printStackTrace(); } }

euclidean-distance
type: Tag
tag name: euclidean-distance
tags question: http://stackoverflow.com/q/26172891

http://stackoverflow.com/q/26139115
has comment: http://stackoverflow.com/comment/40971723
type: AnsweredQuestion
tagged with: view
has answer: http://stackoverflow.com/a/70623554
downvote count: 0
has title: Not able to dynamically set the setVisibility() parameter
tagged with: java
has answer: http://stackoverflow.com/a/35360013
accepted answer: http://stackoverflow.com/a/26139403
type: Question
has comment: http://stackoverflow.com/comment/40971835
has comment: http://stackoverflow.com/comment/40971568
has body: I am trying to set the visibility for a button as follows: public Bundle setActivityState(Bundle bundle){ startBtn = (Button) findViewById(R.id.startSensorsBtn); startBtn.setVisibility( getVisibilityState(bundle, PersistanceConstants.START_BTN_STATE) ); return bundle; } public int getVisibilityState(Bundle bundle, String keyName){ if (bundle.getInt(keyName) == View.VISIBLE){ return View.VISIBLE; } else if (bundle.getInt(keyName) == View.INVISIBLE){ return View.INVISIBLE; } else if (bundle.getInt(keyName) == View.GONE){ return View.GONE; } return 0; } But I am getting the error: Must be one of: View.VISIBLE, View.INVISIBLE, View.GONE less... (Ctrl+F1) Reports two types of problems: - Supplying the wrong type of resource identifier. For example, when calling Resources.getString(int id), you should be passing R.string.something, not R.drawable.something. - Passing the wrong constant to a method which expects one of a specific set of constants. For example, when calling View#setLayoutDirection, the parameter must be android.view.View.LAYOUT_DIRECTION_LTR or android.view.View.LAYOUT_DIRECTION_RTL. while calling getVisibilityState(bundle, PersistanceConstants.START_BTN_STATE) I don't know how to get around this. I understand that it's expecting a given set of values but all I know is to pass an int to it. What can be done here?
possible better answer: http://stackoverflow.com/a/35360013
score: 10
has answer: http://stackoverflow.com/a/26139403
has comment: http://stackoverflow.com/comment/40971635
has comment: http://stackoverflow.com/comment/40971787
answer count: 3
upvote count: 10
has comment: http://stackoverflow.com/comment/40972028
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/40861476
comment on: http://stackoverflow.com/q/26073024
type: QuestionComment
type: Comment
score: 0
has text: To clarify, I'm not in control of the threading itself, so it is actually also a given(If I'm not mistaken), the result of a queue being polled by org.springframework.jms.listener.DefaultMessageListenerContainer with concurrent consumers. I saw some earlier post that seems removed around using ExecutorService and maps, which I'm assessing, perhaps I would need to introduce some internal queuing to get that right?

http://stackoverflow.com/q/26162646
type: Question
tagged with: reverse
accepted answer: http://stackoverflow.com/a/26162960
has title: Collections .sort works but collections .reverse doesn't for me
upvote count: 1
has comment: http://stackoverflow.com/comment/41015423
has comment: http://stackoverflow.com/comment/41015601
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26162960
has body: I am trying to sort and reverse and a list of lines. I got collections.sort to work but not collections.reverse and i don't know why. Works public List&lt;String&gt; descending() { List&lt;String&gt; x = new ArrayList&lt;String&gt;(10); Collections.sort(oneName, new OneNameCountCompare()); for(OneName b: oneName) { x.add(b.toString()); if (x.size() == 10) // Or don't use enhanced for, use an index instead { break; } } return x; Doesn't Work error: method reverse in class Collections cannot be applied to given types; Collections.reverse(oneName, new OneNameCountCompare()); ^ required: List found: ArrayList,OneNameCountCompare reason: actual and formal argument lists differ in length public List&lt;String&gt; ascending() { List&lt;String&gt; y = new ArrayList&lt;String&gt;(10); Collections.reverse(oneName, new OneNameCountCompare()); for(OneName c: oneName) { y.add(c.toString()); if (y.size() == 10) // Or don't use enhanced for, use an index instead { break; } } return y; }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41015464
downvote count: 0
tagged with: sorting
score: 1
favorite count: 0

http://stackoverflow.com/q/26086425
tagged with: java
has title: Problems with deleting entities in EJB3
has body: I have a question about deleting entities in EJB3. I have two database tables: MainCategory and Category. First, I have to find all MainCategory entitys' name and its Category, so I do this: public List&lt;MainCategory&gt; findAllWithCategories() { TypedQuery&lt;MainCategory&gt; query = em.createNamedQuery("MainCategory.findAll", MainCategory.class); List&lt;MainCategory&gt; result = query.getResultList(); for (MainCategory mc : result){ try{ Hibernate.initialize(mc.getSubCategories()); }catch (Exception e){ e.printStackTrace(); } } return result; } Than I need its Categories, but I have to initialize something, so I do this (where selectedMainCategory is an element of List&lt;MainCategory&gt; = mainCategoryRepository.findAllWithCategories() ) List&lt;Category&gt; mainCategories = categoryRepository.findByMainCategoryIdAndInitialze(selectedMainCategory.getId()); instead of this: List&lt;Category&gt; subCategories = mainCategory.getSubCategories(); And after some action I need to delete a Category, so I do (where selectedSubCategory is an element of subCategories): selectedMainCategory.getSubCategories.remove(selectedSubCategory); mainCategoryRepository.modify(selectedMainCategory); However selectedSubCategory hasn't been removed from selectedMainCategory.getSubCategories(). Ok, I can remove it manually if I find it by Id and manually remove from the list, but I can't find out why getSubCategories.remove(object) doesn't work in this case. I guess it is something about equality of two java object, but I don't know exactly. How does EJB and Java work in this case? Can you explain it to me?
tagged with: ejb
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40876365
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: jakarta-ee
score: 1

http://stackoverflow.com/a/26087185
type: Answer
score: 4
upvote count: 4
has body: NotesXspDocument is an SSJS-only alias; the real class is com.ibm.xsp.model.domino.wrapped.DominoDocument: http://public.dhe.ibm.com/software/dw/lotus/Domino-Designer/JavaDocs/DesignerAPIs/com/ibm/xsp/model/domino/wrapped/DominoDocument.html
downvote count: 0
answers question: http://stackoverflow.com/q/26087057

http://stackoverflow.com/comment/40897917
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26098459
has text: +1. That will give last digit, al-right. But what if value is not last digit of String?
score: 1

http://stackoverflow.com/comment/40891857
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26094825
score: 3
has text: Yes, H2 is a lightweight database... However, I don't think you will ever have even close to 2^64 row per table (with any database), because 2^64 is really large number.

http://stackoverflow.com/q/26082732
has comment: http://stackoverflow.com/comment/40919750
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40895581
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40912921
type: Question
score: 5
has body: I am writing a JavaFX application that receives data points on a socket and visualizes them in real time. The problem is that the JavaFX rendering is too slow. I have a Swing implementation that runs fast enough but I need to use JavaFX instead. The constraints that I am working within are: The control for the visualization must only be updated by the JavaFX application thread (I believe this is required for all JavaFX and Swing applications). The visualization should be updated smoothly from the perspective of the human eye. Around 10 updates per second would be sufficient. Once every second would not be sufficient. The incoming data rate is high enough (about 50 events per second which is not that high in other contexts) and the per event processing is expensive enough that the incoming data must be received and processed in a thread other than the JavaFX application thread so that the GUI doesn't block (I believe this is a somewhat common requirement for many GUI applications). My approach so far has been to use a Canvas JavaFX node as the visualization control and for the reception thread to schedule updates to the Canvas to run later in the JavaFX application thread, like this. public void onEvent(Event event) { ....do processing... Platform.runLater(new Runnable() { @Override public void run() { graphics.setFill(...); graphics.fillRect(...); }}); } I have thought of a couple of approaches that might speed this up: Use a WritableImage instead of a Canvas for the visualization. The downside is that WritableImage/PixelWriter doesn't seem to have many drawing methods, for example it doesn't even have fillRect. I think I would have to implement my own versions and my versions would probably be slower. Have a Canvas object owned by the thread that processes incoming data. Copy from that canvas to the canvas that is a node in the scene graph in the JavaFX application thread. The copy would probably be done with code along these lines sceneCanvas.getGraphicsContext2D(…
has title: What approach should I use for JavaFX Canvas multithreading?
has comment: http://stackoverflow.com/comment/40914711
has comment: http://stackoverflow.com/comment/40918855
answer count: 1
has comment: http://stackoverflow.com/comment/40921351
has comment: http://stackoverflow.com/comment/40914564
favorite count: 0
tagged with: javafx-2
upvote count: 5
has comment: http://stackoverflow.com/comment/40954238
has comment: http://stackoverflow.com/comment/40895615
tagged with: multithreading
has answer: http://stackoverflow.com/a/26107980
has comment: http://stackoverflow.com/comment/40917487
accepted answer: http://stackoverflow.com/a/26107980

http://stackoverflow.com/comment/40987283
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26147375
has text: @Daniel: yes!! Under the class name, methods and the number of times they have been invoked.
score: 0

http://stackoverflow.com/comment/41014532
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26159623
has text: You're right... Every time we can eleminate a wrong way, it's another step to the right way! Thank's for your input! (Would rate your answer up, but I don't have the required reputation up to now)

http://stackoverflow.com/a/26166563
type: Answer
has body: Note that "inverting all the booleans" doesn't achieve the goal of "resetting to original state". If only some of the values have changed, inverting all values won't result in the original state. If the object has a "default state" then it should be aware of that state on some level, right? (Or at least be able to be supplied with some indicator of that state.) Something like this: public class SomeClass { private boolean defaultValue = false; private boolean currentValue = false; public boolean getCurrentValue() { return currentValue; } public void setCurrentValue(boolean newValue) { this.currentValue = newValue; } } Basically you'd need to store that original default state somewhere so that it can be known later in the application when the active state has changed. Then to reset the object to its original state, just create a method which does that: public void resetToDefault() { this.currentValue = this.defaultValue; } Simply repeat for any other values within the object.
answers question: http://stackoverflow.com/q/26166430
score: 0

http://stackoverflow.com/q/26141713
answer count: 1
has title: How to write cron expression for specific weeks?
has answer: http://stackoverflow.com/a/26142139
has comment: http://stackoverflow.com/comment/40976705
type: UnansweredQuestion
has body: How do I write a cron expression for specific weeks? say If I want a job to execute on mon, Tue and Sunday of 1st and 3rd week OR say the last week of the month of the say 1st and 9th Month? Days will range from mon to sunfday i.e. all days in a week. One day or any combination of the days. e.g. Mon,tue or only mon Months can range from jan to dec. One or multiple months. Weeks will range from 1 to 4 or last week. Single or multiple weeks. Thanks.
tagged with: java
tagged with: javascript
has comment: http://stackoverflow.com/comment/40976617
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40976656
tagged with: cronexpression

http://stackoverflow.com/q/26132829
tagged with: typecasting-operator
has title: Object Typecasting
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26132852
possible better answer: http://stackoverflow.com/a/26132881
has body: In the following code: A tat = new P(); P bat = (P) tat; is typecasting tat: P bat = (P) tat; the same as saying: P tat = new P(); Can you also say in theory that: P bat = ( P tat = new P(); )
has answer: http://stackoverflow.com/a/26132881
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40960622
has comment: http://stackoverflow.com/comment/40960428
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/26132852

http://stackoverflow.com/a/26076620
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26044908
answers question: http://stackoverflow.com/q/26044908
has body: It sounds like you're interested in the differences between MVP and MVC. Note that MVP is a newer variation of the classic MVC architecture, with a key difference being who accesses the model (see the differing diagrams in the Wikipedia articles). In the classic MVC pattern, both the View and Controller access the model, whereas only the Presenter has access in MVP. Also note that in MVP, not all business logic is necessarily located in the Presenter. From Wikipedia, "The degree of logic permitted in the view varies among different implementations... the view... may be the best place to handle a particular interaction or command." The answer to your second question is, of course, "It depends on what you're implementing." If you think that MVP will result in duplicated logic in the Presenter of your particular application, consider moving some logic to the View, or consider switching to the MVC pattern.

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

http://stackoverflow.com/comment/40882069
has text: @ftb If you want caching and your images are static then its better to use http server or proxy cache instead of caching in the JVM.
type: Comment
comment on: http://stackoverflow.com/a/26089296
score: 0
type: AnswerComment

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

http://stackoverflow.com/comment/41019297
score: 12
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26164155
has text: Keep in mind that while this behaves like `Either`, the type is in some sense "too big", since your `left` and `right` fields could in principle both be empty or both be defined. You've hidden the constructors that would make that possible, but the approach still leaves potential for bugs in your implementation. In simple type arithmetic terms, you're trying to get `a + b` out of `(1 + a) * (1 + b)`. Sure, `a + b` occurs in the result of that expression, but so is `1` and `a * b`.

http://stackoverflow.com/a/26112778
score: 1
downvote count: 0
type: Answer
has body: Your statement: I used to consider inheritance as inheriting all members but some can't be accessable in subclass.But I found a book says that subclass can inherit all the methods it can access. Lets parse this statement of yours: 1. I used to consider inheritance as inheriting all members but some can't be accessable in subclass. Extract: When you inherit from a super class then all its members are available in the sub class however the private members of the super class are not accesible from with in the sub class. 2. But I found a book says that subclass can inherit all the methods it can access. Extract: Yes the book is saying it perfectly,All the methods it can access(the non private methods you are left with are annotated as the ones to be accessible in that book of yours),that is other than the private ones. I was thinking to link a very good question asked some where on SO,but i am not able to search it,but I had saved the image in that answer on my computer; to make you more clear about inheritance,i am going to upload it,the image was something like this
upvote count: 1
answers question: http://stackoverflow.com/q/26112743

http://stackoverflow.com/q/26082021
has title: How to use Spring-data-rest for replacing ResourceAssemblerSupport
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26104724
tagged with: spring-data-rest
answer count: 1
linked to: http://stackoverflow.com/q/25757365
has body: There are JPARepository in repository layer being called from Service Layer returning Entity to Spring MVC Controller layer. Controller will receive HTTPRequest as HATEOAS Resource. This is followed by a to and fro conversion from Resource to Entity and back to Resource with added links in ResourceAssemblerSupport. Everything is in place and here is a link to what Just outlined above. In between these, there are XML driven Spring configurations Now there comes Spring-Data-Rest project which says it bridges the boilerplate code between JPARepository to HATEOAS ResourceAssemblerSupport using HAL specification. In that regard, how can Spring-Data-Rest let me get rid of to and fro conversion only in above setup ( ResourceSupport and ResourceAssemblerSupport ) ?
accepted answer: http://stackoverflow.com/a/26104724
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: spring-data

http://stackoverflow.com/comment/40869324
score: 0
has text: The normal insertion is working , all fields are submitted , normal table without constraints except primary key !
comment on: http://stackoverflow.com/q/26082435
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26076107
has body: I searched google, but i cant find a way to do this. I have a SOAP webservice built in netbeans with JAX-WS . Gerated wsdl cannot be accessed by my java client code. Is the way i am trying to access is wrong? someone help.. my web service code @WebService(serviceName = "HolaMundo") public class HolaMundo { @WebMethod(operationName = "hello") public String hello(@WebParam(name = "name") String txt) { return "Hello " + txt + " !"; } } generated wsdl <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://publicar.ws.org.mx/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://publicar.ws.org.mx/" name="HolaMundo"> <xsd:schema> <xsd:import namespace="http://publicar.ws.org.mx/" schemaLocation="http://localhost:8084/HolaMundo/HolaMundo?xsd=1"/> </xsd:schema> <part name="parameters" element="tns:hello"/> <part name="parameters" element="tns:helloResponse"/> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <soap:operation soapAction=""/> <soap:body use="literal"/> <soap:body use="literal"/> <soap:address location="http://localhost:8084/HolaMundo/HolaMundo"/> </definitions> Java client code public class cliente { public cliente() { } public static String consumir(Object[] parametros){ String regresar = null; Service service = null; Call call = null; String endpoint = null; try { endpoint = "http://localhost:8084/HolaMundo/HolaMundo"; service = new Service(); call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName("hello"); regresar=String.valueOf(call.invoke(parametros)); }// try catch (Exception e) { e.printStackTrace(); }// catch finally { retu…
has comment: http://stackoverflow.com/comment/40890840
tagged with: java
has comment: http://stackoverflow.com/comment/40899181
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40899842
tagged with: wsdl
tagged with: soap
has title: How to communicate with JAX-WS based SOAP webservice from java?
answer count: 0
has comment: http://stackoverflow.com/comment/40899603
type: UnansweredQuestion
tagged with: web-services

treepath
tag name: treepath
type: Tag
tags question: http://stackoverflow.com/q/26071393

http://stackoverflow.com/q/26100992
has title: Apache Camel - Spring Web App - Camel Context not started on @PostConstruct
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40921368
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/40925322
score: 0
type: UnansweredQuestion
tagged with: spring
has body: I have an Apache-Camel Web Application that is using Spring. I have certain routes with the property autoStartup=false so I can conditionally start them based on some checks I do when the application starts. In order to do that I have the logic in a @PostConstruct init method. However once the @PostConstruct method has been loaded the CamelContext has been constructed but not started. Therefore the routeDefinitions have not yet being loaded. So if I do camelContext.startRoute("myRoute"). Nothing happens. On the other hand if I expose this method as a web-service the route starts normally as expected. This is my controller below: @Controller public class EntryBean implements CamelContextAware { private CamelContext camelContext; @PostConstruct public void init() { //at this point the started property is still false //and the camelContext does have any routeDefinitions camelContext.startRoute("myRoute"); } @RequestMapping("startRoutes") @ResponseBody public String startCamelRoutes() { //this runs normally when called from the GET request camelContext.startRoute("myRoute"); return "Routes Started Succesfully"; } @Override public void setCamelContext(CamelContext camelContext) { this.camelContext = camelContext; } @Override public CamelContext getCamelContext() { return camelContext; } } I have even used &lt;bean class="org.example.EntryBean" depends-on="camelContext"/&gt; but still nothing.
tagged with: spring-mvc

http://stackoverflow.com/a/26104828
has comment: http://stackoverflow.com/comment/40909617
type: Answer
answers question: http://stackoverflow.com/q/26104757
has comment: http://stackoverflow.com/comment/40909663
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26104757
downvote count: 1
has comment: http://stackoverflow.com/comment/40909543
has comment: http://stackoverflow.com/comment/40909569
has comment: http://stackoverflow.com/comment/40909856
has body: This will likely work, however, I strongly consider noting Elliott Frisch's comment. String has an overloaded constructor can take a character array as a parameter. PrepedStatement.setString(2, new String(Password.getPassword()));
has comment: http://stackoverflow.com/comment/40909351
type: AcceptedAnswer
score: 1

http://stackoverflow.com/comment/41032458
type: Comment
has text: Actually ... the annotation that I am targeting has a retention policy of COMPILE, meaning it will be stripped from the class file. So loading class files to the annotation processor is not going to work. Instead of separating the javac executions into proc:none and proc:only, I will try to do the processing in one step (which may cause some other problems, since I am generating test code that is not part of the normal compile step).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26171377

http://stackoverflow.com/a/26035594
upvote count: 1
type: Answer
has body: Lookaheads and lookbehinds are both zero-width. However one is allowed a regular expression inside a lookahead, but not in a lookbehind (at least, not unless it is a fixed-length regexp). The reason for this is simply that most regexp engines are not designed to apply regexps backward. In fact there are exceptions to this rule, and some engines will support the OP's regexp. However, unless you are using one of these exceptional regexp engines, then you cannot have a variable length regexp (i.e. a regexp that can match a variable length substring) in your lookbehind, which is the problem with the OP's original regexp. A good explanation of lookaround can be found at http://www.regular-expressions.info/lookaround.html You can solve the problem without using a lookbehind. Try this expression: (\w+Exception).*&lt;The server started in RUNNING mode.&gt; This matches if an exception happened before the servers started in RUNNING mode, and also captures the first such exception in a group. If all you want to do is ascertain that an exception occurred, you could drop the round brackets.
has comment: http://stackoverflow.com/comment/40782881
has comment: http://stackoverflow.com/comment/40783607
score: 1
has comment: http://stackoverflow.com/comment/40784312
answers question: http://stackoverflow.com/q/26034892
downvote count: 0

http://stackoverflow.com/a/26082295
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40877891
type: Answer
has body: If the app has root level access, or is using a framework such as Exposed, then yes app can access low level API's to affect SMS. Otherwise, there is no known official API for that yet. Though Android has introduced device admin API, There seems to be no SMS specific policy present.
accepted answer of: http://stackoverflow.com/q/26081632
answers question: http://stackoverflow.com/q/26081632

http://stackoverflow.com/comment/41002611
has text: how about if you assign the thread with null? does it stop the thread?
type: AnswerComment
comment on: http://stackoverflow.com/a/26155747
score: 0
type: Comment

http://stackoverflow.com/q/26098281
favorite count: 0
has answer: http://stackoverflow.com/a/26098560
has comment: http://stackoverflow.com/comment/40898174
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26098471
answer count: 4
has comment: http://stackoverflow.com/comment/40897677
has comment: http://stackoverflow.com/comment/40899918
upvote count: 3
tagged with: java
has body: StringBuffer buff1 = new StringBuffer("tuts point"); System.out.println("Old Capacity of buff1 = " + buff1.capacity()); buff1.ensureCapacity(28); System.out.println("New Capacity of buff1 = " + buff1.capacity()); StringBuffer buff2 = new StringBuffer("compilejksde"); System.out.println("Old Capacity of buff2= " + buff2.capacity()); buff2.ensureCapacity(75); System.out.println("New Capacity of buff2= " + buff2.capacity());
type: Question
score: 3
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/40897544
has comment: http://stackoverflow.com/comment/40897547
has title: How does ensureCapacity work in Java?
has answer: http://stackoverflow.com/a/26098404
has answer: http://stackoverflow.com/a/26098399
has comment: http://stackoverflow.com/comment/40897630
downvote count: 0

http://stackoverflow.com/comment/40945709
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26123772
has text: yes it's spelled wrong also there 'discription'. where should I look in the stack trace to track what is wrong ?

http://stackoverflow.com/comment/40994092
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26150377
has text: Alright I did it and now I am getting ArrayOutOfBoundsException. But it prints out all the ej[i]'s just fine and then throws the exception.

http://stackoverflow.com/a/26092688
type: Answer
has body: Try this way double d = 5.24; int i = Integer.parseInt(Double.toString(d).split("\\.")[1]);
answers question: http://stackoverflow.com/q/26092585
score: 0

http://stackoverflow.com/comment/116778825
comment on: http://stackoverflow.com/a/66028644
type: AnswerComment
has text: The code is small, simple and self explaining. If the programmer are doing a REST to download a PDF, this code I've posted is easy as ABC.
score: 0
type: Comment

http://stackoverflow.com/comment/40850714
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26072665
has text: start with a java tutorial on arrays http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
score: 0

http://stackoverflow.com/comment/40972831
has text: Maybe. If you're in KitKat or above, repeating alarms are inexact, so it might not fire at that exact time. Per the docs, if you need exact repeating in API>18, use `setExact()` and set the alarm for the next day again every time it fires. Also, please post additional questions as questions. The mods are gonna start freaking if this comment chain gets any longer.
type: Comment
comment on: http://stackoverflow.com/a/26070584
score: 0
type: AnswerComment

http://stackoverflow.com/q/26084469
has answer: http://stackoverflow.com/a/26084511
score: 0
possible better answer: http://stackoverflow.com/a/26084519
answer count: 3
has body: Each month I would like to run a certain task in Java. However, I don't have access to a cron system or anything outside of the Java environment on this machine. What would be the most effective way of implementing such system, or does one already exist that someone can provide me with the link to? A solution that I would of would be storing the current time in a file, and then like every day, comparing it to see if the difference is a month and if so then run and reset. But that isn't the most accurate method.
tagged with: scheduler
has comment: http://stackoverflow.com/comment/40872384
favorite count: 0
has title: Call x function every month in java
accepted answer: http://stackoverflow.com/a/26084511
has answer: http://stackoverflow.com/a/57748510
has comment: http://stackoverflow.com/comment/40872350
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40872298
has comment: http://stackoverflow.com/comment/40872341
has answer: http://stackoverflow.com/a/26084519
tagged with: java

http://stackoverflow.com/q/26174682
has answer: http://stackoverflow.com/a/26175605
type: Question
has comment: http://stackoverflow.com/comment/41038292
has body: I started a project using TDD. I have few parsers that implementing the same interface. each one of them have a different implementation of this specific interface. While testing them i just repeat again and again the same tests for each one of them. was wondering if it is possible to create an interface of all of the JUnits while implementing it i will just get it as: @Override @Test public void testMethodA() { // TODO Auto-generated method stub } @Override @Test public void testMethodB() { // TODO Auto-generated method stub } Instead of copy and past every time and create the test deceleration manually? as well when the class interface change , i need to add to each of of the JUnit the test and etc.. Bottom line, I want to auto generate an empty test-case for each class by implementing and interface which there i would declarer on the common parser tests. Is there a way to do that using eclipse ?
has comment: http://stackoverflow.com/comment/41038150
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26175605
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has title: Creating an Interface for JUnit
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41038110
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41038235
tagged with: testcase
upvote count: 1
has comment: http://stackoverflow.com/comment/41038045

http://stackoverflow.com/comment/41003174
comment on: http://stackoverflow.com/q/26155900
type: Comment
type: QuestionComment
has text: You are not showing us complete code. Various mistakes found in your code. Format your code and post it back. If you are using Eclipse IDE, press ctrl+shift+f. It formats your code.
score: 2

http://stackoverflow.com/comment/41047599
has text: Yes, and the error is : jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: ``FileWriter fstream = new FileWriter("resultcsv-20141003-163823.csv",true); Buffe . . . '' Encountered "( 2c92c05698458bfcf0c0148d63ba63a21e0" at line 3, column 10.
comment on: http://stackoverflow.com/q/26179894
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26168526
score: 0
has body: Override the AbstractInputStream build your own FileContent package com; import java.io.IOException; import java.io.InputStream; import com.google.api.client.http.AbstractInputStreamContent; import com.google.api.client.util.Preconditions; public class FileContent extends AbstractInputStreamContent { private InputStream inputStream = null; private long inputLength = 0; public FileContent(String type, InputStream pInputStream) throws IOException { super(type); this.inputStream = Preconditions.checkNotNull(pInputStream); this.inputLength = this.inputStream.available(); } public long getLength() throws IOException { return this.inputLength; } public boolean retrySupported() { return false; } @Override public InputStream getInputStream() throws IOException { return this.inputStream; } }
type: Answer
answers question: http://stackoverflow.com/q/26143800

http://stackoverflow.com/comment/40788263
has text: What exactly are doA, doB and doC... are they related to the X base class or the Y interface?
comment on: http://stackoverflow.com/q/26038805
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26052182
has answer: http://stackoverflow.com/a/35819258
tagged with: build
tagged with: java
tagged with: eclipse
type: Question
has title: Building jEdit In Eclipse and Ant
has comment: http://stackoverflow.com/comment/40813408
tagged with: jedit
tagged with: ant
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26077599
has comment: http://stackoverflow.com/comment/40859655
has body: I am trying to build the source code for jEdit project inside eclipse. In generally it gives a lots of error like as the below screenshot: However, running the ant build command results in successful build output. I have added ant builder in the project properties and now running the 'Project->build' option results in ant build output which is also successful. Now, how can I resolve the errors shown in eclipse 'Problems tab'? Shouldn't all dependencies etc be already inside the project as it succeeded the build?
type: UnansweredQuestion

http://stackoverflow.com/comment/40850033
type: Comment
score: 1
has text: @Keale - yes, I thought of that. The OP does not mention what the TrueFalse class does. If it has an initialisation-style method broadly equivalent to addChoice, this could be genericised in Question. If not, I agree with your response that it would be unwise to create such a method in Question if it only applies to MultipleChoice. Bottom line, anything relevant to all questions should be in Question - whether or not child classes need to override depends on the child class' required behaviour.
comment on: http://stackoverflow.com/a/26072115
type: AnswerComment

http://stackoverflow.com/comment/40838995
has text: @DeepSidhu1313 That's the thing, you cannot do that: like all primitive data types, `int`s are passed by value (references to reference objects are also passed by value, but that is a different topic altogether). Java does not provide any way to pass parameters by reference, so there is absolutely no way to change `i` or `j` in the calling method by anything that you could possibly do inside the `assignDvalues` method.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26065138
type: Comment

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

http://stackoverflow.com/comment/41070860
comment on: http://stackoverflow.com/a/26192304
score: 0
type: Comment
has text: Maybe I can set hasPressed to true when I am leaving current activity. To leave it I use onBackPressed()
type: AnswerComment

http://stackoverflow.com/q/26083210
has answer: http://stackoverflow.com/a/26101785
tagged with: java
has title: How to find EPStatements associated with UpdateListener
has body: I was wondering if Esper provides a mechanism to discover all EPStatement objects that an UpdateListener interface implementation is associated with. The association between EPStatement and UpdateListener is one-way (from EPStatement to UpdateListener) and I cannot see in the API or reference docs if there's a way to discover EPstatement object(s) for a given UpdateListener or would I have to maintain such tracking myself?
accepted answer: http://stackoverflow.com/a/26101785
type: Question
type: AnsweredQuestion
tagged with: esper
answer count: 1
score: 0

http://stackoverflow.com/q/26035329
tagged with: spring
has body: Is there an elegant way to define a single @MessageEndpoint bean with multiple @ServiceActivator methods (or something like that), where the methods' argument types are implicitly used as a payload-type-filter? The idea is to have a single service endpoint which can handle different payload types slightly different without much effort by dispatching on the argument type, which alleviates the implementation of additional service methods down the line. I'm aware of Google Guava's EventBus, which dispatches event objects to any registered @Subscribe method with a matching argument type. I'm currently using this approach, but I was wondering if this was also (kinda) possible with Spring Integration.
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
type: Question
has title: Multiple @ServiceActivator methods with an implicit payload-type-routing
has comment: http://stackoverflow.com/comment/40825779
tagged with: dynamic-dispatch
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26036966
accepted answer: http://stackoverflow.com/a/26036966
has comment: http://stackoverflow.com/comment/40784406

http://stackoverflow.com/q/26068658
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26077873
tagged with: maven
tagged with: maven-antrun-plugin
has body: Context: I am trying to build a web.xml during compilation. I Use ant scripts to perform this task. The ant script uses properties defined in a properties file to complete this task. The ant script is called using Maven-ant-plugin. However, when I do a maven build. it fails with message "An Ant BuildException Could not load definitions from resource project.properties. It could not be found." the Ant script looks like below: <taskdef resource="project.properties"/> <echo file="${webappdir}/web.xml"> <> <> ${webappdir} is the defined in properties file MAVEN POM: maven-antrun-plugin process-resources <ant dir="build/ant/" /> <ant antfile="build/ant/bld_webxml.xml" target="make_webxml"/> run Am I doing something wrong? Thanks in advance
tagged with: java
type: Question
tagged with: ant
answer count: 1
score: 0
has title: Maven-antrun-plugin failure: Could not load definitions from resource project.properties. It could not be found

java
tags question: http://stackoverflow.com/q/26092467
tags question: http://stackoverflow.com/q/26149569
tags question: http://stackoverflow.com/q/26143057
tags question: http://stackoverflow.com/q/26040312
tags question: http://stackoverflow.com/q/26152690
tags question: http://stackoverflow.com/q/26065549
tags question: http://stackoverflow.com/q/26117089
tags question: http://stackoverflow.com/q/26163281
tags question: http://stackoverflow.com/q/26094013
tags question: http://stackoverflow.com/q/26189137
tags question: http://stackoverflow.com/q/26183721
tags question: http://stackoverflow.com/q/26062900
tags question: http://stackoverflow.com/q/26102236
tags question: http://stackoverflow.com/q/26167435
tags question: http://stackoverflow.com/q/26189940
tags question: http://stackoverflow.com/q/26062781
tags question: http://stackoverflow.com/q/26156297
tags question: http://stackoverflow.com/q/26140338
tags question: http://stackoverflow.com/q/26050892
tags question: http://stackoverflow.com/q/26191442
tags question: http://stackoverflow.com/q/26084761
tags question: http://stackoverflow.com/q/26095881
tags question: http://stackoverflow.com/q/26038421
tags question: http://stackoverflow.com/q/26099522
tags question: http://stackoverflow.com/q/26064642
tags question: http://stackoverflow.com/q/26071073
tags question: http://stackoverflow.com/q/26161830
tags question: http://stackoverflow.com/q/26114702
tags question: http://stackoverflow.com/q/26132940
tags question: http://stackoverflow.com/q/26043762
tags question: http://stackoverflow.com/q/26079470
tags question: http://stackoverflow.com/q/26123321
tags question: http://stackoverflow.com/q/26119357
tags question: http://stackoverflow.com/q/26172458
tags question: http://stackoverflow.com/q/26064895
tags question: http://stackoverflow.com/q/26044881
tags question: http://stackoverflow.com/q/26060182
tags question: http://stackoverflow.com/q/26087738
tags question: http://stackoverflow.com/q/26188871
tags question: http://stackoverflow.com/q/26158898
tags question: http://stackoverflow.com/q/26059095
tags question: http://stackoverflow.com/q/26046628
tags question: http://stackoverflow.com/q/26164375
tags question: http://stackoverflow.com/q/26100980
tags question: http://stackoverflow.com/q/26131798
tags question: http://stackoverflow.com/q/26038963
tags question: http://stackoverflow.com/q/26169465
tags question: http://stackoverflow.com/q/26133503
tags question: http://stackoverflow.com/q/26159196
tags question: http://stackoverflow.com/q/26037565
tags question: http://stackoverflow.com/q/26067617
tags question: http://stackoverflow.com/q/26131768
tags question: http://stackoverflow.com/q/26126353
tags question: http://stackoverflow.com/q/26133836
tags question: http://stackoverflow.com/q/26103103
tags question: http://stackoverflow.com/q/26114222
tags question: http://stackoverflow.com/q/26034965
tags question: http://stackoverflow.com/q/26089205
tags question: http://stackoverflow.com/q/26038016
tags question: http://stackoverflow.com/q/26186270
tags question: http://stackoverflow.com/q/26192496
tags question: http://stackoverflow.com/q/26137202
tags question: http://stackoverflow.com/q/26104880
tags question: http://stackoverflow.com/q/26075727
tags question: http://stackoverflow.com/q/26094987
tags question: http://stackoverflow.com/q/26153930
tags question: http://stackoverflow.com/q/26177689
tags question: http://stackoverflow.com/q/26091259
tags question: http://stackoverflow.com/q/26065757
tags question: http://stackoverflow.com/q/26134078
tags question: http://stackoverflow.com/q/26168225
tags question: http://stackoverflow.com/q/26163914
tags question: http://stackoverflow.com/q/26055437
tags question: http://stackoverflow.com/q/26069181
tags question: http://stackoverflow.com/q/26039056
tags question: http://stackoverflow.com/q/26154690
tags question: http://stackoverflow.com/q/26122487
tags question: http://stackoverflow.com/q/26114822
tags question: http://stackoverflow.com/q/26130214
tags question: http://stackoverflow.com/q/26051899

http://stackoverflow.com/comment/40994566
type: AnswerComment
has text: Some kind of IPC is the easiest solution and is a valid answer. Although, the javabindings seems interesting. Could you write up an answer with sample code (how to use), maybe even how to build? You can add this to your existing answer, but can also post a separate answer.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26137873

http://stackoverflow.com/a/26184512
score: 1
has body: Cliente asyncTask =new Cliente(this); asyncTask.delegate = this; new Cliente("menu_fei"); the problem with your code is that in the third line you are creating a new instance of the Cliente without setting the delegate. To fix you can simply run Cliente asyncTask =new Cliente(this); asyncTask.execute();
has comment: http://stackoverflow.com/comment/41061284
has comment: http://stackoverflow.com/comment/41063023
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41056588
accepted answer of: http://stackoverflow.com/q/26184059
type: Answer
answers question: http://stackoverflow.com/q/26184059
has comment: http://stackoverflow.com/comment/41061037
has comment: http://stackoverflow.com/comment/41056546

http://stackoverflow.com/a/26180956
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41050652
accepted answer of: http://stackoverflow.com/q/26180535
downvote count: 0
has body: Try this: java -Djetty.home=C:\jetty-distribution-8.1.15.v20140411 -jar C:\jetty-distribution-8.1.15.v20140411/start.jar
has comment: http://stackoverflow.com/comment/41054124
answers question: http://stackoverflow.com/q/26180535
type: Answer
has comment: http://stackoverflow.com/comment/41054625
has comment: http://stackoverflow.com/comment/41054693
has comment: http://stackoverflow.com/comment/41050482
has comment: http://stackoverflow.com/comment/41052812
upvote count: 2
has comment: http://stackoverflow.com/comment/41050479
has comment: http://stackoverflow.com/comment/41050383
score: 2

http://stackoverflow.com/comment/40949743
score: 0
type: Comment
has text: I find this idea a bit unsettling for a test. Why would one ever want that. The behavior is the one of a partial mock and it's globally a bad bad idea.
type: QuestionComment
comment on: http://stackoverflow.com/q/26122060

http://stackoverflow.com/a/26087704
has body: Finally got it working, actually i changed conf.setOutputKeyComparatorClass(TaggedJoiningGroupingComparator.class); to conf.setOutputValueGroupingComparator(TaggedJoiningGroupingComparator.class); Also From hadoop API docs. -- setOutputValueGroupingComparator(Class&lt;? extends RawComparator&gt; theClass) Set the user defined RawComparator comparator for grouping keys in the input to the reduce.
type: Answer
answers question: http://stackoverflow.com/q/26072962
accepted answer of: http://stackoverflow.com/q/26072962
score: 0
type: AcceptedAnswer

android
tags question: http://stackoverflow.com/q/26093799
tags question: http://stackoverflow.com/q/26073016
tags question: http://stackoverflow.com/q/26173513
tags question: http://stackoverflow.com/q/26173347
tags question: http://stackoverflow.com/q/26112014
tags question: http://stackoverflow.com/q/26049184
tags question: http://stackoverflow.com/q/26055514
tags question: http://stackoverflow.com/q/26035366
tags question: http://stackoverflow.com/q/26100208
tags question: http://stackoverflow.com/q/26113975
tags question: http://stackoverflow.com/q/26099542
tags question: http://stackoverflow.com/q/26182729
tags question: http://stackoverflow.com/q/26128284
tags question: http://stackoverflow.com/q/26058317
tags question: http://stackoverflow.com/q/26075195
tags question: http://stackoverflow.com/q/26039047
tags question: http://stackoverflow.com/q/26185258
tags question: http://stackoverflow.com/q/26094983
tags question: http://stackoverflow.com/q/26082452
tags question: http://stackoverflow.com/q/26061866
tags question: http://stackoverflow.com/q/26073342
tags question: http://stackoverflow.com/q/26142696
tags question: http://stackoverflow.com/q/26098359
tags question: http://stackoverflow.com/q/26056757
tags question: http://stackoverflow.com/q/26161976
tags question: http://stackoverflow.com/q/26171126
tags question: http://stackoverflow.com/q/26090639
tags question: http://stackoverflow.com/q/26194351
tags question: http://stackoverflow.com/q/26174622
tags question: http://stackoverflow.com/q/26155736
tags question: http://stackoverflow.com/q/26127098
tags question: http://stackoverflow.com/q/26091277
tags question: http://stackoverflow.com/q/26131832
tags question: http://stackoverflow.com/q/26085587
tags question: http://stackoverflow.com/q/26037881
tags question: http://stackoverflow.com/q/26067330
tags question: http://stackoverflow.com/q/26036659
tags question: http://stackoverflow.com/q/26082621
tags question: http://stackoverflow.com/q/26133246
tags question: http://stackoverflow.com/q/26179446
tags question: http://stackoverflow.com/q/26152146
tags question: http://stackoverflow.com/q/26118799
tags question: http://stackoverflow.com/q/26035719
tags question: http://stackoverflow.com/q/26182008
tags question: http://stackoverflow.com/q/26118167
tags question: http://stackoverflow.com/q/26189761
tags question: http://stackoverflow.com/q/26038563
tags question: http://stackoverflow.com/q/26058926
tags question: http://stackoverflow.com/q/26089211
tags question: http://stackoverflow.com/q/26179108
tags question: http://stackoverflow.com/q/26104219
tags question: http://stackoverflow.com/q/26074094
tags question: http://stackoverflow.com/q/26050513
tags question: http://stackoverflow.com/q/26170387
tags question: http://stackoverflow.com/q/26131188
tags question: http://stackoverflow.com/q/26152547
tags question: http://stackoverflow.com/q/26062486
tags question: http://stackoverflow.com/q/26129949
tags question: http://stackoverflow.com/q/26144980
tags question: http://stackoverflow.com/q/26191346
tags question: http://stackoverflow.com/q/26162901
tags question: http://stackoverflow.com/q/26128643
tags question: http://stackoverflow.com/q/26156816
tags question: http://stackoverflow.com/q/26106527
tags question: http://stackoverflow.com/q/26083018
tags question: http://stackoverflow.com/q/26073745
tags question: http://stackoverflow.com/q/26084837
tags question: http://stackoverflow.com/q/26044040
tags question: http://stackoverflow.com/q/26081528
tags question: http://stackoverflow.com/q/26186875
tags question: http://stackoverflow.com/q/26076523
tags question: http://stackoverflow.com/q/26039322
tags question: http://stackoverflow.com/q/26187167
tags question: http://stackoverflow.com/q/26080435
tags question: http://stackoverflow.com/q/26127257
tags question: http://stackoverflow.com/q/26100766
tags question: http://stackoverflow.com/q/26130608
tags question: http://stackoverflow.com/q/26055863
tags question: http://stackoverflow.com/q/26138561
tags question: http://stackoverflow.com/q/26083731

http://stackoverflow.com/a/26213480
upvote count: 5
score: 5
downvote count: 0
has body: I checked the internal skin code and found a workaround, not pretty though. The problem is inside com.sun.javafx.scene.control.skin.ScrollPaneSkin, which calls viewRect.setCache(true). Disabling cache appears to solve the problem. PS: The cache property is also set to true in TitledPane, which has the same problem since JavaFX 8. ScrollPane2.java &lt;!-- language: lang-java --&gt; import javafx.scene.control.ScrollPane; import javafx.scene.control.Skin; public class ScrollPane2 extends ScrollPane { @Override protected Skin&lt;?&gt; createDefaultSkin() { return new ScrollPaneSkin2(this); } } ScrollPaneSkin2.java &lt;!-- language: lang-java --&gt; import java.lang.reflect.Field; import javafx.scene.control.ScrollPane; import javafx.scene.layout.StackPane; import com.sun.javafx.scene.control.skin.ScrollPaneSkin; class ScrollPaneSkin2 extends ScrollPaneSkin { private static Field viewRectField; static { try { viewRectField = ScrollPaneSkin.class.getDeclaredField("viewRect"); viewRectField.setAccessible(true); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } } private StackPane viewRect; public ScrollPaneSkin2(final ScrollPane scrollpane) { super(scrollpane); try { this.viewRect = (StackPane) viewRectField.get(this); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } this.viewRect.setCache(false); } } It may lower performance to have cache disabled, but I haven't noticed any slowdown.
type: Answer
answers question: http://stackoverflow.com/q/26098295

http://stackoverflow.com/comment/40848673
has text: see this link https://codeload.github.com/manishsri01/AndroidAlarmManagerDemo/zip/master
type: Comment
comment on: http://stackoverflow.com/a/26071250
score: 0
type: AnswerComment

sorting
tags question: http://stackoverflow.com/q/26129304
tags question: http://stackoverflow.com/q/26106829
tags question: http://stackoverflow.com/q/26145659
tags question: http://stackoverflow.com/q/26047945
tags question: http://stackoverflow.com/q/26096376
tags question: http://stackoverflow.com/q/26178428
tags question: http://stackoverflow.com/q/26154108
tags question: http://stackoverflow.com/q/26048684
tags question: http://stackoverflow.com/q/26062613
tags question: http://stackoverflow.com/q/26034565
tags question: http://stackoverflow.com/q/26138493
tags question: http://stackoverflow.com/q/26088567
tags question: http://stackoverflow.com/q/26093799
tags question: http://stackoverflow.com/q/26125164
tags question: http://stackoverflow.com/q/26087539
tags question: http://stackoverflow.com/q/26187548
tags question: http://stackoverflow.com/q/26050402
tags question: http://stackoverflow.com/q/26122021
tags question: http://stackoverflow.com/q/26101540
tags question: http://stackoverflow.com/q/26153907
tags question: http://stackoverflow.com/q/26152101
tags question: http://stackoverflow.com/q/26085353
tags question: http://stackoverflow.com/q/26154715
type: Tag
tags question: http://stackoverflow.com/q/26097538
tags question: http://stackoverflow.com/q/26104767
tags question: http://stackoverflow.com/q/26162646
tags question: http://stackoverflow.com/q/26051595
tags question: http://stackoverflow.com/q/26097379
tags question: http://stackoverflow.com/q/26156297
tags question: http://stackoverflow.com/q/26042139
tags question: http://stackoverflow.com/q/26038692
tags question: http://stackoverflow.com/q/26107921
tag name: sorting
tags question: http://stackoverflow.com/q/26149732
tags question: http://stackoverflow.com/q/26159011
tags question: http://stackoverflow.com/q/26148018
tags question: http://stackoverflow.com/q/26160637
tags question: http://stackoverflow.com/q/26146925
tags question: http://stackoverflow.com/q/26083314
tags question: http://stackoverflow.com/q/26185323
tags question: http://stackoverflow.com/q/26106551
tags question: http://stackoverflow.com/q/26129861

obfuscation
tags question: http://stackoverflow.com/q/26098042
tags question: http://stackoverflow.com/q/26111379
type: Tag
tags question: http://stackoverflow.com/q/26083934
tag name: obfuscation

http://stackoverflow.com/q/26052502
has comment: http://stackoverflow.com/comment/40815249
has title: Finding a file in a directory and returning its full path and filename
tagged with: loops
linked to: http://stackoverflow.com/q/15624226
type: Question
has answer: http://stackoverflow.com/a/26052616
accepted answer: http://stackoverflow.com/a/26052616
upvote count: 1
answer count: 1
favorite count: 0
has body: This should be easy. This question (Java - Search for files in a directory) seemed to take me 99% of the way to where I needed to be, but that missing 1% is being a real SOB. I need to find a specific file in a directory and return the full path and filename as a string. If there's more than one matching file, that's fine, I just need the first match. The code below works inasmuch as it will recursively traverse a directory structure and return all matches -- I can see it happening when I put sysouts into the various parts of the method -- but I can't for the life of me make it stop when it finds a match and return me the value of the match. I've tried substituting the FOR statement with a WHILE statement controlled by the the value of the foundfile variable as well as half a dozen other approaches but they all come down to the same end; when I find the matching file and set it to the foundfile variable in the "else if" clause, the for loop just keeps on iterating and overwrites the value of the foundfile variable with the "" value on the next loop. I would have thought that calling the setOutput method from within the "if else" clause would have set the value successfully until the list array was empty, but evidently not. Clearly there is something about recursion and the persistence of parameters that I'm fundamentally misunderstanding. Can anyone illuminate? package app; import java.io.*; import java.util.*; class FindFile { public String setOutput(String name, File file, String fileloc) { String foundfile = fileloc; File[] list = file.listFiles(); if (list != null) for (File fil : list) { if (fil.isDirectory()) { setOutput(name, fil, foundfile); } else if (fil.getName().contains(name)) { foundfile = (fil.getParentFile() + "\\" + fil.getName()); setOutput(name, fil, foundfile); } } return foundfile; } public static void main(String[] args) { FindFile ff = new FindFile(); String thisstring = ff.setOutput(".jar", new File("/Temp/df384b41-198d-4fee-8704-70952d28cbde…
tagged with: recursion
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26147519
has comment: http://stackoverflow.com/comment/40987333
answer count: 1
downvote count: 0
favorite count: 0
has title: Entry undefined in HashMap iteration loop
has comment: http://stackoverflow.com/comment/40987515
upvote count: 1
tagged with: dictionary
has answer: http://stackoverflow.com/a/26148290
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26148290
tagged with: loops
has body: I've done the following dozens of times: for(Map.Entry&lt;Key, WordSet&gt; entry : topWordCountSets.entrySet()) { Key currentKey = (entry.getKey()); } However, entry in entry.getKey() is apparently undefined. I don't define it anywhere outside the loop, so there are no collisions. Here's more code (the get best algorithm is not completed, due to the fact that entry is not defined.): package hangman; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; public class Partitions { private int _wordLength = 2; private WordSet _L; private HashMap&lt;Key, WordSet&gt; _partitions = new HashMap&lt;Key, WordSet&gt;(); public void initialize(InputStream stream, int wordLength) throws Exception { _L = WordSetParser.generate(stream,wordLength); } private void _partition(char by) throws Exception { _partitions.clear(); Iterator&lt;Word&gt; iterator = _L.iterator(); while(iterator.hasNext()) { Word nextWord = iterator.next(); if(nextWord.length() == _wordLength) { Key nextKey = new Key(nextWord, by); if(!_partitions.containsKey(nextKey)) { _partitions.put(nextKey, new WordSet(_wordLength)); } _partitions.get(nextKey).add(nextWord); } } } public WordSet getBestPartition(char by) throws Exception { //Establish partitions _partition(by); //Find partitions with greatest number of words HashMap&lt;Key, WordSet&gt; topWordCountSets = new HashMap&lt;Key, WordSet&gt;(); int maxWords = 0; for(Map.Entry&lt;Key, WordSet&gt; entry : _partitions.entrySet()) { if(entry.getValue().size() &gt; maxWords) { maxWords = entry.getValue().size(); topWordCountSets.clear(); topWordCountSets.put(entry.getKey(), entry.getValue()); } else if(entry.getValue().size() == maxWords) { topWordCountSets.put(entry.getKey(), entry.getValue()); } } if(topWordCount.size() == 1) return (WordSet)topWordCountSets.values().toArray()[0]; else { //Find partitions with best key Key bestKey = null; for…
type: Question
has comment: http://stackoverflow.com/comment/40987829
tagged with: iterator
has comment: http://stackoverflow.com/comment/40987362
has comment: http://stackoverflow.com/comment/40987406

http://stackoverflow.com/q/26068817
answer count: 1
favorite count: 0
tagged with: linux
type: UnansweredQuestion
upvote count: 4
has answer: http://stackoverflow.com/a/39232935
tagged with: selinux
downvote count: 0
tagged with: java
has title: Where Is the Java SELinux Policy Module for CentOS 7?
has body: I noticed that in the targeted SELinux policy for CentOS 7, there is no java.pp file in the /etc/selinux/targeted/modules/active/modules directory. Interestingly enough, in the source rpm selinux-policy-3.12.1-153.el7.src.rpm from http://vault.centos.org, there are java.te, java.if, and java.fc, files, so I tried to get a java.pp by copying them in a seperate folder and running: make NAME=targeted -f /usr/share/selinux/devel/Makefile but I get an error 74:ERROR 'unknown type java_domain'and no java.pp file. Does anyone the state of Java ans SELinux for CentOS 7. I noticed that my CentOS 6.5 servers have a java.pp module available. Thanks, greenaj
type: Question
score: 4

http://stackoverflow.com/comment/40958708
type: QuestionComment
comment on: http://stackoverflow.com/q/26131832
type: Comment
has text: ListViews will reuse views for the child objects, which is why you're seeing the color on 'random' views
score: 1

http://stackoverflow.com/comment/40919838
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26110197
has text: @medo42 I was wondering if someone might notice that - now you have compelled me to refine my answer :)

http://stackoverflow.com/comment/40927842
has text: Treeview hasn't built in sorting feature. You need to do it manually by reconstructing the items, or use the code from blog post you have linked in your question.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26102291
score: 1

http://stackoverflow.com/comment/40889206
score: 0
has text: # Required metadata sonar.projectKey=rohan_key2 sonar.projectName=NoSqlData sonar.projectVersion=1.2 # Comma-separated paths to directories with sources (required) sonar.sources=src sonar.binaries=build/classes # Language sonar.language=java # Encoding of the source files sonar.sourceEncoding=UTF-8 #sonar.devcockpit.userAutoMapping=true #sonar.scm.enabled=true
comment on: http://stackoverflow.com/q/26092773
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41044477
score: 0
type: Comment
type: QuestionComment
has text: @vikingsteve: it will vary on how long the previous tests take.
comment on: http://stackoverflow.com/q/26177689

http://stackoverflow.com/q/26070286
has answer: http://stackoverflow.com/a/31977720
answer count: 1
favorite count: 0
tagged with: single-sign-on
has comment: http://stackoverflow.com/comment/42330647
has title: How to setup pre-authentication header-based authentication in Spring Boot?
has comment: http://stackoverflow.com/comment/40997869
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42333704
has comment: http://stackoverflow.com/comment/42073078
tagged with: spring-boot
tagged with: java
has comment: http://stackoverflow.com/comment/42107440
tagged with: pre-authentication
has comment: http://stackoverflow.com/comment/42150666
type: Question
has comment: http://stackoverflow.com/comment/42984700
upvote count: 15
has comment: http://stackoverflow.com/comment/42269903
has comment: http://stackoverflow.com/comment/41020636
downvote count: 0
has body: My app gets an AUTH_USER request header with username from Oracle Access Manager SSO. Spring Security "Additional Topics" 2.2.1 has an example of "PreAuth" that seems to be what I need, but not a full working example. Snippets below are from docs/examples, not working annotation-based configuration. Siteminder Example Configuration - using XML with a RequestHeaderAuthenticationFilter and PreAuthenticatedAuthenticationProvider and a UserDetailsService to lookup users. How does this map to Java-based config? <security:http> <security:custom-filter position="PRE_AUTH_FILTER" ref="siteminderFilter" /> </security:http> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider ref="preauthAuthProvider" /> </security:authentication-manager> The Spring Security preauth example has a completely different setup (the XML config is even more intimidating). No mention of the pre-auth filter or how to set the header name. @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/login","/resources/**").permitAll() .anyRequest().authenticated() .and() .jee() .mappableRoles("USER","ADMIN"); } } The spring-boot-sample-web-secure extends WebMvcConfigurerAdapter instead of WebSecurityConfigurerAdapter, and just does basic form-based logins, no info on how to get userid from pre-auth AUTH_USER header. public class SampleWebSecureApplication extends WebMvcConfigurerAdapter { ... omitted... @Bean public ApplicationSecurity applicationSecurity() { return new ApplicationSecurity(); } @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().fullyAuthenticated().and(…
tagged with: spring-security
score: 15
has comment: http://stackoverflow.com/comment/41065846
has comment: http://stackoverflow.com/comment/42032734
has comment: http://stackoverflow.com/comment/42659782
has comment: http://stackoverflow.com/comment/42855253
has comment: http://stackoverflow.com/comment/42229033

http://stackoverflow.com/comment/40896131
comment on: http://stackoverflow.com/q/26097173
score: 0
has text: ras.getString(3); what for this line?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26166083
type: UnansweredQuestion
tagged with: mysql
has comment: http://stackoverflow.com/comment/53615839
tagged with: java
tagged with: hibernate
tagged with: composite-key
type: Question
has title: Hibernate Reverse Engineering Create Set (Composite Key)
score: 2
downvote count: 0
has body: I'm having trouble getting Hibernate to correctly reverse engineer a MySQL database into a Java Class. I have 3 tables: departments (pk = dept_no) employees (pk = emp_no) dept_emp (composite pks dept_no and emp_no) I am trying to modify the Hibernate Reverse Engineering file to force the DeptEmp Java class that is generated to link a single department to a set of employees within that department, but I keep getting the same error, even though I have declared a name attribute for the set: org.hibernate.MappingException: Could not configure overrides from file: C:\lib\workspace\Hibernate Analysis 2\resources\hibernate.reveng.xml Could not configure overrides from file: C:\lib\workspace\Hibernate Analysis 2\resources\hibernate.reveng.xml org.hibernate.MappingException: Could not configure overrides from file: C:\lib\workspace\Hibernate Analysis 2\resources\hibernate.reveng.xml Could not configure overrides from file: C:\lib\workspace\Hibernate Analysis 2\resources\hibernate.reveng.xml org.hibernate.MappingException: invalid override definition invalid override definition org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 88; Attribute "name" must be declared for element type "set". Attribute "name" must be declared for element type "set". My Reverse Engineering File: <?xml version="1.0" encoding="UTF-8"?> <hibernate-reverse-engineering> <table-filter match-catalog="employees" match-name="departments" /> <table-filter match-catalog="employees" match-name="employees" /> <table-filter match-catalog="employees" match-name="dept_emp" /> </hibernate-reverse-engineering> My Hibernate Config: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/employees **** **** org.hibernate.dialect.MySQLDialect employees 20 thread org.hibernate.cache.NoCacheProvider true true true </hibernate-configuration>
favorite count: 0
tagged with: reverse-engineering
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/41060492
comment on: http://stackoverflow.com/a/26186292
score: 0
type: AnswerComment
has text: @Pink, Its not automatic. You have to read the docs and setup the config file. There's no automatic way to translate `index` to `index.jsp` without modifying some xml files etc.
type: Comment

http://stackoverflow.com/comment/40893041
type: QuestionComment
has text: If you can afford to keep a state, you could adapt a logic based on the maximum records per time period. Say, if you know that you will absolutely never have more than 100 record within the same minute, then your ID = (number of minutes since some predefined timestamp in the past, say 1/1/2010)*100 + (record number within current minute). This example would hit the 9 digit limit around the end of 2028 :).
comment on: http://stackoverflow.com/q/26094841
score: 0
type: Comment

http://stackoverflow.com/q/26153986
has answer: http://stackoverflow.com/a/26154090
has title: What's wrong with this java for loop?
has comment: http://stackoverflow.com/comment/40999432
tagged with: syntax
type: UnansweredQuestion
tagged with: java
downvote count: 3
upvote count: 1
type: Question
tagged with: conditional-statements
score: -2
has body: I'm trying to see what are some cool things i can do with a for loop. Here's a simple code to print all numbers divisible by 321 between 10_000 and 100_000. but it doesn't work: for(int i=10000;i&lt;=100000 &amp;&amp; i%321==0;i++){ println(i); } wasn't it true that i can put conditional statement between the second and third semicolon? this just outputs nothing, so i'm assuming there's no i values true.
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/26154007
has comment: http://stackoverflow.com/comment/40999412
tagged with: boolean-logic
favorite count: 0
has comment: http://stackoverflow.com/comment/40999529

http://stackoverflow.com/comment/41015216
type: Comment
type: QuestionComment
score: 0
has text: I want the close/minimize buttons to appear. I think a JWindow would be ill-suited considering it doesn't embed a title bar.
comment on: http://stackoverflow.com/q/26162178

http://stackoverflow.com/a/26179820
upvote count: 1
type: Answer
has body: You could create a single Ant buildfile in which you centralize all external (third-party) task definitions. Whenever an Ant buildfile needs to use these tasks, you can import this buildfile: &lt;project name="MyProject" ...&gt; &lt;import file="${path_to_file}/tasks_ext.xml"/&gt; ... &lt;/project&gt;
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26179754
has comment: http://stackoverflow.com/comment/41047258
has comment: http://stackoverflow.com/comment/41047353
answers question: http://stackoverflow.com/q/26179754

http://stackoverflow.com/a/26042510
score: 1
downvote count: 0
has body: This is an Anonymous class. It's a shortcut to use Abstract class or Interface without having to explicitly write a subclass.
type: Answer
answers question: http://stackoverflow.com/q/26042391
upvote count: 1

http://stackoverflow.com/comment/40947136
score: 0
type: Comment
type: QuestionComment
has text: You tried putting `@SerializedName(".expires")` and it didn't work?
comment on: http://stackoverflow.com/q/26125454

http://stackoverflow.com/a/26088625
has comment: http://stackoverflow.com/comment/40881684
downvote count: 0
score: 1
has body: An example of an unexpected result: public static int count; public static void run1() { count = 0; long r1 = getNum1(); long r2 = getNum2(); // it is called in any case, so count = 1 if (r1 == 1L &amp;&amp; r2 == 0L) { /* if r1 = 1 and r2 = 0 then print "blah" if r1 = 0 then r2 is not checked! (lazy evaluation) */ System.out.println("blah"); } System.out.println(count); // always print 1 (count = 1) } public static void run2() { count = 0; if (getNum1() == 1L &amp;&amp; getNum2() == 0L) { /* if getNum1() = 1 and getNum2() = 0 then print "blah" if getNum1() = 0 then getNum2() is not checked, so count = 0! */ System.out.println("blah"); } System.out.println(count); // depends on the getNum1() result } // return 0 or 1 depending on milliseconds of the current time is even or odd public static long getNum1() { return System.currentTimeMillis() % 2L; } // same as getNum1() and addition set count to 1 public static long getNum2() { count = 1; return System.currentTimeMillis() % 2L; }
has comment: http://stackoverflow.com/comment/40880619
upvote count: 1
answers question: http://stackoverflow.com/q/26088277
type: Answer
has comment: http://stackoverflow.com/comment/40882012

http://stackoverflow.com/q/26083904
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/37211949
linked to: http://stackoverflow.com/q/2653949
tagged with: java
has body: I am developing an application where I have to display a map of a particular area/region (using latitude and longitude) in a JPanel, I need no additional functionality (like placing markers,etc..) from the map except for zooming in/out. I have no idea on how this can be achieved, some links explaining this would be of great help.
linked to: http://stackoverflow.com/q/5850338
has answer: http://stackoverflow.com/a/26083955
type: Question
linked to: http://stackoverflow.com/q/19701105
answer count: 2
linked to: http://stackoverflow.com/q/17598074
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/26083955
has answer: http://stackoverflow.com/a/37211949
linked to: http://stackoverflow.com/q/2492540
downvote count: 0
favorite count: 0
has title: how to display a map in a java swing application?
score: 6
tagged with: swing
upvote count: 6

http://stackoverflow.com/comment/40850128
comment on: http://stackoverflow.com/q/26071903
has text: Okay, so in C:\Users\Sam\introcs, there are the following folders: bin (the interesting one) checkstyle-5.5, findbugs-2.0.3, j3d, java, and there is a stlib.jar file. Within the bin folder, there is checkstyle-introcs.bat, checkstyle-introcs.ps1, findbugs-introcs.bat, findbugs-introcs.ps1, javac-introcs.bat, and finally java-introcs.bat
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40982869
score: 0
type: Comment
type: QuestionComment
has text: These are .java files
comment on: http://stackoverflow.com/q/26144947

http://stackoverflow.com/comment/40836923
score: 0
type: Comment
type: QuestionComment
has text: 1. since the reference to the newly created thread is not saved, no method can be called on it. 2. 'remote method'? can you elaborate?
comment on: http://stackoverflow.com/q/26064789

http://stackoverflow.com/q/26172320
has title: Fixing Inconsistent query behaviour between datastax driver and cqlsh
favorite count: 0
tagged with: cassandra
upvote count: 3
has comment: http://stackoverflow.com/comment/41045264
has comment: http://stackoverflow.com/comment/44052269
has comment: http://stackoverflow.com/comment/42112790
has comment: http://stackoverflow.com/comment/41033971
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41036991
tagged with: java
tagged with: datastax-java-driver
type: Question
has body: String cql = "SELECT * FROM myks.tbl WHERE bid=? AND mid&lt;? LIMIT ? ORDER BY mid DESC ALLOW FILTERING"; If I execute this in cqlsh, it works fine, with or without ALLOW FILTERING appended. If I execute this from the latest (2.1.1) datastax driver I get com.datastax.driver.core.exceptions.InvalidQueryException: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING It clearly works from the command line, so doesn't that mean it should work from the driver. What to do?

http://stackoverflow.com/q/26137095
tagged with: same-origin-policy
type: Question
type: AnsweredQuestion
tagged with: junit
has answer: http://stackoverflow.com/a/26138322
tagged with: gwt-super-dev-mode
has title: GWT JUnit Test - Is it possible to ignore same-origin policy
answer count: 1
tagged with: gwt
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26138322
has body: I am trying to run an asynchronous test and need to send a request to my server, which has a REST-API. So my problem is that the tests are executed on the local machine, but this obviously violates the same origin policy and I get a RuntimeError if I try to run the GWTtestCase: com.google.gwt.http.client.RequestPermissionException: The URL http://<url-to-my-rest-service> is invalid or violates the same-origin security restriction at com.google.gwt.http.client.RequestBuilder.doSend(RequestBuilder.java:394) at com.google.gwt.http.client.RequestBuilder.send(RequestBuilder.java:242) ... I know that I can run these tests manually, but with the latest updates of my browser (chromium), the GWT-Plugin was removed. So I don't know how to launch the tests in SuperDevMode. Questions: Is there a way to ignore the same-origin policy for the GWT JUnit Tests? Can I change the browser which is used for the test to Chrome/Chromium? How can I manually run the tests with SuperDevMode in a browser? Edit: If I want to run the tests manually I write the following into the terminal: mvn gwt:test -Dgwt.args="-prod -userAgents safari -runStyle Manual:1" Maven then will print an URL to the terminal which I should enter into the browser to execute the tests: http://127.0.1.1:57818/<my-package>.JUnit/junit-standards.html?gwt.codesvr=127.0.1.1:40387 But if I enter this URL into my browser (Chromium) it will notify me that the GWT-Plugin is currently not installed. If I remove the part behind the question mark (like I do if I want to run the GWT-Code in SuperDevMode on the localhost) ?gwt.codesvr=127.0.1.1:40387 then the browser will show only a blank page, and also if I started the codeserver with: mvn process-classes gwt:run-codeserver the codeserver-bookmarks (Dev Mode On) are not working and GWT is not able to detect a module which is "compilable". Question: So how excatly do I compile the JUnit-Test-Module with the SuperDevMode?

http://stackoverflow.com/comment/40881110
type: QuestionComment
has text: You need to understand Unicode values.
comment on: http://stackoverflow.com/q/26089158
score: 0
type: Comment

http://stackoverflow.com/a/26092677
has body: Code: double i = 5.4; String[] s = Double.toString(i).split("\\."); System.out.println(s[1]); output: 4 Explantion: you can convert the double to String type and after that use split function which split the converted double to String in two pieces because of using \\. delimiter. At the end, type out the second portion that you want. you can try this code: double i = 4.4; String s = Double.toString(i); boolean seenFloatingPoint = false; for (int j = 0; j &lt; s.length(); j++) { if(s.charAt(j)== '.' &amp;&amp; !seenFloatingPoint){ seenFloatingPoint = true; } else if (seenFloatingPoint) System.out.print(s.charAt(j)); } System.out.println(""); output: 4
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26092585
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40889800

http://stackoverflow.com/q/26185434
has comment: http://stackoverflow.com/comment/41058295
score: 2
has comment: http://stackoverflow.com/comment/41058172
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41058581
has title: The String class and Java's dependency on it
tagged with: java
has body: So everyone knows that the shortest Java program that you can write is: public class Program{ public static void main(String []args){ } } One would suspect that this shortest program would only consist out of language keywords, chosen names (like class name / function name / parameter name) and some syntax (brackets, etc). But when you look closely suddenly the String class pops up. So does that mean that the language Java can not live without its String class? Or even without the complete standard library? (I thought C++ is able to exist without its standard library, no?) Also I have been looking at the String class code but nowhere was an implementation of the operators + and += (maybe others are available?) to be found. How does this work then? Is this embedded as a special case in the compiler? Which would even bind the String class even tighter to the java language? Are there other classes that are embedded so deeply in the Java language?
has comment: http://stackoverflow.com/comment/41058787
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41058116
downvote count: 1
has comment: http://stackoverflow.com/comment/41058170
tagged with: string
has comment: http://stackoverflow.com/comment/41058339
has comment: http://stackoverflow.com/comment/41058171
has comment: http://stackoverflow.com/comment/41058886
favorite count: 0
has comment: http://stackoverflow.com/comment/41058347
upvote count: 3
possible better answer: http://stackoverflow.com/a/26185917
has comment: http://stackoverflow.com/comment/41059222
has answer: http://stackoverflow.com/a/26185917
has comment: http://stackoverflow.com/comment/41058542
tagged with: standard-library
has comment: http://stackoverflow.com/comment/41058271
linked to: http://stackoverflow.com/q/4648607
has comment: http://stackoverflow.com/comment/41058519
has answer: http://stackoverflow.com/a/26185648
accepted answer: http://stackoverflow.com/a/26185648

http://stackoverflow.com/q/26035093
accepted answer: http://stackoverflow.com/a/26035577
score: 0
has answer: http://stackoverflow.com/a/26035738
tagged with: io
tagged with: user-interface
has comment: http://stackoverflow.com/comment/40781788
has body: I am trying to build a GUI app, which would read a text file on the press of a button and then save contents of this file to a string. My current code, I basically tried to adapt my console code for the gui, but it doesnt seem to work. Here is my button code: private void convertButtonActionPerformed(java.awt.event.ActionEvent evt) { Scanner user_input = new Scanner(tempTextField.getText()); String seq1 = user_input.next(); Scanner scanner = new Scanner(new File(seq1)); scanner.nextLine(); String content = scanner.useDelimiter("\\Z").next(); int N = content.length(); textarea.append("Length of the input string is: "+N); } textarea = JtextArea tempTextField = JTextField Thank you. edit: I'm using netbeans IDE
tagged with: swing
has comment: http://stackoverflow.com/comment/40782013
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26035738
tagged with: java
type: Question
answer count: 2
has title: Swing Java GUI reading a text file with scanner
has answer: http://stackoverflow.com/a/26035577

http://stackoverflow.com/comment/40977198
comment on: http://stackoverflow.com/q/26141994
type: Comment
type: QuestionComment
has text: You're right. I tried again and it worked as expected.
score: 0

http://stackoverflow.com/q/26092469
has comment: http://stackoverflow.com/comment/40900521
has answer: http://stackoverflow.com/a/26101098
answer count: 3
has comment: http://stackoverflow.com/comment/40887734
downvote count: 0
has body: I just came across this website and tried doing that in Java and C++. Why writing the following in Java gives 0.30000000000000004 double x = 0.1 + 0.2; System.out.print(x); Whereas writing the following in C++ gives 0.3? double x = 0.1 + 0.2; cout&lt;&lt;x;
favorite count: 0
has answer: http://stackoverflow.com/a/26100758
has comment: http://stackoverflow.com/comment/40887380
tagged with: c++
has comment: http://stackoverflow.com/comment/40887557
has comment: http://stackoverflow.com/comment/40887381
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26101176
has comment: http://stackoverflow.com/comment/40887382
type: Question
score: 3
has title: Why does this float operation in C++ and Java give different results?
tagged with: java
has comment: http://stackoverflow.com/comment/40889505
has comment: http://stackoverflow.com/comment/40887750
has comment: http://stackoverflow.com/comment/40887733

http://stackoverflow.com/q/26142631
answer count: 3
has title: Why does Spring MockMvc result not contain a cookie?
linked to: http://stackoverflow.com/q/22853321
has comment: http://stackoverflow.com/comment/41011978
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40980197
has answer: http://stackoverflow.com/a/47069042
has answer: http://stackoverflow.com/a/26281932
tagged with: spring
tagged with: mockmvc
linked to: http://stackoverflow.com/q/14308341
type: Question
has comment: http://stackoverflow.com/comment/40983202
tagged with: cookies
tagged with: java
has answer: http://stackoverflow.com/a/46205644
score: 20
upvote count: 20
downvote count: 0
tagged with: spring-security
favorite count: 0
has body: I am trying to unit-test login and security in my REST API, so I try to mock real-life request sequences as close as possible. My first request would be: this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac). addFilters(springSecurityFilterChain).build(); this.mapper = new ObjectMapper(); .... MvcResult result=mockMvc.perform(get("/login/csrf")).andExpect(status().is(200)).andReturn(); Cookie[] cookies = result.getResponse().getCookies(); (See full class on pastebin). I try to get the cookie here to be able to login with the received CSRF token later, but the cookies array is empty! However, if I run my application and call curl -i http://localhost:8080/login/csrf I do get back a Set-Cookie header and can use that cookie (and the CSRF token) later to authenticate. So the question is: How do I get MockMvc to return a cookie to me?

http://stackoverflow.com/comment/41029433
type: QuestionComment
comment on: http://stackoverflow.com/q/26169827
type: Comment
has text: Can you give an example of actual input and expected output? it isn't clear what `switchPairs` is supposed to achieve. It doesn't take any arguments so it's not going to swap two specific items.
score: 0

http://stackoverflow.com/comment/40978103
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26142347
has text: That explains all. Thanks.
type: Comment

http://stackoverflow.com/q/26046153
type: Question
downvote count: 4
upvote count: 0
accepted answer: http://stackoverflow.com/a/26046207
possible better answer: http://stackoverflow.com/a/26046226
has answer: http://stackoverflow.com/a/26046226
answer count: 3
has title: bad operand type String for unary operator '+++'
favorite count: 0
has comment: http://stackoverflow.com/comment/40802281
score: -4
has answer: http://stackoverflow.com/a/26046207
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26046220
has body: This is an assignment I am working on. I get, bad operand type String for unary operator '+++' on line 12. I am not sure how to fix this. I actually just copied it straight from my book... which means I spent 150$ for poor quality. but that is neither here or there. Please help. import java.util.Scanner; public class ComputeTax { public static void main(String[] args) { // Create a Scanner Scanner input = new Scanner(System.in); // Prompt the user to enter filing status System.out.print( "(0-single filer, 1-married jointly or qualifying widow(er)", + "\n2-married separately, 3-head of household)\n" + "Enter the filing status: "); int status = input.nextInt(); // Prompt the user to enter taxable income System.out.print("Enter the taxable income: "); double income = input.nextDouble(); // Compute tax double tax = 0; if (status == 0) {// Compute tax for single filers if (income &lt;= 8350) tax = income * 0.10; else if (income &lt;= 33950) tax = 8350 * 0.10 + (income - 8350) * 0.15; else if (income &lt;= 82250) tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (income - 33950) * 0.25; else if (income &lt;= 171550) tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (income - 82250) * 0.28; else if (income &lt;= 372950) tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 + (income - 171550) * 0.33; else tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 + (372950 - 171550) * 0.33 + (income - 372950) * 0.35; } else if (status == 1) { // Left as exercise // Compute tax for married file jointly or qualifying widow(er) } else if (status == 2) { // Compute tax for married separately // Left as exercise } else if (status == 3) { // Compute tax for head of household // Left as exercise } else { System.out.println("Error: invalid status"); System.exit(1); } // Display the result System.out.println("Tax is " + (int)(tax * 100) / 100.0); } }

http://stackoverflow.com/comment/41057665
type: AnswerComment
score: 0
type: Comment
has text: agree, so the point is that the last bolt needs to return a single Tuple and the last bolt must define a single field.
comment on: http://stackoverflow.com/a/26181523

http://stackoverflow.com/comment/41072088
has text: Did you try to explicitely input `2,00` ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26193074
score: 0

http://stackoverflow.com/comment/41065761
has text: I am not sure how you convert your characters to numbers, but did you know that you can interpret a `char` as an `int`? You can get a mapping A -> 1, B -> 2, ... by doing: `((int)c)-64` where `c` is your `char`. Well... so much for type-safety, but at least, working directly with numbers seeems to be much simpler. For each character, you can then: "cast" it to an `int`, as described; If the value is less than or equal to 5, then multiply by to; else if (and so on); compute the result modulo 26; add 64; cast back to `char`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26189346

http://stackoverflow.com/comment/40980744
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26120316
type: Comment
has text: I successfully applied DS-2099. When I add the line `dso=HandleManager.resolveToObject(context,handle);`, I got cannot resolve symbol 'dso'. Making it `DSpaceOBject dso`, I got Inconvertible types error in the line `(dso instanceof Item)` and cannot find symbol error in `DCValue[] titles= dso.getMetadata("dc", "contributor", "author",null);` Please advise. Thanks.

http://stackoverflow.com/a/26175612
has body: You could change the variable via a setter method and do stuff there.
has comment: http://stackoverflow.com/comment/41039744
type: Answer
answers question: http://stackoverflow.com/q/26175600
score: 1
has comment: http://stackoverflow.com/comment/41039654
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26081994
type: Answer
answers question: http://stackoverflow.com/q/26072872
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40868973
downvote count: 1
has comment: http://stackoverflow.com/comment/40869051
has body: don't use relative URL ("images/img_1.gif") but absolute ones ("/images/img_1.gif") don't place static resources under WEB-INF. This folder is by nature never directly exposed to web requests, only accessible through a servlet mapping definition.

http://stackoverflow.com/q/26112895
tagged with: neo4j
favorite count: 0
has body: In my embedded neo4j server I am storing some values as Integer types, which works fine. However if I view my database through the neo4j browser, any set command I use is setting the value type as Long, which renders type conversion errors from that point on. For example: MATCH (a:`JOB` {id: "something"}) SET a.totalSubscribers = 0 It seems as though the totalSubscribers value gets set to type Long. Is there any way to set it to Integer through the neo4j browser? I have tried toInt(0), but that doesn't change the result. EDIT: It seems as though incrementing or decrementing a property still causes the issue also. Eg. a.totalSubscribers = a.totalSubscribers + 1
tagged with: cypher
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has title: Neo4j browser storing cypher set value as long
downvote count: 0

http://stackoverflow.com/comment/40963635
score: 0
type: Comment
has text: PDB - Pluggable databases, CDB - Container databases and MOS - My Oracle Support. Anyway, looking at the log you posted, the issue seems to be with the `JDBC connection` and Oracle is just the victim. Culprit seems to be the `connection method`.
type: QuestionComment
comment on: http://stackoverflow.com/q/26125525

http://stackoverflow.com/comment/40840306
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26066516
type: Comment
has text: (Also, you don't need the whole array, since only `read` bytes are actually read from the audio recorder.)

http://stackoverflow.com/a/26112925
has comment: http://stackoverflow.com/comment/40924443
has body: your attempt is good what ever you are trying to do can help you by below code URL urls [] = {}; JarFileLoader cl = new JarFileLoader (urls); cl.addFile ("/opt/mysql-connector-java-5.0.4/mysql-connector-java-5.0.4-bin.jar"); System.out.println ("attempt..."); cl.loadClass ("org.gjt.mm.mysql.Driver"); System.out.println ("Success!"); I hope this will help you The JVM searches for and loads classes in this order: Bootstrap classes, which are classes that comprise the Java platform, including the classes in rt.jar and several other important JAR files. Extension classes, which use the Java Extension mechanism. These classes are bundled as JAR files and located in the extensions directory. User classes are classes that are defined by developers and third parties and that do not take advantage of the extension mechanism.
answers question: http://stackoverflow.com/q/26112874
score: 0
type: Answer

http://stackoverflow.com/comment/40990317
type: AnswerComment
score: 0
type: Comment
has text: PS yes I will not break the naming convention now - I appreciate the feedback.
comment on: http://stackoverflow.com/a/26148034

http://stackoverflow.com/comment/40844389
type: Comment
type: QuestionComment
has text: Code is worth 1024 words.
score: 3
comment on: http://stackoverflow.com/q/26069021

http://stackoverflow.com/comment/40790180
has text: Your measurements do not support this because, with single-threaded, you get just 10% worse with i7 than with i5. I've checked the CPU specs, your i7 has 2.2 GHz and i5 has 3.1 GHz. Also, obviously, you are not comparing CPUs with everything else being equal; you are comparing complete machines with those CPUs.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26039410
type: Comment

http://stackoverflow.com/a/26116254
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26115927
has body: Create a InputStream: InputStream is = context.getResources().openRawResource(R.xml.data); Once you have the input stream (above) you can pass it to an instance of DocumentBuilder: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document dom = builder.parse(is); Element root = dom.getDocumentElement(); NodeList items = root.getElementsByTagName("zname");

http://stackoverflow.com/q/26092318
has body: I have classes auto-generated in NetBeans with RESTful template from entities, with CRUD functions (annotated with POST, GET, PUT, DELETE). I have a problem with create method, which after inserting an entity from the frontend, I would like create to update a response so that my view will automatically (or asynchronously, if that's the right term) reflect the added entity. I came across this (example) line of code but written in C# (of which I know nothing about): HttpContext.Current.Response.AddHeader("Location", "api/tasks" +value.Id); Using JAX-RS in Java, is there anyway to get the current HttpContext just like in C# and to manipulate the header? The closest I came about is Response.ok(entity).header("Location", "api/tasks" + value.Id); and this one certainly is not working. It seems I need to get the current HttpContext before building the Response. Thanks for your help.
downvote count: 0
possible better answer: http://stackoverflow.com/a/47522340
accepted answer: http://stackoverflow.com/a/26094619
tagged with: jax-rs
favorite count: 0
has answer: http://stackoverflow.com/a/26094619
has title: Create Response with Location header in JAX-RS
type: AnsweredQuestion
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/47522340
upvote count: 21
linked to: http://stackoverflow.com/q/52773898
type: Question
tagged with: c#
answer count: 2

http://stackoverflow.com/a/26074866
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26073976
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26073976
has body: I'm not a specialist of this library, but I think FTP is more about sending / receiving files from a remote server, than directly accessing to the remote file system. So to create a remote file, you should first create it locally (for instance, in a temporary directory), and then send it to the remote server. Check the documentation: https://commons.apache.org/proper/commons-net/javadocs/api-1.4.1/org/apache/commons/net/ftp/FTPClient.html And more especially this method: public boolean storeFile(String remote, InputStream local) throws IOException Given a local file "foo.txt", you can create an InputStream and send the file to remote end using that input stream: try (FileInputStream inputStream = new FileInputStream("foo.txt");) { ftpClient.storeFile("foo.txt", inputStream); } [edit] Note that since the methods takes an InputStream as parameter, you can eventually use something else than a local file as the input: you could also directly read from String.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26180897
has comment: http://stackoverflow.com/comment/41050800
has comment: http://stackoverflow.com/comment/41131239
has title: Bitmap image not being rendered correctly
has comment: http://stackoverflow.com/comment/41077772
has comment: http://stackoverflow.com/comment/41070389
favorite count: 0
has comment: http://stackoverflow.com/comment/41132152
has comment: http://stackoverflow.com/comment/41132268
possible better answer: http://stackoverflow.com/a/26181774
has comment: http://stackoverflow.com/comment/41132014
has comment: http://stackoverflow.com/comment/41132050
accepted answer: http://stackoverflow.com/a/26225717
has answer: http://stackoverflow.com/a/26181774
has body: I have this image This is simply a circle which becomes more transparent towards the edge. If I blit this image to the screen, I see the following: Does anyone have any idea why my image would be drawn to the screen like this? Here are my relevant functions: public void blit(Bitmap bitmap, int x, int y) { int x0 = x; int x1 = x + bitmap.width; int y0 = y; int y1 = y + bitmap.height; if (x0 &lt; 0) x0 = 0; if (y0 &lt; 0) y0 = 0; if (x1 &gt; width) x1 = width; if (y1 &gt; height) y1 = height; int ww = x1 - x0; for (int yy = y0; yy &lt; y1; yy++) { int tp = yy * width + x0; int sp = (yy - y) * bitmap.width + (x0 - x); tp -= sp; for (int xx = sp; xx &lt; sp + ww; xx++) { int col = bitmap.pixels[xx]; if (col &lt; 0 &amp;&amp; (tp+xx) &lt; pixels.length){ pixels[tp + xx] = normal(col, pixels[tp + xx]); } } } } public static int normal(int a, int b) { int aA = (a &gt;&gt; 24) &amp; 0xff; int aR = ((a &amp; 0xff0000) &gt;&gt; 16); int aG = ((a &amp; 0xff00) &gt;&gt; 8); int aB = (a &amp; 0xff); int bA = (b &gt;&gt; 24) &amp; 0xff; int bR = ((b &amp; 0xff0000) &gt;&gt; 16); int bG = ((b &amp; 0xff00) &gt;&gt; 8); int bB = (b &amp; 0xff); float alpha = aA / 255f; if (aA == 255 || bA == 0){ return a; } float srcAlpha = aA * (1 / 255f); float dstAlpha = bA * (1 / 255f); int A = (int) (aA+bA*(1-srcAlpha)); int R = (int) (aR*srcAlpha+bR*dstAlpha*(1-srcAlpha)); int G = (int) (aG*srcAlpha+bG*dstAlpha*(1-srcAlpha)); int B = (int) (aB*srcAlpha+bB*dstAlpha*(1-srcAlpha)); return A &lt;&lt; 24 | R &lt;&lt; 16 | G &lt;&lt; 8 | B; } //code for importing image public static Bitmap getBitmap(String location){ try{ BufferedImage image = ImageIO.read(ImageHandler.class.getResource(location)); Bitmap bitmap = new Bitmap(image.getWidth(), image.getHeight()); for(int i = 0; i &lt; image.getWidth(); i++){ for(int j = 0; j &lt; image.getHeight(); j++){ int rgb = image.getRGB(i, j); if(rgb != 0xFFFF00FF &amp;&amp; rgb != 0xFF990099){ bitmap.setPixel(rgb, i, j); } } } return bitmap; }catch(Exception…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41132298
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41131895
has answer: http://stackoverflow.com/a/26225717
has comment: http://stackoverflow.com/comment/41132116
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41079675
has comment: http://stackoverflow.com/comment/41132315
has comment: http://stackoverflow.com/comment/41121368

http://stackoverflow.com/comment/41104975
comment on: http://stackoverflow.com/a/26183336
score: 0
type: AnswerComment
has text: That makes sense. I've taken a look at this tutorial, but I could not see anything about javascript calling webservices. Is this possible natively with javascript, or should I use tierce lib, as JQuery for example?
type: Comment

http://stackoverflow.com/a/26164782
has comment: http://stackoverflow.com/comment/41024637
type: Answer
has comment: http://stackoverflow.com/comment/41023406
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41023095
accepted answer of: http://stackoverflow.com/q/26163348
answers question: http://stackoverflow.com/q/26163348
upvote count: 1
has body: Let your declaration and onCreate mthod be like this, so when you find get extras then call async class(Basically to do long duration operation on another thread). ListView listView; public String tag_name; public List&lt;NameAddress&gt; nameAddressList; Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_of_places); context = YourActivityName.this; listView = (ListView) findViewById(R.id.list_of_places); Intent intent = getIntent(); if (intent != null) { tag_name = intent.getStringExtra("CategoryName"); new ListAsync().execute(); } } Now, new ListAsync().execute(); this statement will call your async class where you ultimately call to web service and binds data to List, this operation must perform on another thread. After completion of that long task async class method onPostExecute executes and we make changes accordingly to reflect on unser interface. private class ListAsync extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { Log.i("test", "Running on ui thread"); } @Override protected Void doInBackground(Void... params) { Log.i("test", "Doding long operation on another thread"); final XMLDOMParserHandler parser = new XMLDOMParserHandler( tag_name.toLowerCase(), this); if (isConnectivityOn(context)) { try { URL myURL = new URL("http://somewebsite.com/admin/data.xml"); URLConnection ucon = myURL.openConnection(); final InputStream is = ucon.getInputStream(); nameAddressList = parser.parseXML(is); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { nameAddressList = parser.parseXML(getAssets().open("data.xml")); } } @Override protected void onPostExecute(Void result) { Log.i("tag", "getting back to uo thread to update user interface"); ListOfPlacesAdapter listOfPlacesAdapter = new ListOfPlacesAdapter( this, nameAddressList); listView.setAdapter(listOfPlacesAdapter); lis…
type: AcceptedAnswer

http://stackoverflow.com/a/26166660
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I am not sure why this is happening, this might have something to do with the way ComboBox handles ObservabeList in it. But this cannot be replicated using ChoiceBox. Can you please raise a JIRA with the JavaFX team, so that they can have a look at it? As a turnaround, you may do the following in your code to fix it temporarily : ComboBox&lt;String&gt; combo = new ComboBox&lt;String&gt;(list); Button change = new Button("change"); change.setOnAction((event) -&gt; { StringBuilder str = combo.getValue(); list.set(5, new String("-")); combo.setValue(str); });
score: 3
accepted answer of: http://stackoverflow.com/q/26144930
upvote count: 3
answers question: http://stackoverflow.com/q/26144930

http://stackoverflow.com/a/26175256
score: 4
answers question: http://stackoverflow.com/q/26175181
type: Answer
has comment: http://stackoverflow.com/comment/41039374
has body: The constructor isn't accepting a run method (e.g., as an argument), that code is creating an anonymous class, see this tutorial. Behind the scenes, a class with no name (anonymous class) is created that derives from Thread and overrides the run method; then an instance of that class is created and assigned to the t1 variable. Just for completeness, though: As of Java 8, it is possible for the Thread constructor to (in effect) accept a run function as an argument, because of Java 8's lambda functions. That looks like this: Thread t = new Thread(() -&gt; { System.out.println("Running"); }); This is possible because Thread has a constructor accepting a Runnable instance, and Runnable is a functional interface (an interface that only defines a single function), and so you can create an instance implementing that interface simply by using a lambda and then pass that into the Thread constructor. There's a tutorial on lambdas here. But that's not what the quoted code is doing. Here's the code in your question using a lambda instead of an anonymous class: Thread t1 = new Thread(() -&gt; { synchronized (resource1) { System.out.println("Thread 1: locked resource 1"); try { Thread.sleep(100);} catch (Exception e) {} synchronized (resource2) { System.out.println("Thread 1: locked resource 2"); } } });
accepted answer of: http://stackoverflow.com/q/26175181
has comment: http://stackoverflow.com/comment/41039720
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41039582

http://stackoverflow.com/comment/40886757
score: 0
type: AnswerComment
type: Comment
has text: Yes, after each record I need to do that. That is my requirement. I was wondering whether I can create a ThreadPool and use the approach I had thought of and distribute data to each of the threads but I am not sure if there are better approaches than this. Please suggest.
comment on: http://stackoverflow.com/a/26052444

http://stackoverflow.com/a/26153501
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26153069
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26153069
has body: For flexibility in choosing the resampling algorithm, use AffineTransformOp, as shown here, or just let the graphics context handle it, as shown here.
upvote count: 1

http://stackoverflow.com/q/26128640
has answer: http://stackoverflow.com/a/26128812
tagged with: java
has body: I am currently working on a tester program that utilized the awt class from Java. In this program, I am trying to produce 4 random dots in a specific quadrant of a grid. When reviewing my code, can you suggest a better route as far as organization goes? I am currently just using a for loop to display 4 points, like so: for (int dotsOnGrid = 1; dotsOnGrid &lt; 5; dotsOnGrid++) { int x = (int) (Math.random() * (.50 * width)); int y = (int) (Math.random() * (.50 * height)); g.setColor(Color.RED); g.fillOval(x, y, r, r); } As far as getting 4 red dots on the upper-left of the grid, I am solid. I am just having trouble figuring out how to produce the Yellow and Green dots. How would that work while using Math.random()? Thanks in advance for the help!
tagged with: class
type: Question
score: 0
has answer: http://stackoverflow.com/a/26128714
has answer: http://stackoverflow.com/a/26129003
tagged with: awt
answer count: 3
has title: Grid Program w/ java
has comment: http://stackoverflow.com/comment/40952934
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40952995

http://stackoverflow.com/q/26053908
has title: Could not start Spring MVC project
has body: I create a dynamic web project to develop a simple project, the first step I want to do is display the index page and show the title generate by controller. but it's always 404 status and no error or exception in log is there any problem? APIController.java @Controller public class APIController { @RequestMapping(value = "/index.web", method = RequestMethod.GET) public String welcome(ModelMap model) { model.addAttribute("title", "AM Core Test"); return "index"; } } web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web- app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.web contextConfigLocation /WEB-INF/dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener index.web dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.controller" /> /WEB-INF/jsp/ .jsp index.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> Spring MVC ${ title } Request: Response:
score: 0
has answer: http://stackoverflow.com/a/26054294
answer count: 1
has comment: http://stackoverflow.com/comment/40816465
has comment: http://stackoverflow.com/comment/40816596
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40816228
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40816724
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40816186
has comment: http://stackoverflow.com/comment/40816697
has comment: http://stackoverflow.com/comment/40816152
tagged with: jsp
has comment: http://stackoverflow.com/comment/40816884
has comment: http://stackoverflow.com/comment/40816411

http://stackoverflow.com/comment/40917762
comment on: http://stackoverflow.com/q/26108815
has text: @vlatkozelka: no, you're wrong. The new window if absolutely needed should be a dialog window such as a JDialog, not a JFrame. You don't want another independent program complete with icon on the system's task bar, do you? And the new window is a child window of the main window, so therefore it should be a dialog, either modal or non-modal depending on the need.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41008694
type: QuestionComment
has text: Which scraper are you using? Jsoup?
comment on: http://stackoverflow.com/q/26159114
score: 0
type: Comment

http://stackoverflow.com/a/26102708
answers question: http://stackoverflow.com/q/26102679
has comment: http://stackoverflow.com/comment/40906085
downvote count: 0
has comment: http://stackoverflow.com/comment/40905645
type: Answer
score: 2
has body: You need to escape the backslash. You also need to escape the backslash again because split() treats the string as a regular expression. Use .split("\\\\");
upvote count: 2

http://stackoverflow.com/comment/40999691
comment on: http://stackoverflow.com/q/26154066
type: Comment
has text: Defining `rec` as static won't cause any issues.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40926101
type: Comment
comment on: http://stackoverflow.com/a/26113738
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
type: AnswerComment
score: 2

http://stackoverflow.com/q/26135306
has comment: http://stackoverflow.com/comment/40966072
tagged with: path
has comment: http://stackoverflow.com/comment/40967602
linked to: http://stackoverflow.com/q/1975684
has comment: http://stackoverflow.com/comment/40964788
type: AnsweredQuestion
has body: I'm new in java and faced aproblem in PATH . I want to set classpath of java and want someone to review what i did to know what's the exact problem java -version java version "1.6.0_38" JAVA(TM) SE Runtime Environment (build 1.6.0_38-b05) Java Hotspot(TM) Client VM (build 20.13-b02,mixed mode, sharing) javac -version javac 1.6.0_38 whereis java /usr/bin/java /etc/java /usr/bin/X11/java /usr/share/java which java /usr/bin/java echo $CLASSPATH empty i edited in /etc/profile this JAVA_HOME=/usr/lib/jvm/jdk1.6.0_38 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export JRE_HOME export PATH and i edited in .bashrc this PATH=/usr/lib/jvm/jdk1.6.0_38/bin:$PATH export PATH I'm on ubuntu12.04
tagged with: java
has comment: http://stackoverflow.com/comment/40966124
tagged with: classpath
type: Question
accepted answer: http://stackoverflow.com/a/26135466
answer count: 1
has title: Needing to set CLASSPATH well
score: 0
has comment: http://stackoverflow.com/comment/40964992
has answer: http://stackoverflow.com/a/26135466

http://stackoverflow.com/a/26676037
has body: Despite my first Idea this is not a 'real' server issue, nor is it an issue with netty. The Client uses oio (java.IO) Sockets to connect to a Nio Netty Server. Changing NioEventLoopGroup to OioEventLoopGroup and NioServerSocketChannel to OioServerSocketChannel resolves this weird issue. Furthermore one may change the Client to work with Nio. In the following Example i will use java.nio: final SocketChannel c = SocketChannel.open(); c.connect(new InetSocketAddress("localhost", 8007)); final ByteBuffer buf = ByteBuffer.allocate(5); // fill Buffer buf.put((byte) 0x0); buf.put("Test".getBytes(CharsetUtil.UTF_8)); // Flip buffer buf.flip(); // Write buffer to socket while (buf.hasRemaining()) { c.write(buf); } System.out.println("Reading ..."); // Read buf.flip(); while (true) { int n = c.read(buf); if (n &lt; 0) { break; } final String d = new String(buf.array()); if(!d.isEmpty()) System.out.println("'" + d + "'"); buf.clear(); } // Finish Programm System.out.println("- DONE -"); c.close(); That example works perfectly fine. Obviously the problem was right infront of my eyes. Now it's fixed.
type: Answer
answers question: http://stackoverflow.com/q/26064985
accepted answer of: http://stackoverflow.com/q/26064985
type: AcceptedAnswer
score: 0

c#-4.0
tags question: http://stackoverflow.com/q/26063730
tag name: c#-4.0
type: Tag

http://stackoverflow.com/comment/40955589
has text: there's no point in re-implementing sorting in Java, built-in sort will be faster and less error-prone
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26129861
score: 0

http://stackoverflow.com/comment/41029052
comment on: http://stackoverflow.com/q/26166279
type: Comment
type: QuestionComment
has text: Take a look [here](http://stackoverflow.com/questions/3588120/given-a-java-ssh-rsa-publickey-how-can-i-build-an-ssh2-public-key)
score: 1

http://stackoverflow.com/q/26063267
has answer: http://stackoverflow.com/a/26063338
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26063304
possible better answer: http://stackoverflow.com/a/26063338
has comment: http://stackoverflow.com/comment/40833600
score: 0
has answer: http://stackoverflow.com/a/26063304
tagged with: cmd
type: AnsweredQuestion
has body: My folder c:\users\owner\desktop\test contains two files : opencsv-2.3.jar and Test.jar Here is the code for Test.jar import java.io.FileReader; import java.io.IOException; import au.com.bytecode.opencsv.CSVReader; public class Test { public static void main(String[] args) throws IOException { CSVReader reader = new CSVReader( new FileReader("C:\\Users\\owner\\Desktop\\test.csv")); String[] newLine; while ((newLine = reader.readNext()) != null) { System.out.println(newLine[0]); } } } I tried running this from cmd as following cd c:\users\owner\desktop\test\ javac -cp "c:\users\owner\desktop\test\opencsv-2.3.jar;" Test.java It compiles okay and and Test.class is created . But when I try to run it , it throws an error NoClassDefFoundError java Test I looked up similar questions online, but it seems that most of them had an issue because they did not specify the package name when running it from cmd. I do NOT have any package (default) . Why am I getting this error ?
tagged with: java
has title: NoClassDefFoundError when compiling javac from cmd?

http://stackoverflow.com/comment/40946862
type: Comment
has text: tbh there is no right way to say it but , its just that Date package was messed up before Calendar , point taken tho ;)
comment on: http://stackoverflow.com/a/26122154
score: 0
type: AnswerComment

http://stackoverflow.com/a/26152012
has body: Way to do it is: 1: Place ListView in main.xml 2: In your Activity Make object of ListView like so -> private ListView listView; in onCreate connect it to the main.xml like this, listView = (ListView) R.id.listView1; // whatever it is called 3: next create an ArrayList:-> private ArrayList arrayWeather = new ArrayList(); 4: fill the arraylist with weather data then finally create object of class you created and make it use your arraylist to display data. Example: public class ListUser extends BaseAdapter{ @Override public int getCount() { // TODO Auto-generated method stub return arraylistData.size(); // the arraylist u created } @Override public Object getItem(int position) { // TODO Auto-generated method stub return arraylistData.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return arraylistData.size(); } @Override public View getView(final int position, View v, ViewGroup parent) { if(v == null){ LayoutInflater lf = (LayoutInflater) BuyPets.this.getSystemService( Context.LAYOUT_INFLATER_SERVICE); v = lf.inflate(R.layout.forecast, null); } // setup here, done return v; } }
answers question: http://stackoverflow.com/q/26151463
score: 0
type: Answer

http://stackoverflow.com/comment/41051136
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26181484
type: Comment
has text: @Aditzu If your adding another parameter to identify the format, that is the equivalent to providing the format string, in which case you're just re-implementing Java's [SimpleDateFormat](http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html)

http://stackoverflow.com/comment/40895785
has text: "when I firstly submit form with no values, I see errors, which is ok, but when after this validation I resubmit my form(this time with values) again I see my errors". What happens when you try to submit a correct form since the beginning ?
score: 0
comment on: http://stackoverflow.com/q/26059455
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26166639
linked to: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/26166672
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26166672
favorite count: 0
tagged with: swing
has body: I do apologize in advance for creating this question, I do .NET so I know "how it feel" to ask this question, but I did search and tried to debug my program in Eclipse and still could not figure-out how to fix it, since I am totally new to Java GUI and first time using Eclipse, so ... I have small program Java swing GUI program, where you have 2 buttons, one of them is hidden (visible set to false) when click on a button, it will shows the hidden button (set Visible to true): 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.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class TestButton extends JPanel { private JFrame mainFrame; private JButton btnShow ; private JButton btnNew; public TestButton() { mainFrame = new JFrame("Test Button"); JButton btnShow = new JButton("Show New Button"); JButton btnNew = new JButton("This is New Button"); Container c = mainFrame.getContentPane(); c.setLayout(new FlowLayout()); c.add(btnShow); c.add(btnNew); btnNew.setVisible(false); btnShow.setMnemonic('G'); btnNew.setMnemonic('N'); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); ShowButtonHandler ghandler = new ShowButtonHandler(); btnShow.addActionListener(ghandler); mainFrame.setSize(250, 150); mainFrame.setLocationRelativeTo(null); mainFrame.setResizable(false); mainFrame.setVisible(true); } class ShowButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { btnNew.setVisible(true); } } public static void main(String args[]) { TestButton app = new TestButton(); } } But when I click that button, it shows Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException The error was at this line: btnNew.setVisible(true); Here is the full trace: Exception in thread "AWT-EventQueue-0" java.lang.…
type: AnsweredQuestion
has title: java.lang.NullPointerException on ActionListener | Java swing
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: actionlistener

computational-geometry
tags question: http://stackoverflow.com/q/26191778
type: Tag
tag name: computational-geometry

http://stackoverflow.com/q/26064766
tagged with: jsp
has answer: http://stackoverflow.com/a/26064919
accepted answer: http://stackoverflow.com/a/26064919
favorite count: 0
possible better answer: http://stackoverflow.com/a/26064879
has body: Have the following which reads a date from my SQL and returns the day of the week as a number. Calendar c = Calendar.getInstance(); c.setTime(rs.getDate("ShipmentDate")); int DayOfWeek = c.get(Calendar.DAY_OF_WEEK); This works fine. How can I convert the result (0, 1, 2, 3, 4, 5, 6) into (Sun, Mon, Tue, Wed, Thu, Fri, Sat)? The example I pinched the above code from mentioned using an array, although gave no example.
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40836596
type: Question
has answer: http://stackoverflow.com/a/26064879
has comment: http://stackoverflow.com/comment/40836451
score: -2
has title: Date int to string (0 --> Sun, 1 --> Mon, etc)
downvote count: 2
answer count: 2

http://stackoverflow.com/comment/139422116
score: 0
type: Comment
has text: Is there anything equivalent to `MvcUriComponentBuilder.fromMethodCall(MvcUriComponentBuilder.on(this.getClass()).findById(res.getId()))`?
comment on: http://stackoverflow.com/a/26094619
type: AnswerComment

http://stackoverflow.com/comment/40924928
score: 1
comment on: http://stackoverflow.com/a/26113458
type: AnswerComment
type: Comment
has text: This assumes that the OP signs the APK released on Google Play with a different key than he signs the APK released through other means. This seems highly unlikely.

http://stackoverflow.com/a/26142950
has comment: http://stackoverflow.com/comment/40978858
has comment: http://stackoverflow.com/comment/40978742
has comment: http://stackoverflow.com/comment/40979099
score: 0
answers question: http://stackoverflow.com/q/26142819
type: Answer
has body: Your logic here, if(line.isEmpty()) fileScan.nextLine(); is incorrect (for one thing, it doesn't update line so you then output blank lines). The easiest solution is probably to use, if(line.isEmpty()) continue;
has comment: http://stackoverflow.com/comment/40978747
has comment: http://stackoverflow.com/comment/40978696

http://stackoverflow.com/q/26113474
accepted answer: http://stackoverflow.com/a/26113525
score: 0
answer count: 1
has body: I understand that Superclass object = new subclass(); works and makes sense, but does Subclass object = new superclass(); work too. I'm guessing it wouldn't since you cannot be sure that the superclass "shares the same properties" as the subclass or am I just completely off? Thanks for the help!
has comment: http://stackoverflow.com/comment/40925005
has comment: http://stackoverflow.com/comment/40924946
tagged with: superclass
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26113525
has comment: http://stackoverflow.com/comment/40925016
has title: Superclass and Subclasses Interchange?
tagged with: java
type: Question
tagged with: inheritance

http://stackoverflow.com/q/26152419
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41030549
score: 1
tagged with: android-activity
tagged with: parsing
favorite count: 0
has body: Ok the app populates the list view from a Url(json). But I want to change the app so that the list view is populated by user input. How do I go about this. Here is my main activity so far: package ionictech.com.onspot; import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import com.android.volley.Cache; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.Cache.Entry; import com.android.volley.Request.Method; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import ionictech.com.onspot.adapter.FeedListAdapter; import ionictech.com.onspot.app.AppController; import ionictech.com.onspot.data.FeedItem; public class OnSpotActivity extends ActionBarActivity { private DrawerLayout drawerLayout; private String[] Menu; private static final String TAG = OnSpotActivity.class.getSimpleName(); private ListView listView; private FeedListAdapter listAdapter; private List&lt;FeedItem&gt; feedItems; private String URL_FEED = "http://api.androidhive.info/feed/feed.json"; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_on_spot); listView = (ListView) findViewById(R.id.list); feedItems = new ArrayList&lt;FeedItem&gt; (); listAdapter = new FeedListAdapter(this, feedItems); listView.setAdapter(listAdapter); // These two lines not needed, // just to …
type: UnansweredQuestion
tagged with: android
has title: read string from edit text, using parse?

http://stackoverflow.com/q/26070355
score: -2
has answer: http://stackoverflow.com/a/26070380
linked to: http://stackoverflow.com/q/3093365
tagged with: android
has body: im creating a GPS app , im trying to check if the devce that runs the app runs on version 4.2.2 or lower . if so the app can turn on / off the GPS service by it self with the command Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); intent.putExtra("enabled", true); sendBroadcast(intent); now if the device runs a version higher then 4.2.2 , the user will get a pupout message that link him for the manual turn on of GPS. thanks.
answer count: 1
duplicate of: http://stackoverflow.com/q/3093365
favorite count: 0
accepted answer: http://stackoverflow.com/a/26070380
downvote count: 2
type: AnsweredQuestion
tagged with: gps
has comment: http://stackoverflow.com/comment/40846815
tagged with: java
has title: How can i check if the Android Device That Runs My App Run On version 4.2.2 and lower
type: Question
upvote count: 0

http://stackoverflow.com/comment/40936066
has text: as a sorry i am up voting ur answer
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26116889
type: AnswerComment

http://stackoverflow.com/q/26042877
score: -4
has comment: http://stackoverflow.com/comment/40796060
type: Question
has title: Array out of bound in Java
has answer: http://stackoverflow.com/a/26043009
has body: I am trying to count the number of each character from a to z in a random array of chars of size 100. import java.util.Random; public class RandomChars { public static void main(String[] args) { Random r = new Random(); String chars= "abcdefghijklmnopqrtuvwxyz"; String[] countc = new String[26]; char[] charArray = new char[100]; for(int i = 1;i&lt;=100;i++) { charArray[i-1]=chars.charAt(r.nextInt(chars.length())); System.out.print(chars.charAt(r.nextInt(chars.length()))); if(i%20==0) { System.out.println(""); } } //System.out.println(charArray.length); int m = 0; int p=0; for(int n = 0;n&lt;100;n++) { char xx = chars.charAt(n); m = 0; p=0; do { if(charArray[m]==xx) { p=p+1; } m=m+1; }while(m&lt;=charArray.length); countc[n]=""+p+""+xx; } System.out.println("The count of each character is "+ countc); } }
downvote count: 4
upvote count: 0
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/26043045
has comment: http://stackoverflow.com/comment/40796143
answer count: 5
has comment: http://stackoverflow.com/comment/40796322
has answer: http://stackoverflow.com/a/26044332
has answer: http://stackoverflow.com/a/26044223
has answer: http://stackoverflow.com/a/26042984
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/26127305
accepted answer: http://stackoverflow.com/a/26127577
has answer: http://stackoverflow.com/a/26127906
favorite count: 0
has answer: http://stackoverflow.com/a/26129591
has comment: http://stackoverflow.com/comment/40951857
tagged with: resultset
has answer: http://stackoverflow.com/a/74047221
has comment: http://stackoverflow.com/comment/40950290
possible better answer: http://stackoverflow.com/a/26127906
tagged with: jdbc
has answer: http://stackoverflow.com/a/57279264
has answer: http://stackoverflow.com/a/55241507
has comment: http://stackoverflow.com/comment/40950196
downvote count: 3
has answer: http://stackoverflow.com/a/26128045
has body: Is "ResultSet" considered to be an ArrayList? I'm talking about jdbc. If no, then how do I put the information i get from my DB using the while (result.next()) { .... } syntax into an ArrayList called something like hotelResult? I hope it was understandable.
has answer: http://stackoverflow.com/a/26127577
type: AnsweredQuestion
has title: ResultSet how to put it into a ArrayList
tagged with: java
has comment: http://stackoverflow.com/comment/40950490
type: Question
has comment: http://stackoverflow.com/comment/40950224
score: 9
upvote count: 12
answer count: 7

http://stackoverflow.com/a/26035938
accepted answer of: http://stackoverflow.com/q/26034683
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26034683
type: Answer
has body: Well, it seems like you can trick Eclipse into working.. Right click the eclipse.app file > Show package contents. Navigate to Contents > MacOS and open eclipse.ini. Comment out the line: -Dosgi.requiredJavaVersion=1.7 With a hash # and then launch Eclipse. I presume this will only work if 1.7 is actually installed and available. Update: After upgrading to Yosemite Eclipse no longer opened. So I uninstalled Java 7 and let it install Apple Java 6. It works fine.

http://stackoverflow.com/a/26081747
upvote count: 1
downvote count: 1
has body: Modify your findwords class a s following public class FindWords { Dictionary dict=null; public void (Dictionary dict){ this.dict = dict; } public void print(){ for(int i=0;i&lt;dict.getList.size();i++) { System.out.println(dict.getList.get(i)); } } after that just before fininshing your try block add the following lines FindWords f = new FindWords(dict); f.print();
type: Answer
answers question: http://stackoverflow.com/q/26081622
score: 0

http://stackoverflow.com/q/26128995
has answer: http://stackoverflow.com/a/26129377
has comment: http://stackoverflow.com/comment/40953681
has comment: http://stackoverflow.com/comment/40953656
linked to: http://stackoverflow.com/q/678822
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40953912
has body: I know the difference between a Collection&lt;?&gt;, Collection&lt;Object&gt; and Collection. The first takes any type only, the second must allow all Objects, and the third is unchecked. But for a single instance (non Collection), e.g. ScheduledFuture&lt;?&gt;, ScheduledFuture&lt;Object&gt; and ScheduledFuture, what is the difference? It seems that they all allow everything.
has comment: http://stackoverflow.com/comment/40953622
possible better answer: http://stackoverflow.com/a/26129377
tagged with: generics
linked to: http://stackoverflow.com/q/2248390
has comment: http://stackoverflow.com/comment/40953566
has comment: http://stackoverflow.com/comment/40953650
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26129671
has title: Generics: What is the difference between ?, Object, and raw type of a single instance?
tagged with: java
accepted answer: http://stackoverflow.com/a/26129671
type: Question
has comment: http://stackoverflow.com/comment/40953730

http://stackoverflow.com/comment/41081891
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26192690
has text: What exactly is a new object reference to the variable. I only did java for 10 days...
type: AnswerComment

http://stackoverflow.com/a/26166675
has body: It's not clear where things may have gone awry, but the complete example below works on Ubuntu 12, Java 6; it may help you pin down the problem. Note that all top-level containers must be constructed on the event dispatch thread. import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; public class TestDialog extends JDialog { public static final String title = "Test Dialog"; public TestDialog(JFrame parent) { super(parent, title, true); add(new JPanel(){ @Override public Dimension getPreferredSize() { return new Dimension(320, 240); } }); pack(); setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new TestDialog(null).setVisible(true); } }); } }
has comment: http://stackoverflow.com/comment/41061133
has comment: http://stackoverflow.com/comment/52545306
has comment: http://stackoverflow.com/comment/41108979
upvote count: 3
answers question: http://stackoverflow.com/q/26162178
has comment: http://stackoverflow.com/comment/41052929
type: Answer
has comment: http://stackoverflow.com/comment/52522862
score: 3
downvote count: 0

http://stackoverflow.com/a/27122649
type: Answer
has body: In order to avoid hardcoding schema to your query, you can set hibernate.default_schema property in your persistence.xml as follows. &lt;property name="hibernate.default_schema" value="myscheme"/&gt; This could be also used in spring configuration file as is stated here.
score: 0
answers question: http://stackoverflow.com/q/26179976

http://stackoverflow.com/q/26129843
tagged with: netty
tagged with: java
tagged with: maven-assembly-plugin
type: Question
tagged with: gzip
has body: I'm having issues with GZIP annotation in Resteasy where it works fine when I'm running from main function (in Eclipse), but when I package it with Maven Assembly plugin and run it with an embedded Netty it doesn't work, the returned content is not GZIP-ed and there are no exceptions. I think that this might be from the assembly plugin, but if some libraries/classes were not loaded correctly, I would expect to see some exceptions. Any hints will be greatly appreciated.
score: 0
has answer: http://stackoverflow.com/a/26423611
has title: Resteasy GZIP being ignored when packaged as a jar
answer count: 1
tagged with: resteasy
type: UnansweredQuestion

http://stackoverflow.com/q/26162183
tagged with: data-structures
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41014516
tagged with: types
favorite count: 0
has answer: http://stackoverflow.com/a/77294937
possible better answer: http://stackoverflow.com/a/68188085
type: AnsweredQuestion
upvote count: 3
tagged with: java
has body: Is there a data structure in Java which can store different types in it? I mean like storing in an array different types (which actually does not work).
downvote count: 3
has comment: http://stackoverflow.com/comment/41017694
type: Question
has answer: http://stackoverflow.com/a/26162229
accepted answer: http://stackoverflow.com/a/26162229
has answer: http://stackoverflow.com/a/68188085
has title: Java multiple type data structure

http://stackoverflow.com/a/64363822
answers question: http://stackoverflow.com/q/26105061
has body: Spring boot has many starters, some starters have an embedded web server, some don't. The following have the embedded web server: spring-boot-starter-web spring-boot-starter-data-jpa spring-boot-starter-jetty spring-boot-starter-tomcat spring-boot-starter-jdbc spring-boot-starter-data-rest ... Pick the one that meets your requirements and that does not have server support. I only need to make restful json api request in my spring application, so the starter I need is spring-boot-starter-json which provide RestTemplate and jackson for me to use.
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/q/26145965
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/26146357
linked to: http://stackoverflow.com/q/10946565
has title: Synchronizing a group of threads
has comment: http://stackoverflow.com/comment/40984639
has comment: http://stackoverflow.com/comment/40984853
accepted answer: http://stackoverflow.com/a/26146357
score: 0
tagged with: mutex
answer count: 1
has body: I am writing a program in Java in where I have a HashMap&lt;String, Deque&lt;Integer&gt;&gt; info; My data is a list of Wikipedia pages that were visited with an hour time period, along with a count of how many times each was visited. de Florian_David_Fitz 18 de G%C3%BCnther_Jauch 1 de Gangs_of_New_York 2 de Georg_VI._(Vereinigtes_K%C3%B6nigreich) 7 de Gerry_Rafferty 2 This data gets stored in the HashMap from above with the page name as key and the Deque updated hourly with the number of visits that hour. I want to have one thread ThreadRead that reads input files and stores the info in the HashMap. And then one ThreadCompute thread for each key in the HashMap that consumes the associated Deque. ThreadRead needs to lock all ThreadComputes while active, then wake them up when finished so the ThreadComputes can work concurrently. If I need a different mutex for each ThreadCompute then how can I keep all of them locked while ThreadRead works? And how can I wake up all the ThreadComputes from ThreadRead when is done? I have used info as a lock for ThreadRead, and info.get(key) for each ThreadCompute But it is not working as I expected. Edit: I add some code to try to make more clear the problem. This is what I have at the moment: HashMap&lt;String, Deque&lt;Integer&gt;&gt; info; boolean controlCompute, control Read; private static class ThreadRead extends Thread { public void run() { while(controlRead) { try { read(); } catch (InterruptedException e) { e.printStackTrace(); } } } public void read() throws InterruptedException{ synchronized(info){ while(count==numThreads){ for (File file: files){ reader.parse(file, info); // Reads the file and store the data in the Hashmap keys=true; while(info.getSizeDeque()&gt;10){ count=0; info.wait(); info.notifyAll(); } } } controlRead=false; } } } private static class ThreadCompute extends Thread { public String key; public void run() { while(controlCompute) { try { compute(); } catch (InterruptedException e) { // TODO Auto-generat…
has comment: http://stackoverflow.com/comment/40984477

http://stackoverflow.com/comment/43570872
comment on: http://stackoverflow.com/a/26073336
type: AnswerComment
score: 0
type: Comment
has text: So you use groovy on grails or something else? @ali-amiri and umair-yasin ?

http://stackoverflow.com/q/26056808
tagged with: java
type: Question
tagged with: javascript
tagged with: eclipse
score: 0
has title: Eclipse doesn't start after plugin installation
answer count: 1
has comment: http://stackoverflow.com/comment/40871791
has body: I installed a plugin for JavaScript editor in Eclipse, and after a restart, it doesn't start anymore. This is the trace !ENTRY org.eclipse.equinox.p2.artifact.repository 4 0 2014-09-26 11:40:17.156 !MESSAGE Unexpected error loading extension: org.eclipse.equinox.p2.artifact.repository.simpleRepository !STACK 0 java.lang.NoClassDefFoundError: org.eclipse.equinox.internal.p2.repository.RepositoryTransport at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:72) at java.lang.J9VMInternals.initialize(J9VMInternals.java:134) at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryFactory.getLocalFile(SimpleArtifactRepositoryFactory.java:45) at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryFactory.load(SimpleArtifactRepositoryFactory.java:83) at org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager.factoryLoad(ArtifactRepositoryManager.java:68) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:768) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:668) at org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager.loadRepository(ArtifactRepositoryManager.java:99) at org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager.loadRepository(ArtifactRepositoryManager.java:95) at org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager.restoreSpecialRepositories(ArtifactRepositoryManager.java:122) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.restoreRepositories(AbstractRepositoryManager.java:1014) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.basicGetRepository(AbstractRepositoryManager.java:181) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRep…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32502598

http://stackoverflow.com/a/26105668
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26105518
has body: NullPointerException is inevitable in this case as java can not get any reference from a null object, which makes it obvious to throw a NullPointerException

http://stackoverflow.com/a/26065769
accepted answer of: http://stackoverflow.com/q/26065671
score: 0
type: AcceptedAnswer
has body: use write the servlet's URL pattern inside form action: or use This should work! Suggestion: Your code will show null the first time you run it but after submitting the form the value will be displayed! To avoid that you may modify your code as: String n1=request.getParameter("userid"); if(n1 != null) out.println(n1);
answers question: http://stackoverflow.com/q/26065671
type: Answer

http://stackoverflow.com/q/26070492
tagged with: arrays
answer count: 1
has title: How to use a scanner (BlueJ)
tagged with: bluej
has comment: http://stackoverflow.com/comment/40847140
score: 0
has comment: http://stackoverflow.com/comment/40847070
has comment: http://stackoverflow.com/comment/40847123
has body: I'm new to java and my task is to use a scanner to read in an array and an int in another method.This is what I have so far: public static void main(String[] args){ Scanner scanner = new Scanner(System.in); System.out.print("Enter n: "); int sz = scanner.nextInt(); System.out.println("Enter locations of stones: "); int[] array = new int[sz]; for (int i=0;i&lt;array.length;i++){ array[i] = scanner.nextInt(); } jump(array,sz); } The method I want to read from starts like this: public static void jump(int [] array, int amtStone){ int x =0, moveOK =1, jumpedLoc =0, jumpedCount =1; //x: counter, moveOK: when 1, it is ok to continue. Otherwise, the jump is impossible. //jumpedLoc: to keep track of the current location of the rabbit //jumpCount: to count the amount of jumps while (x&lt;amtStone) {if(array[x+1]-array[x]&lt;=50){ jumpedLoc = array[x+1]; jumpedCount++;} } if (moveOK ==1) System.out.println(jumpedCount); else System.out.println("-1"); } What I'm doing is to calculate the smallest number of jumps it takes for a rabbit to reach the other side of the river. The ints in the array represents distances of stones from the starting point as one side of the river, and another int represents the number of stones. The longest distance the rabbit can jump is 50. for the input and output: Enter n: 7(Input,number of stones in the river) 32 46 70 85 96 123 145(Input, distances between the stone and the starting point, the last number is the width of the river, i.e. the distance between the destination (the other side of the river)and the starting point) Output: 3(This is the smallest number of times a rabbit can jump) If it is not possible, the output is -1. When I run the main method, after I input the int and the array, there is no output and the program didn't continue. I'm not sure what to do next.
has comment: http://stackoverflow.com/comment/40847154
has comment: http://stackoverflow.com/comment/40847042
has answer: http://stackoverflow.com/a/26070596
tagged with: java.util.scanner
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/26184535
accepted answer of: http://stackoverflow.com/q/26184409
has comment: http://stackoverflow.com/comment/41056634
has comment: http://stackoverflow.com/comment/41056640
has comment: http://stackoverflow.com/comment/41056487
has comment: http://stackoverflow.com/comment/100593330
has comment: http://stackoverflow.com/comment/41056644
has comment: http://stackoverflow.com/comment/41056893
has comment: http://stackoverflow.com/comment/41056602
has comment: http://stackoverflow.com/comment/41056510
has comment: http://stackoverflow.com/comment/41056488
has comment: http://stackoverflow.com/comment/78735867
upvote count: 37
has body: The reason why System.in.read is not blocking the second time is that when the user presses ENTER the first time, two bytes will be stored corresponding to \r and \n. Instead use a Scanner instance: public void promptEnterKey(){ System.out.println("Press \"ENTER\" to continue..."); Scanner scanner = new Scanner(System.in); scanner.nextLine(); }
answers question: http://stackoverflow.com/q/26184409
score: 37
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41056694
downvote count: 0
has comment: http://stackoverflow.com/comment/41056441
type: Answer

http://stackoverflow.com/a/26089841
has body: You can use Date d = new Date(); from the java.util library which will get the time from the current date and you can use that to compare it with a time given the time is in the right format.
has comment: http://stackoverflow.com/comment/40882411
answers question: http://stackoverflow.com/q/26089785
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40882446

http://stackoverflow.com/a/26628518
score: 1
answers question: http://stackoverflow.com/q/26181815
upvote count: 1
has body: The first error is not a coding error but a parsing error - it is likely a typo in your context.xml file (the error message indicates line 5, column 21). Did you edit it as advised on pages 18-20 of the repast getting started guide? Without seeing your context.xml file, I can't say exactly what the error is in it - if you want to add the first 5 lines of it then we can probably diagnose. The second message (warning, not error) on the console window is common and is not associated with the first error. This answer might help if you want to get rid of it - however I have not experienced any problems with leaving it there.
type: Answer
downvote count: 0

http://stackoverflow.com/q/26170145
tagged with: loops
has answer: http://stackoverflow.com/a/26170207
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/26170194
linked to: http://stackoverflow.com/q/3802192
answer count: 2
downvote count: 2
has title: I need help writing a program that determines if a password is valid or not
has body: The program allows the user to enter a string representing a password and determines whether or not it is valid. The password must be 8 characters long, include one lower case letter, one upper case letter, a number, and a symbol (ex. !@#). The output should read: Entered Password: (whatever the user entered) Verdict: (either valid or invalid) Here is my code so far: import java.util.*; public class PasswordTest { public static void main(String[]args) { Scanner input = new Scanner (System.in); System.out.print("Enter a password: "); String Pass = input.next(); System.out.println("Entered Password: " + Pass); if (Pass.length() &lt; 8) { System.out.println ("Verdict: Invalid"); } if (Pass.length() &gt;= 8) { System.out.println ("Verdict: Valid"); { } } I'm not certain how to go about this. I'm assuming I'll need a loop statement to determine whether or not it contains a capital and lowercase letter as well as a number and symbol.
upvote count: 1
has comment: http://stackoverflow.com/comment/41036107
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26068141
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40843442
accepted answer of: http://stackoverflow.com/q/26067412
upvote count: 3
has comment: http://stackoverflow.com/comment/40843183
score: 3
answers question: http://stackoverflow.com/q/26067412
has comment: http://stackoverflow.com/comment/40842822
has comment: http://stackoverflow.com/comment/46228972
has body: The value attribute should be an object. OGNL uses quotes to delimit a string object, other quotes should be escaped. And use var attribute for variable name. &lt;s:set var="bodyText" value="'First Name \"myObject.name\"'"/&gt; &lt;s:property value="bodyText" /&gt;
has comment: http://stackoverflow.com/comment/40843106
type: AcceptedAnswer

http://stackoverflow.com/comment/41125683
type: Comment
comment on: http://stackoverflow.com/q/26145425
type: QuestionComment
has text: Finally checked on the versions. I'm using Java SE 8 [1.8.0_11], which is checked as the default in Eclipse. The SwingX version I'm using is, indeed, 1.6.4. @dic19
score: 0

http://stackoverflow.com/comment/40975939
has text: No : if no servlet catches the url, rd is null. Please show your web.xml file
comment on: http://stackoverflow.com/q/26136711
score: 0
type: QuestionComment
type: Comment

chronicle-map
tags question: http://stackoverflow.com/q/26147651
tag name: chronicle-map
type: Tag
tags question: http://stackoverflow.com/q/26181347

http://stackoverflow.com/a/26159053
has body: You can reverse the array in this way int[] arr=new int[]{1,4,5,2};// index of this array are 0,1,2,3 int[] reverseArr=new int[arr.length]; int j=0; for(int i=arr.length-1;i&gt;=0;i--){ // considering arr from reverse order reverseArr[j]=arr[i]; j++; } Issue in your code for( int i = len ; i &gt;= 0 ; i--) // there is no index in array for i = len Your for loop should be corrected as for( int i = len-1 ; i &gt;= 0 ; i--)
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26159011
downvote count: 0

http://stackoverflow.com/comment/41067673
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26189422
has text: Your example works fine in WebSphere Liberty. For this you DON'T need any doGet() method, you are only using post here. Whoever is saying that is not correct. You may have some problem in your container. What url are you using to display html page and what container are you using?
score: 0

http://stackoverflow.com/q/26046138
tagged with: weblogic
tagged with: jndi
answer count: 1
accepted answer: http://stackoverflow.com/a/26063235
score: 0
tagged with: web-applications
has title: connecting to weblogic server via webapp and pulling the servers attributes
type: AnsweredQuestion
has body: I am working on a java web app that will pull some information(cpu usage, java heap size, etc) from a weblogic server and display it on a webpage. right now the server im connecting to is local but i will expand on that later. my problem is the way that im connecting seems to access the configuration side of the server and i cant get the data that i want. i am very new with java and weblogic. here is my code(you will see some redundancy, i was testing different techniques out.) package Servlets; import java.io.IOException; import java.util.Hashtable; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.naming.Context; import weblogic.jndi.*; import weblogic.management.configuration.ServerMBean; /** * Servlet implementation class getStatus */ public class getStatus extends HttpServlet { private static final long serialVersionUID = 1L; ServerMBean beanOne = null; String beanTwo = null; Context ctx = null; InitialContext ictx = null; /** * @see HttpServlet#HttpServlet() */ public getStatus() { super(); // TODO Auto-generated constructor stub } /** * @see Servlet#init(ServletConfig) */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void init(ServletConfig config) throws ServletException { Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); ht.put(Context.SECURITY_PRINCIPAL, "weblogic"); ht.put(Context.SECURITY_CREDENTIALS, "welcome1"); try { ctx = new InitialContext(ht); try { beanOne = (ServerMBean) ctx.lookup("ServerMBean"); beanOne.getName(); }catch (NameNotFoundException e) { // binding does not exist System.out.println("bean not found :("); }catch (NamingException e) { …
has answer: http://stackoverflow.com/a/26063235
tagged with: java
type: Question

http://stackoverflow.com/q/26055137
answer count: 1
has answer: http://stackoverflow.com/a/26055162
has body: Hi I need to call a method "loop()" 500 times. Do I need to write "loop();" 500 times or is there any method to call it multiple times. Please help with this. The following code is in java and I am doing this with selenium webdriver. public class Salesforce_login { public static WebDriver driver; public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:/Users/Master/Desktop/chromedriver.exe"); driver = new ChromeDriver(); // driver = new FirefoxDriver(); Thread.sleep(1000); // driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://login.com"); driver.findElement( By.xpath(".//*[@id='loginSwitcher:loginSwitcherForm']/div[1]/div[1]/div/a")) .click(); Thread.sleep(1000); driver.findElement(By.xpath(".//*[@id='username']")).sendKeys( "*****"); driver.findElement(By.xpath(".//*[@id='password']")).sendKeys( "*****"); driver.findElement(By.xpath(".//*[@id='Login']")).click(); Thread.sleep(30000); driver.findElement(By.xpath(".//*[@id='moreGroupMembersLink']")) .click(); Thread.sleep(1000); loop(); loop(); loop(); loop(); } public static void loop() throws InterruptedException{ for (int i = 1; i &lt; 25; i++) { System.out.println(driver .findElement( By.xpath(".//*[@id='groupMembersDialogContent']/div/div[1]/div[2]/div/table/tbody/tr["+i+"]/td[2]/div/a")) .getAttribute("href")); } driver.findElement(By.xpath(".//*[@id='groupMembersDialogContent']/div/div[1]/div[3]/div/span[2]/span[1]/a")).click(); Thread.sleep(2000); } }
downvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40818281
upvote count: 0
has comment: http://stackoverflow.com/comment/40818319
type: UnansweredQuestion
score: -4
has title: Call a same method 500 times in java
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/40818343
type: Question

http://stackoverflow.com/comment/40934450
comment on: http://stackoverflow.com/q/26118217
has text: possible duplicate of [Maven compiler plugin always detecting a set of sources as "stale"](http://stackoverflow.com/questions/17944108/maven-compiler-plugin-always-detecting-a-set-of-sources-as-stale)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26119173
has title: java how to get filename from binary data?
linked to: http://stackoverflow.com/q/9884908
has body: I'am reading a file through sockets, Is there a way that I can extract a file name, extension? byte[] fileBytes; // filled byte[] array, how to extract info about file?
favorite count: 0
has answer: http://stackoverflow.com/a/26119231
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40934677
tagged with: java
linked to: http://stackoverflow.com/q/19912267
type: Question
duplicate of: http://stackoverflow.com/q/19912267
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26154149
score: 4
has answer: http://stackoverflow.com/a/26154202
favorite count: 0
tagged with: static
tagged with: abstract
tagged with: interface
answer count: 4
has answer: http://stackoverflow.com/a/26861326
has comment: http://stackoverflow.com/comment/41000252
has body: I have an interface called Relation, implemented by a class BasicRelation, and extended by subclasses (e.g. ParentChild, Sibling, Spouse). While developing my code, I realized that I often need a method which takes a String representation of a relation to create it. For example: public class ParentChild implements Relation extends BasicRelation { // e.g. "Jack is Emily's father. Jill is her mother." will return the list // &lt;ParentChild(Jack, Emily), ParentChild(Jill, Emily)&gt; static List&lt;ParentChild&gt; fromSentence(String s) { ... } } Now, since I find myself needing this method (fromSentence(String)) in every class, except perhaps in BasicRelation, I would like to move it up the hierarchy. The problem is that the internal details of the method is subclass-dependent, so I can't have it as a static method in the interface Relation or the superclass BasicRelation. Unfortunately, in Java, it is also not possible to have a static abstract method. Is there any way to ensure that every subclass of BasicRelation (or every class implementing Relation) implements fromSentence(String)? If no, should I be designing this in a completely different way? I guess this last question is more of a request for design-advice than a question.
has comment: http://stackoverflow.com/comment/41001409
has comment: http://stackoverflow.com/comment/40999708
has comment: http://stackoverflow.com/comment/40999882
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26154270
has comment: http://stackoverflow.com/comment/41001477
type: Question
has answer: http://stackoverflow.com/a/26154274
has title: How to design a common static method in all classes implementing an interface
has comment: http://stackoverflow.com/comment/40999699
tagged with: java
has comment: http://stackoverflow.com/comment/41000215
upvote count: 4
has comment: http://stackoverflow.com/comment/40999689
downvote count: 0
tagged with: inheritance

http://stackoverflow.com/comment/40950242
score: 0
type: Comment
type: QuestionComment
has text: This class of problem is usually solved using the "Observer" design pattern, which is straightforward to implement in Java and most other OO languages.
comment on: http://stackoverflow.com/q/26124997

http://stackoverflow.com/comment/40870122
score: 1
comment on: http://stackoverflow.com/q/26083167
type: Comment
type: QuestionComment
has text: You can always look at the source code. But I would assume that it's using `getGeneratedkeys()` because `SELECT LAST_INSERT_ID()` is MySQL specific and SpringJDBC has not DBMS abstraction layer other than JDBC.

http://stackoverflow.com/q/26184285
type: Question
tagged with: jakarta-ee
has body: I'm creating a basic server that accepts the HTTP protocol directly from the browser. What I want to do is use the DoGet Method to be able to respond to the GET Request with an html page. Ordinarily, you would accomplish the same result with servlets, but for the exercise I am using interfaces MyHttpRequest, MyHttpResponse, MyHttpHandler to perform the same functions as a servlet. This is what I have so far: public class Server implements MyHttpRequest, MyHttpResponse, MyHttpHandler { private static final String CONTENT_TYPE = "text/html; charset=windows-1252"; public static void main(String[] args) throws IOException { Server server = new Server(); ServerSocket serversocket = new ServerSocket(8080);//localhost Socket socket = serversocket.accept(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); String line = bufferedReader.readLine(); System.out.println(line); if(line.equals("GET / HTTP/1.1")) { System.out.println("Request works. Responding now..."); //PROBLEM CODE //--------------------------------------------// doGet(problem_parameter1, problem_parameter2,); //-----------------------------------------------------------// } OutputStream out = socket.getOutputStream(); PrintWriter pw = new PrintWriter(out, true); //finally { out.flush(); out.close(); socket.close(); serversocket.close(); //} } My DoGet Method: @Override public void doGet(MyHttpRequest request, MyHttpResponse response) { //response response.getContentType(); PrintWriter pw = response.getWriter(); pw.println(" "); pw.println(" Welcome to our Site! "); pw.println(" We hope you enjoy your stay. "); pw.println(" "); pw.close(); } My problem is that I am confused as to what I am supposed to use for parameters of the doGet Method in Main. The point of the exercise is to be able to use the doGet Method to send the HTML to the Localhost:8080 -- but i don't know how this is possible without using JSP or Servlets. Is there something I am missing here? I've …
tagged with: servlets
tagged with: get
upvote count: 2
has answer: http://stackoverflow.com/a/26195486
answer count: 1
accepted answer: http://stackoverflow.com/a/26195486
favorite count: 0
tagged with: httpresponse
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Server Response to Browser: calling the doGet Method Java

http://stackoverflow.com/comment/40919516
comment on: http://stackoverflow.com/q/26110327
score: 1
has text: You should just be able to refer to them by name, and when the code is compiled it will run the annotation processor first and then let you refer to the newly generated classes.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40925741
type: AnswerComment
comment on: http://stackoverflow.com/a/26112951
score: 0
type: Comment
has text: May I know how can I send requests using Javascript library. Any online examples would be helpful.

http://stackoverflow.com/q/26034298
has answer: http://stackoverflow.com/a/26034410
has comment: http://stackoverflow.com/comment/40782363
has comment: http://stackoverflow.com/comment/40780483
tagged with: swing
type: Question
tagged with: java
tagged with: jpanel
has title: Add jdatepicker in jpanel
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40782516
has comment: http://stackoverflow.com/comment/40826555
has comment: http://stackoverflow.com/comment/40788339
has comment: http://stackoverflow.com/comment/40780720
has comment: http://stackoverflow.com/comment/40813077
tagged with: datepicker
has body: I am trying to add jdatepicker in jpanel, this jpanel is called inside jframe, the problem is that if I try to add jdatepicker directly into jpanel it is not displayed, until some event is performed. I have tried this solution, but this was of no help. When I use this it also open one more window with no data. and other method I am using is - Class MainApp which is using frame public class MainApp extends JFrame implements ActionListener { private JPanel panel; private JMenuBar m_menuBar; private JMenu m_menuSales; private JMenuItem m_itmSalesNewBuisness; private JMenuItem m_itmSalesAppointments; private static MainApp instance = null; public static MainApp getInstance() { if(instance == null) { instance = new MainApp(); } return instance; } private MainApp() { initComponents(); } private void initComponents() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_menuBar = new JMenuBar(); m_menuSales = new JMenu("Sales"); m_itmSalesAppointments = new JMenuItem("Appointments"); m_itmSalesAppointments.addActionListener(this); m_itmSalesNewBuisness = new JMenuItem("New Business"); m_itmSalesNewBuisness.addActionListener(this); m_menuBar.add(m_menuSales); setJMenuBar(m_menuBar); setSize(1300, 700); setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } UIManager.put("swing.boldMetal", Boolean.FALSE); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new MainApp(); } }); } @Override public void actionPerformed(ActionEvent e) { if(m_itmSalesNewBuisness == e.getSource()){ if(panel != null) { remove(panel); invalidate(); } revalidate(); repaint(); panel = new CopyOfNewBusiness(); panel.setBounds(0, 0, getWidth(), getHeigh…
has comment: http://stackoverflow.com/comment/40782343
has comment: http://stackoverflow.com/comment/40780384
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40780444

http://stackoverflow.com/q/26123706
has comment: http://stackoverflow.com/comment/40945764
has comment: http://stackoverflow.com/comment/40945923
has answer: http://stackoverflow.com/a/26124209
has comment: http://stackoverflow.com/comment/40944344
has comment: http://stackoverflow.com/comment/40943504
favorite count: 0
has comment: http://stackoverflow.com/comment/40948247
has comment: http://stackoverflow.com/comment/40946879
tagged with: linux
has comment: http://stackoverflow.com/comment/40945045
has title: Running "who -m" command from Java yields empty result
linked to: http://stackoverflow.com/q/473446
score: 2
has comment: http://stackoverflow.com/comment/40945972
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26125433
type: Question
has comment: http://stackoverflow.com/comment/40945855
has comment: http://stackoverflow.com/comment/40945078
has comment: http://stackoverflow.com/comment/40948330
tagged with: java
has body: I am trying to find the current logged in username from Java. Process p; try { p = Runtime.getRuntime().exec("who -m"); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) System.out.println(line); } catch (Exception e) { } The above code does not print any result. However if i remove -m option, it prints user name and other details. And also i tested with other options like -s, -u. It all works except -m. Does anyone has an idea why is it so? Note: I am aware of System.getProperty("user.name"); But that's not a solution in my case. I am calling a shell script in which "who -m" is used. So, I cannot use java classes.
tagged with: command-line-interface
linked to: http://stackoverflow.com/q/26168998
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40945362

http://stackoverflow.com/q/26126337
tagged with: java
has body: getting error on terminal when i run comand /usr/local/hadoop/bin/hadoop jar climat.jar MaxTemperature sample.txt /out &gt; Exception in thread "main" java.lang.Error: Unresolved compilation &gt; problems: Job cannot be resolved to a type Job cannot be resolved &gt; to a type FileInputFormat cannot be resolved Path cannot be resolved &gt; to a type FileOutputFormat cannot be resolved Path cannot be &gt; resolved to a type Text cannot be resolved to a type IntWritable &gt; cannot be resolved to a type &gt; &gt; at MaxTemperature.main(MaxTemperature.java:15) at &gt; sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at &gt; sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) &gt; at &gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) &gt; at java.lang.reflect.Method.invoke(Method.java:606) at &gt; org.apache.hadoop.util.RunJar.main(RunJar.java:212)
type: Question
tagged with: hadoop
tagged with: ubuntu-14.04
score: -1
has answer: http://stackoverflow.com/a/26135723
has title: hadoop MaxTemperature example is not working on VMware with ubuntu 14.04
downvote count: 1
answer count: 1
favorite count: 0
tagged with: linux
type: UnansweredQuestion
upvote count: 0

http://stackoverflow.com/comment/40995665
score: 0
comment on: http://stackoverflow.com/a/26151663
type: Comment
has text: @OldCurmudgeon: Could you please explain this a bit more? I was looking at the source code of `EnumSet`, and I intuitively feel that `Set<E extends Enum<E>>` should be something I do, but while trying to implement it, I got super-confused and gave up. Pointer to good tutorial/examples will also be appreciated. Googling wasn't much of a help here.
type: AnswerComment

http://stackoverflow.com/comment/41035416
type: Comment
has text: Finally got it working. Appreciate all the help my man. And no worries lol many Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26172980

http://stackoverflow.com/q/26164353
tagged with: servlets
type: Question
downvote count: 0
has title: How to get beans defined in main-servlet.xml from controller
has comment: http://stackoverflow.com/comment/41019980
has answer: http://stackoverflow.com/a/26164609
answer count: 1
favorite count: 0
upvote count: 1
tagged with: spring
has body: I understand beans in my main-servlet.xml is in child context. And based on research I know I can get root ApplicationContext within my GreetingController through WebApplicationContextUtils. Which I'll get null because i didn't define such a root context in web.xml. Now my question is how can i get child context and do something like childContext.getBean("forfun") without @AutoWired annotation,I think I've tested it and it works; Thanks in advance for your reading and info. Edit: AutoWire the ApplicationContext or implement ApplicationContextAware will help you get both the child and root ApplicationContext. Edit2:I found another way to get the context created by defaultdispacher, the context is actually stored in servletcontext attributes with name org.springframework.web.servlet.FrameworkServlet.CONTEXT.(servletName) supposed your default servlet is main, you can get the context craete by defaultdispacher[main-servlet.xml] with the following code. ApplicationContext context1=(WebApplicationContext) request.getSession().getServletContext().getAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.main") But still don't understand why in the WebApplicationContextUtils method we can't access child context. web.xml file <webapp> main org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/main-servlet.xml 1 main /main/* </web-app> main-servlet.xml GreetingController.java @Controller public class GreetingController { @AutoWired Foo forfun;//this works even if forfun is defined in main-servlet.xml @RequestMapping("/testing") public String testing(HttpServletRequest request){ ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); Foo f=(Foo) context.getBean("forfun");//supposed to work if i have it defined in root context /* I would something like this ChildContext child = Utils.getChildContext(request); Foo f=(Foo) child.getBean("forfun"); */ return "test"; } }
accepted answer: http://stackoverflow.com/a/26164609
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41018826
tagged with: model-view-controller
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40855722
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26075439
score: 0
has text: @OliverCharlesworth OK. Would you mind giving me a link to the database?

http://stackoverflow.com/comment/40999918
has text: " 7,8 forms smaller rectangular area. " 7,8 or 7,9??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26151215
score: 0

http://stackoverflow.com/comment/41025732
has text: I have the next <js:forward page='/c/page'/> /c is obtained with themeDisplay.getPathMain() method from liferay
comment on: http://stackoverflow.com/a/26168025
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41013512
type: QuestionComment
comment on: http://stackoverflow.com/q/26161046
has text: That's a good point; try to simply add *two* `System.gc()` calls, see what happens.
score: 0
type: Comment

http://stackoverflow.com/q/26094396
has comment: http://stackoverflow.com/comment/40890977
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40891465
type: Question
has comment: http://stackoverflow.com/comment/40893495
has title: jsp request getParameter return null
score: 0
tagged with: jstl
tagged with: jsp
has body: I have problem with this example: &lt;c:set value="${dataRap}" scope="request" var="dataDos"/&gt; &lt;% String dataDo = (String)request.getParameter("dataDos"); request.setAttribute("dataDo",dataDo); out.print(dataDo); %&gt; My questions: Why I have null? ${dataRap} have value. How use dataDostaw in jsp? ${dataDosaw}
has comment: http://stackoverflow.com/comment/40895242

http://stackoverflow.com/q/26189274
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
accepted answer: http://stackoverflow.com/a/26189556
type: Question
has body: I have a JSON fuction working in a different activity working correctly with the same format but when I run it here I get errors. I have nailed down to the actual JSON call which is throwing the exception but have no idea why. see 'JSONObject json = jsonParser.makeHttpRequest( url_challenge_details, "GET", params);' Please help! If you need more code or logs also just let me know. Thank you /** * Background Async Task to Get complete Challenge details * */ class GetChallengeDetails extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(EditChallengeActivity.this); pDialog.setMessage("Loading Challenge details. Please wait..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } /** * Getting Challenge details in background thread * */ protected String doInBackground(String... params) { // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { // Check for success tag int success; try { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("pid", pid)); // getting Challenge details by making HTTP request // Note that Challenge details url will use GET request JSONObject json = jsonParser.makeHttpRequest( url_challenge_details, "GET", params); // check your log for json response Log.d("Single Challenge Details", json.toString()); // json success tag success = json.getInt(TAG_SUCCESS); if (success == 1) { // successfully received Challengedetails JSONArray challengeObj = json .getJSONArray(TAG_CHALLENGE); // JSON Array // get first Challenge object from JSON Array JSONObject challenge = challengeObj.getJSONObject(0); // Challenge with this pid found // Edit Text txtName = (EditText) findViewById(R.id.inputName); txtPrice = (EditText) findViewById(R.id.inputPrice); txtDesc = (EditText)…
score: 0
tagged with: exception
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41065789
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26189556

http://stackoverflow.com/q/26111958
score: 0
tagged with: vector
tagged with: arrays
has body: When I try to add a contact information through addContact method, it should prompt me to input name, phone number, and address. Then the information is stored on the class array. When addContact is triggered, it gives off: Contact[] contacts; public void addContact(Contact c) { String name = ""; long number = 0000000000; String comment = ""; if(isFull()); incrementCapacity(); size++; for (int i = 0; i &lt;= contacts.length; i++) { if(contacts[i] == null) { contacts[i].setName(name); contacts[i].setPhoneNumber(number); contacts[i].setComment(comment); } } } Instead it gives off the error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at VectorOfContacts.addContact(VectorOfContacts.java:71) at Driver2.main(Driver2.java:20) Line 71 is if(contacts[i] ==null). If I delete the if statement. It will happen with the rest of the three lines below it as well. What is the proper way to ensure that the inputs is placed into the class as an array?
has comment: http://stackoverflow.com/comment/40924312
has comment: http://stackoverflow.com/comment/40924770
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/26112429
has title: How do you input values and strings into class array through a method class?
has answer: http://stackoverflow.com/a/26111969
type: Question
has comment: http://stackoverflow.com/comment/40924750
has comment: http://stackoverflow.com/comment/40924591
has comment: http://stackoverflow.com/comment/40924013
tagged with: java
has comment: http://stackoverflow.com/comment/40925000
has answer: http://stackoverflow.com/a/26111978
tagged with: class
has answer: http://stackoverflow.com/a/26112773

http://stackoverflow.com/q/26192615
has body: Here's my code: import java.util.*; public class binary{ public static void main(String args[]) { //input thing Scanner read = new Scanner(System.in); //variables String result = ""; int input; //input input =read.nextInt(); toBinary(input,result); System.out.println("Your binary is" + result); } public static String toBinary(int a,String b){ StringBuilder sb = new StringBuilder(); int y; int z=2; while(a &gt;= 1){ y = a%2; a/=z; sb.append(y); } b = sb.toString(); invert(b); return b; } public static String invert(String s) { String temp = ""; for (int i = s.length() - 1; i &gt;= 0; i--) temp += s.charAt(i); return temp; } } Can you help me on whats wrong, cause the return is blank. When I type in a number it comes out as nothing execpt "Your binary is".
score: 0
has title: My Binary converter somehow dosen't work
tagged with: converters
answer count: 1
tagged with: binary
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26192690
linked to: http://stackoverflow.com/q/40480
accepted answer: http://stackoverflow.com/a/26192690
type: Question

http://stackoverflow.com/a/40169551
score: 0
answers question: http://stackoverflow.com/q/26035782
type: Answer
has body: I solved it differently. I edited the jrxml file in a text editor and removed language="bsh" from it.

http://stackoverflow.com/comment/41010697
comment on: http://stackoverflow.com/q/26159907
type: Comment
type: QuestionComment
has text: Why not simply wrap PART 3 into a method and call it inside `run()`?
score: 2

http://stackoverflow.com/comment/41015336
type: AnswerComment
type: Comment
has text: Thanks, the Supplier approach looks good. My main discomfort was the nested streaming of data `data.stream()`. And it looks like you're right about not needing to map to a `Tuple` in my initial `mapToObj`. I'll look into the groupingBy method. Thanks :)
comment on: http://stackoverflow.com/a/26162138
score: 0

http://stackoverflow.com/q/26054836
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26055041
has body: I'm new to java oracle database coding and I'm getting this error when running the code below (eclipse kepler): import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class main { public static void main(String[] args) { try { Class.forName("oracle.jdbc.OracleDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); return; } Connection connection = null; try { connection = DriverManager.getConnection( "jdbc:oracle:thin:@10.0.32.166:1521:orcl", "username", "password"); } catch (SQLException e) { e.printStackTrace(); return; } } } Error is for ojdbc14.jar: java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:389) at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:454) at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:165) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:802) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at oracle.main.main(main.java:18) While I tried to change ojdbc6.jar but a different error shows up: java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja…
tagged with: eclipse
answer count: 1
tagged with: oracle-database
has title: ORA-12505, TNS:listener does not currently know of SID
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26072048
has comment: http://stackoverflow.com/comment/40849826
has body: I want to make a code which will take images from a Word file and then save them in to some folder. Is it possible in java? If yes then what will be APIs? If not possible then same case from pdf/html ? I need some help to start the code. While i have no idea how to deal with this type of stuff.
favorite count: 0
type: Question
has title: how to get images from word docx in java?
upvote count: 1
tagged with: web-scraping
tagged with: java
has comment: http://stackoverflow.com/comment/40849868
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40849814

http://stackoverflow.com/q/26109997
has title: Java Map with multiple keys
has answer: http://stackoverflow.com/a/27987383
tagged with: hashmap
downvote count: 0
has comment: http://stackoverflow.com/comment/40919051
has answer: http://stackoverflow.com/a/36639152
has comment: http://stackoverflow.com/comment/40919072
tagged with: dictionary
favorite count: 0
possible better answer: http://stackoverflow.com/a/26110183
has body: I need to create a map, with 3 columns: 2 keys, and 1 value. So each value will contain 2 keys of different classtypes, and can be fetched by using either one. But my problem is that HashMap/Map supports only 1 key, and 1 value. Is there a way to create something like Map&lt;Key1, Key2, Value&gt; instead of Map&lt;Key, Value&gt;? so Value can be fetched by either using its Key1 or Key2. I apologize if it is a duplicate or a bad question, but I couldn't find a similar one on Stack Overflow. P.S: I don't want to create 2 maps: Map&lt;Key1, Value&gt; and Map&lt;Key2, Value&gt; nor creating nested maps I am looking for a multikey table, just one like above.
answer count: 5
has answer: http://stackoverflow.com/a/26110504
has answer: http://stackoverflow.com/a/26110183
has answer: http://stackoverflow.com/a/26110279
upvote count: 1
linked to: http://stackoverflow.com/q/1968003
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26110279
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40919080
has comment: http://stackoverflow.com/comment/40918944
has comment: http://stackoverflow.com/comment/40919050
type: Question

http://stackoverflow.com/comment/41011241
comment on: http://stackoverflow.com/a/26157161
type: AnswerComment
score: 0
type: Comment
has text: " You should add a column PARENT_ID" - did You mean database? I've done this, but there goes only nulls. There is no relation

http://stackoverflow.com/comment/40950224
comment on: http://stackoverflow.com/q/26127305
score: 2
type: QuestionComment
has text: Just iterate on your ResultSet and add all elements to your ArrayList.
type: Comment

http://stackoverflow.com/comment/41015611
type: Comment
comment on: http://stackoverflow.com/q/26161596
type: QuestionComment
score: 0
has text: Are you sure your server is correctly configured? I don't think that its IP address should be the same as Google DNS servers: `ip: '8.8.8.8'`.

http://stackoverflow.com/comment/40821073
comment on: http://stackoverflow.com/q/26056696
type: Comment
type: QuestionComment
has text: Please add you code.. we cant tell you what is wrong on this information.
score: 1

http://stackoverflow.com/comment/40888903
type: QuestionComment
has text: Looks like JSON, so use a JSON parser.
comment on: http://stackoverflow.com/q/26093020
score: 0
type: Comment

http://stackoverflow.com/q/26174948
has answer: http://stackoverflow.com/a/26175191
type: Question
tagged with: for-loop
score: 0
possible better answer: http://stackoverflow.com/a/26199851
answer count: 2
tagged with: colors
has answer: http://stackoverflow.com/a/26199851
accepted answer: http://stackoverflow.com/a/26175191
has title: Java drawing panel?
has body: I have completed some of the code for a color wheel, but I'm confused on how to complete it? I've also commented the code to help understand. So far, it prints red, orange and yellow gradients. How do I complete this? import java.awt.*; public class ColorDrawing2 { public static final int CENTER = 256; public static final int RADIUS = 120; public static final int SHAPES = 32; public static final int SIZE = 40; public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(512,512); // create a drawing panel panel.setBackground(new Color(0,0,0)); // set background color (orange) Graphics g = panel.getGraphics(); // get graphics toolkit for (int i = 0; i &lt;= SHAPES; i++) { // System.out.println("i = " + i); double angle = (i)*(360/SHAPES)*(Math.PI/180); // angle // System.out.println("Angle = " + angle); double x = CENTER - (SIZE/2) + RADIUS*Math.cos(angle); // x-cooordinate double y = CENTER - (SIZE/2) + RADIUS*Math.sin(angle); // y-coordinate int red = (int) (199 + 56/SHAPES*i); // 199 &lt; red &lt; 255 // System.out.println("Red = " + red); int grn = (int) (7.97*i); // 0 &lt; grn &lt; 255 // System.out.println("Green = " + grn); int blu = 0; g.setColor(new Color((int) red, grn, blu)); g.fillOval((int)x, (int)y, SIZE, SIZE); panel.sleep(200); // pause 200 msec } } }
tagged with: drawing
type: AnsweredQuestion
tagged with: java
tagged with: color-wheel

recursion
type: Tag
tags question: http://stackoverflow.com/q/26090405
tags question: http://stackoverflow.com/q/26089597
tags question: http://stackoverflow.com/q/26052502
tags question: http://stackoverflow.com/q/26185787
tags question: http://stackoverflow.com/q/26148017
tags question: http://stackoverflow.com/q/26125033
tag name: recursion
tags question: http://stackoverflow.com/q/26109985
tags question: http://stackoverflow.com/q/26188809
tags question: http://stackoverflow.com/q/26120515
tags question: http://stackoverflow.com/q/26141239
tags question: http://stackoverflow.com/q/26079566
tags question: http://stackoverflow.com/q/26093228
tags question: http://stackoverflow.com/q/26127834
tags question: http://stackoverflow.com/q/26051331
tags question: http://stackoverflow.com/q/26173691
tags question: http://stackoverflow.com/q/26128097
tags question: http://stackoverflow.com/q/26076596
tags question: http://stackoverflow.com/q/26184075
tags question: http://stackoverflow.com/q/26058301
tags question: http://stackoverflow.com/q/26092404
tags question: http://stackoverflow.com/q/26090671
tags question: http://stackoverflow.com/q/26107036
tags question: http://stackoverflow.com/q/26044372
tags question: http://stackoverflow.com/q/26179574
tags question: http://stackoverflow.com/q/26189191
tags question: http://stackoverflow.com/q/26041546

http://stackoverflow.com/q/26161535
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26162055
has answer: http://stackoverflow.com/a/26162055
downvote count: 0
accepted answer: http://stackoverflow.com/a/28560324
has title: How to open menu from a button disabling menu key
answer count: 3
has comment: http://stackoverflow.com/comment/41013725
favorite count: 0
has body: PRINT SCREEN I'm willing to block to the user the possibility to open the menu using menu key. The menu must be opened only from the menu button in my application. So I deleted this part of code: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } Now if I press the key button it happens nothing and that's what I wanted. The problem is that if I press my menu button in app, the menu doesn't show up anymore... So what do? I thought to add the getMenuInflater().inflate(R.menu.main, menu); in my listener on the menu button but here is the error and I don't understand what to do... any advice? Thank you!
upvote count: 2
tagged with: android
tagged with: menu
has answer: http://stackoverflow.com/a/26161729
has answer: http://stackoverflow.com/a/28560324
score: 2
has comment: http://stackoverflow.com/comment/41013356

http://stackoverflow.com/comment/40895506
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26096808
score: 0
has text: @aioobe seems to be you are master in this particular question since past. :)

http://stackoverflow.com/comment/41060841
comment on: http://stackoverflow.com/a/26186702
type: Comment
has text: Yes, that's right (although obviously there's not much point unless you do something with it after you've created it!). You might want to have a `private` field of your `TestUnit` class that stores an instance of `Unit` (or you might not, depending on what you're doing).
type: AnswerComment
score: 0

http://stackoverflow.com/q/26104767
has comment: http://stackoverflow.com/comment/40909598
upvote count: 1
has comment: http://stackoverflow.com/comment/40909428
has body: This code has to enter 5 integers and then display them in ascending and descending orders without using arrays. But it gives me only the biggest number. How can i do it without arrays?? package assignment; import javax.swing.JOptionPane; public class q1 { public static void main(String[] args) { String a = JOptionPane.showInputDialog(null, "Please Enter a number", "Input", JOptionPane.QUESTION_MESSAGE); int number1 = Integer.parseInt(a); String b = JOptionPane.showInputDialog(null, "Please Enter a number", "Input", JOptionPane.QUESTION_MESSAGE); int number2 = Integer.parseInt(b); String c = JOptionPane.showInputDialog(null, "Please Enter a number", "Input", JOptionPane.QUESTION_MESSAGE); int number3 = Integer.parseInt(c); String d = JOptionPane.showInputDialog(null, "Please Enter a number", "Input", JOptionPane.QUESTION_MESSAGE); int number4 = Integer.parseInt(d); String e = JOptionPane.showInputDialog(null, "Please Enter a number", "Input", JOptionPane.QUESTION_MESSAGE); int number5 = Integer.parseInt(e); if (number1 &gt; number2 &amp;&amp; number1 &gt; number3 &amp;&amp; number1 &gt; number4 &amp;&amp; number1 &gt; number5) { System.out.print(number1 + ","); } else if (number2 &gt; number1 &amp;&amp; number2 &gt; number3 &amp;&amp; number2 &gt; number4 &amp;&amp; number2 &gt; number5) { System.out.print(number2 + ","); } else if (number3 &gt; number1 &amp;&amp; number3 &gt; number2 &amp;&amp; number3 &gt; number4 &amp;&amp; number3 &gt; number5) { System.out.print(number3 + ","); } else if (number4 &gt; number1 &amp;&amp; number4 &gt; number2 &amp;&amp; number4 &gt; number3 &amp;&amp; number4 &gt; number5) { System.out.print(number4 + ","); } else if (number5 &gt; number1 &amp;&amp; number5 &gt; number2 &amp;&amp; number5 &gt; number3 &amp;&amp; number5 &gt; number4) { System.out.print(number5 + ","); } } }
has comment: http://stackoverflow.com/comment/40909317
favorite count: 0
has comment: http://stackoverflow.com/comment/40909530
has answer: http://stackoverflow.com/a/26105105
has answer: http://stackoverflow.com/a/26105101
has comment: http://stackoverflow.com/comment/40909964
accepted answer: http://stackoverflow.com/a/26105101
downvote count: 2
has comment: http://stackoverflow.com/comment/40910036
has comment: http://stackoverflow.com/comment/40910263
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26105606
tagged with: java
has comment: http://stackoverflow.com/comment/40910486
has comment: http://stackoverflow.com/comment/40909539
type: Question
has comment: http://stackoverflow.com/comment/40909528
has comment: http://stackoverflow.com/comment/40909502
has title: ascending sort without using arrays in java
has comment: http://stackoverflow.com/comment/40909971
possible better answer: http://stackoverflow.com/a/26105105
score: -1
tagged with: sorting
has comment: http://stackoverflow.com/comment/40909389
has comment: http://stackoverflow.com/comment/40909562
answer count: 3
has comment: http://stackoverflow.com/comment/40909931

http://stackoverflow.com/comment/41057119
score: 0
type: Comment
has text: main() is a method, not a thread. It is the method called from the main thread as a part of JVM startup.
type: AnswerComment
comment on: http://stackoverflow.com/a/26177836

http://stackoverflow.com/comment/40889198
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26093137
has text: Just saying that `undefined` is a common value in javascript. Find out why it shows this value. Open up your browser's developer tools and see what the server is sending to the client and why it might end up `undefined`.

http://stackoverflow.com/a/26080915
answers question: http://stackoverflow.com/q/26080637
type: AcceptedAnswer
has body: Because at your constructor, you create a new Canvas,and don't use the Game canvas and your rectangle is drawn at the new Canvas, not Game canvas, so your listener has no effect. Please see the the follow new constructor, I tested it, it works fine. public Game() { frame = new JFrame(NAME); frame.setSize(400, 400); frame.setVisible(true); // Sets the size of the window and makes it visible. JPanel panel = (JPanel) frame.getContentPane(); panel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); panel.setLayout(null); // Sets preferred size and layout to null. //can = new Canvas(); //can.setBounds(0, 0, 400, 400); //can.setIgnoreRepaint(true); setBounds(0, 0, 400, 400); setIgnoreRepaint(true); // Creates new canvas. panel.add(this); // Adds the canvas to the JPanel. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setResizable(false); // Makes the window packed, nonresizable, and close the program on exit. //can.createBufferStrategy(3); createBufferStrategy(3); bs = getBufferStrategy(); // Creates buffer strategy for the canvas. System.out.println("Window created."); addKeyListener(this); }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40866946
accepted answer of: http://stackoverflow.com/q/26080637

http://stackoverflow.com/comment/40952683
comment on: http://stackoverflow.com/a/26128559
type: AnswerComment
score: 0
has text: I'm new to java, so would that be using the formatdecimal class?
type: Comment

http://stackoverflow.com/comment/41033319
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26172096
has text: Using a `KeyListener` on a `JFrame`, wow, that's not going to end well

http://stackoverflow.com/a/26182192
type: Answer
score: 1
upvote count: 1
has body: The for loop should be in a method rather than in the class block protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notes_list); for (int i = 0; i &lt; 20; i++ ) { .... } }
answers question: http://stackoverflow.com/q/26182115
downvote count: 0

http://stackoverflow.com/q/26170406
tagged with: java
has answer: http://stackoverflow.com/a/26170495
type: Question
has title: how to import maven-based projects into Eclipse effectively for large projects?
has answer: http://stackoverflow.com/a/26176076
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/26176076
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41030324
tagged with: maven
accepted answer: http://stackoverflow.com/a/26170495
type: AnsweredQuestion
has body: I want to import maven-based projects in Eclipse. For example, here is a project that I am interested in importing to my Eclipse workspace. I have two options: since the project directory has a pom.xml in it, I can do import &gt; Existing Maven Projects The project gets loaded into workspace. run mvn eclipse:eclipse in the directory containing pom.xml. with this, an eclipse project is created (i.e .classpath and .project files). I can then do import &gt; Existing Projects into Workspace But with the second option, when I do right-click on the project &gt; run As &gt; ...., I do not see any options to run maven commands (such as Maven build, Maven build...). however, with the option 1, I can see these run configurations. Q1) what is the recommended way to import existing maven projects into Eclispse. 1 or 2 or something else? Q2) why in option 2, maven commands are not available and how to get them back upon right click on the project. Thanks. Just clarify, what I mean, here is the screen-shot:

http://stackoverflow.com/q/26069315
has body: Okay, so I've done Swing applications before, and I know if you want to display a different name for the application menu (the one on Macs that usually have a "Preferences" and "Quit" option), you have to use: System.setProperty("com.apple.mrj.application.apple.menu.about.name", "App name"); and it must be executed before the JFrame is created. I've done this, but it continues to show my Main class' name as the menu name, as if I didn't write that line of code at all. I googled for this issue, but couldn't find anything useful, and then I just searched on here, but everyone who had a similar issue was running Java 1.5, 1.6, or 1.7. So I thought maybe it had something to do with my current Java version, 1.8. This, this, and this did not work. This, this, and this either sent me to outdated info, or the links didn't work anymore. Also, I'm running Mac 10.8. Any suggestions/answers would be greatly appreciated. An update: here is the code I originally had: package bouncing_off_axes; /** * This is the driver class of this program. * * @author Mason * */ public class Main { /** * The driving method. * * @param args */ public static void main(String[] args) { System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Physics Engine Practice - Bouncing Balls"); SimulationController view = new SimulationController("Test"); } } And here is a solution that trashgod provided to someone else: package bouncing_off_axes; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JPanel; /** @see https://stackoverflow.com/questions/8955638 */ public class NewMain { public static void main(String[] args) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty( "com.apple.mrj.application.apple.menu.about.name", "Name"); EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame f…
has comment: http://stackoverflow.com/comment/40846411
has answer: http://stackoverflow.com/a/26080591
accepted answer: http://stackoverflow.com/a/26080591
linked to: http://stackoverflow.com/q/10057469
linked to: http://stackoverflow.com/q/6884272
linked to: http://stackoverflow.com/q/11734104
has title: Swing application menu name not displaying correctly in Java 1.8
linked to: http://stackoverflow.com/q/11915304
linked to: http://stackoverflow.com/q/3154638
answer count: 1
tagged with: macos
linked to: http://stackoverflow.com/q/14482635
favorite count: 0
has comment: http://stackoverflow.com/comment/40860203
has comment: http://stackoverflow.com/comment/40865358
upvote count: 5
tagged with: jmenubar
tagged with: swing
has comment: http://stackoverflow.com/comment/40859982
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10702463
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40859837
type: Question
linked to: http://stackoverflow.com/q/8955638
score: 5

http://stackoverflow.com/a/26070161
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26070112
type: Answer
answers question: http://stackoverflow.com/q/26070112
upvote count: 3
has body: This occurs because new String(request.getData()) does not return "message received". The problem is [likely] due to the fact that new String(byte[]) attempts to use all (1000 of) the bytes supplied, in the default encoding, which ends with a bunch of NUL ('\0') characters that append to the actual string content making it not equal with the literal. Such can be easily seen a debugger, although such NUL characters are often "lost" when displaying as normal text as with println. Trivially: "hello".equals("hello\0") is false. Several solutions include: Frame the string, such as prefixing the sent data with the number of bytes that make up the string, and then using a String constructor that takes a limit/length or; Prevent any trailing 0 from being processed, again by specifiying the limit to decode or; Remove any NUL characters after decoding the data. Since option #3 is easy1 (until it can be fixed to use #1/#2), consider: String str = new String(request.getData(), "UTF-8"); // Specify an encoding! int nul = str.indexOf('\0'); if (nul &gt; -1) { str = str.substring(0, nul); } 1 While trimming is the easiest, it is not generally appropriate. The biggest problem with #3 over #2 is it first decodes all the bytes and then filters the characters. Under different encodings (although ASCII and UTF-8 should be "safe"), this may result in non-NUL garbage after the actual string content depending upon what exists in the buffer. Also, specify an encoding manually to new String(byte[] ..) or String.getBytes(..). Otherwise the "default encoding" will be used, which can cause problems if the different systems are using a different default.
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/40968890
has text: programmer understand code better than words
score: 0
comment on: http://stackoverflow.com/q/26137539
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40842573
comment on: http://stackoverflow.com/a/26067855
has text: When was writing comment there were no code above... Thank you for your help! :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41029884
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/26170277
type: Comment
has text: Bullocks! I knew there was something simple I missed. Thanks! #feelsAshamed

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

http://stackoverflow.com/q/26084153
type: UnansweredQuestion
tagged with: virtual-machine
tagged with: virtualbox
type: Question
has title: Start Windows Program from Linux in a virtual machine.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26084248
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
tagged with: linux
tagged with: windows
has body: I want to start a Windows program on virtual machine from Linux. Are there opportunities to start a program directly on VM from the outside. I tried WINE to emulate this program, but it does not work. One idea I have, to implement WebService on the virtual machine and call this from Linux. The web service would then call the program under Windows and play back the result. Has anyone experience or better ideas?

http://stackoverflow.com/comment/40925695
type: AnswerComment
has text: Thanks for your answer. So, do I consider that it is expected that the test to a method (here method1) can make a call to other private methods (here method2) of the same class. I am saying this because "assertThat(testee.method1(testValue), equalTo(expectedResult));" will make an actual call to method2 also.
type: Comment
comment on: http://stackoverflow.com/a/26102834
score: 0

http://stackoverflow.com/q/26132480
type: Question
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/26134024
answer count: 1
has comment: http://stackoverflow.com/comment/40959920
tagged with: java
has comment: http://stackoverflow.com/comment/40959868
has comment: http://stackoverflow.com/comment/40959869
has body: I asked this question before, but I think that because i only included as piece of the code it was unclear. I am writing a program that asks the user what kind of question they want asked, and then they are prompted for an answer to that question. However, even the correct input from the user results in a return of an incorrect answer. Here's the code: import java.util.Scanner; public class MascotQuiz { public static void main(String[] args) { int score = 0; String greeting = "In this game, I ask you four questions about mascots for " + "US collegiate sports teams." + "\nYou get 1 point for each correct answer, " + "0 points if you type don't know, " + "and you lose a point for wrong answers."; final String schoolOptions = "University of Michigan, " + "University of Nebraska, " + "University of Oklahoma, " + "University of Wisconsin"; final String mascotOptions = "Badgers, Cornhuskers, Sooners, Wolverines"; String prompt1 = "\nType 1 and I'll give you the mascot and " + "you give give the school. \n" + "Type 2 and I'll give you the school and " + "you give me the mascot. \n" + "Type 3 and I'll quit."; System.out.println(greeting); int questionCount = 1; String mascotQuestion1, mascotQuestion2, mascotQuestion3, mascotQuestion4; String schoolQuestion1, schoolQuestion2, schoolQuestion3, schoolQuestion4; do { System.out.println(prompt1); int optionChoice; Scanner scan = new Scanner(System.in); optionChoice = scan.nextInt(); if (optionChoice == 1) { if (questionCount == 1) { System.out.println("What school do the Badgers belong to?"); mascotQuestion1 = scan.nextLine(); if (mascotQuestion1.equalsIgnoreCase("University of Michigan")) { score++; } else if (mascotQuestion1.equalsIgnoreCase("don't know")) { score = (score + 0); } else { score--; } } else if (questionCount == 2) { System.out.println("What school do the Cornhuskers belong to?"); mascotQuestion2 = scan.next(); if (mascotQuestion2.equalsIgnoreCase("University of Nebrasksa")) { score++; } else if (mascotQuestion2.…
has title: Multiple word string input and boolean
upvote count: 0
linked to: http://stackoverflow.com/q/26131721
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/40963528

http://stackoverflow.com/comment/40862891
comment on: http://stackoverflow.com/q/26079180
score: 0
type: QuestionComment
type: Comment
has text: in place of ? a reference to a listener is written .means who will respond to the event genereted by source.

http://stackoverflow.com/q/26061799
has body: I am getting such type error :- DatePickerExample.java:5: error: package org.jdesktop.swingx does not exist import org.jdesktop.swingx.JXDatePicker; ^ DatePickerExample.java:16: error: cannot find symbol JXDatePicker picker = new JXDatePicker(); ^ symbol: class JXDatePicker location: class DatePickerExample DatePickerExample.java:16: error: cannot find symbol JXDatePicker picker = new JXDatePicker(); ^ symbol: class JXDatePicker location: class DatePickerExample 3 errors Even I am using jdk version :- java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode) please some one help me I am supposed to use such component in my project.
upvote count: 1
answer count: 1
score: 0
tagged with: java
downvote count: 1
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26062275
favorite count: 0
has title: why am I getting error by using JXDatePicker class

http://stackoverflow.com/comment/40985358
type: QuestionComment
comment on: http://stackoverflow.com/q/26145174
score: 0
has text: I just tried the line wrapper, it did not quite do anything.
type: Comment

http://stackoverflow.com/comment/40850900
type: Comment
type: QuestionComment
score: 0
has text: The > operator is OK, I think you're using the method prime(date) without even declaring it/or having access and the error is there. Why do you call the variable date?? isn't it better to call it number?. Then your inserting the primes in a list called tree... call it primes!
comment on: http://stackoverflow.com/q/26072732

http://stackoverflow.com/comment/41058542
type: QuestionComment
comment on: http://stackoverflow.com/q/26185434
has text: @Alboz How does your suggested edit of `main()` differ from what the OP already has?
score: 0
type: Comment

http://stackoverflow.com/comment/58245027
has text: My previous comment is outdated. Meanwhile I have implemented the Jalali calendar in Java - with support for adding days etc., see demo in my other [SO-post](http://stackoverflow.com/a/33348458/2491410). Just use Time4J instead of Time4A with at least the modules core+i18n+calendar.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26072162

http://stackoverflow.com/a/26075757
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26075699
has body: See this link for accepted characters in URL. Persian characters are not supported as get parameters in a url. You can use http post for sending the data to the server.

http://stackoverflow.com/q/26077771
has comment: http://stackoverflow.com/comment/40864179
has answer: http://stackoverflow.com/a/26077777
tagged with: math
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/40860193
has comment: http://stackoverflow.com/comment/40893827
has comment: http://stackoverflow.com/comment/40860220
type: Question
accepted answer: http://stackoverflow.com/a/26077777
linked to: http://stackoverflow.com/q/13781069
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40863307
tagged with: char
possible better answer: http://stackoverflow.com/a/26077821
has answer: http://stackoverflow.com/a/26077821
favorite count: 0
has comment: http://stackoverflow.com/comment/40863350
has title: Character arithmetic in Java
type: AnsweredQuestion
has body: While playing around I met something, that seems strange to me: The following isn't valid Java code: char x = 'A'; x = x + 1; //possible loss of precision because one of the operands ist an integer and so the other operand is converted to integer. The result couldn't be assigned to a character variable ... while char x = 'A'; x += 1; is valid, because the resulting integer is - automatically - converted to character. So far so good. This seems clear to me but ... why is the following valid Java code? char x; x = 'A' + 1;

http://stackoverflow.com/comment/48984083
type: AnswerComment
has text: Aren't you disabling csrf for all the requests ?
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26239302

http://stackoverflow.com/comment/40978197
comment on: http://stackoverflow.com/q/26142063
type: Comment
type: QuestionComment
has text: How do you intend to create the `Future`s by hand? Are you spawning asynchronous tasks? Does your database access library operate asynchronously?
score: 0

http://stackoverflow.com/comment/41071483
has text: r @EJP thanks for your answer...its server only writing the output to the outputStream which i get from clientSocket.getOutPutStream and the InputStream as i mentioned i got from my zipped content..
type: QuestionComment
comment on: http://stackoverflow.com/q/26192396
score: 0
type: Comment

http://stackoverflow.com/q/26078617
has answer: http://stackoverflow.com/a/26078847
upvote count: 2
accepted answer: http://stackoverflow.com/a/26120750
tagged with: web-services
has title: Fast Rest Calls Execution
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40862612
tagged with: performance
has comment: http://stackoverflow.com/comment/40872608
tagged with: java
has answer: http://stackoverflow.com/a/26078833
type: Question
score: 2
tagged with: bulk
downvote count: 0
has answer: http://stackoverflow.com/a/26120750
tagged with: rest
answer count: 3
possible better answer: http://stackoverflow.com/a/26078847
has body: This question has two parts Part 1 I need to make bulk Rest API Calls for Third Party API, i.e around 300K per hour, so What's the best way to optimize my code to get/manage response with in time. As in a test I tried to generate 1000 Threads and called below code to get response in minimum time, but the result was pretty disappointing. Some of the calls responded successfully but many of the calls returned timeout error. HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("http://www.example.com"); HttpResponse response; response = client.execute(httpGet); System.out.println(response.getStatusLine().getStatusCode()); HttpEntity entity = response.getEntity(); String result = getStringFromInputStream(entity.getContent()); I know that timeout error can be due to server side but for instance server returns the response and all my 1000 threads respond within 5mins time, then still I wouldn't be able to achieve 300k calls per hour. Secondly can I optimize this code in some other way? Part 2 I tried this with Java, I am just curious to know would it give better result if I use language other than java? i.e. javascript/python/PHP? Update 1 My System Specs for the Tests conducted Ubuntu 14.04 64 bit 4Gb RAM 500 GB Hard Drive Intel® Core™ i5-2430M CPU @ 2.40GHz × 4 Internet connection = 1 MB :( Update 2 My server specs to conduct tests in future/practical Cent OS 6.5 1 GB RAM 1 CPU Core 40 Gbit Network In 125 Mbit Network Out :) Please guide. Thank you.
favorite count: 0

http://stackoverflow.com/comment/40879313
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26087634
has text: Please provide example(s) of the inputs you have tested.

http://stackoverflow.com/comment/40902788
has text: @Diedre: it does not have direct pointers, but it has them indirectly as reference variables.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26089136

http://stackoverflow.com/q/26186413
has comment: http://stackoverflow.com/comment/41060061
tagged with: java
type: Question
score: 0
tagged with: sql
tagged with: sqlite
tagged with: ormlite
has comment: http://stackoverflow.com/comment/41060614
has body: I use for search the following code. (with SQLite db) QueryBuilder&lt;Product, Integer&gt; queryBuilder = getProductDao().queryBuilder(); queryBuilder.where().like(Product.PRODUCT_NAME, "%" + productName.trim().replaceAll(" ", "%") + "%"); PreparedQuery&lt;Product&gt; preparedQuery = queryBuilder.prepare(); List&lt;Product&gt; productList = getProductDao().query(preparedQuery); All work fine, but when I start use PostgreSQL db I faced with case sensevity problem. I may using toLowerCase() method for input data, but how can I do it with data from DB? Should I try write custom method for searching?
tagged with: postgresql
has comment: http://stackoverflow.com/comment/41060538
has title: OrmLite "like" method with PostgreSQL, case sensevity
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26168883
upvote count: 6
answers question: http://stackoverflow.com/q/26168806
has body: I think I got it now. What's in the Stream is of type String therefore I can't call print on a String intance... For example this works public class Chapter3 { final String value; public Chapter3(String value) { this.value = value; } public void print() { System.out.println(value); } public static void main(String[] args) { Arrays.asList(new Chapter3("a"), new Chapter3("b")).forEach(Chapter3::print); } }
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/comment/49334828
type: QuestionComment
has text: Stacktrace please !!!!
score: 0
comment on: http://stackoverflow.com/q/26113315
type: Comment

http://stackoverflow.com/comment/40925013
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26113186
score: 0
has text: It could implement equals().

http://stackoverflow.com/a/26167994
has body: nmbr is a factor of 30 is the same as saying 30 is a multiple of nmbr. So just use the % operator again. You do have to guard against nmbr being zero, which would cause a exception. if (nmbr&gt;0 &amp;&amp; 30%nmbr==0) { // nmbr is a factor of 30 }
answers question: http://stackoverflow.com/q/26167809
type: Answer
accepted answer of: http://stackoverflow.com/q/26167809
upvote count: 6
score: 6
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41054031
comment on: http://stackoverflow.com/q/26145425
score: 0
type: Comment
type: QuestionComment
has text: I know that log4j shouldn't be a problem, because I've used it in other programs without an issue. I've tried removing references to my custom Login bean as well as the PasswordHash class, so the `LoginService`'s `authenticate` method essentially just returns a `false`. Still nothing. I've decided to start a bounty because this is just so damned strange.

http://stackoverflow.com/comment/40896001
score: 0
type: QuestionComment
type: Comment
has text: @a_horse_with_no_name So I tried `while(ResultSet.next())`. I get this: `java.sql.SQLException: Column Index out of range, 3 > 1`
comment on: http://stackoverflow.com/q/26097173

http://stackoverflow.com/comment/41061101
has text: Can you use class from any namespace or is it suppose to be from the current domain?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26186689
score: 0

http://stackoverflow.com/a/26086019
answers question: http://stackoverflow.com/q/26085885
score: 3
has comment: http://stackoverflow.com/comment/40875530
downvote count: 0
has comment: http://stackoverflow.com/comment/40875370
type: Answer
has comment: http://stackoverflow.com/comment/40875771
has comment: http://stackoverflow.com/comment/40875567
has comment: http://stackoverflow.com/comment/40875704
upvote count: 3
has comment: http://stackoverflow.com/comment/40875613
has comment: http://stackoverflow.com/comment/40875455
has body: The order of filter chain is important. In your case the session should be opened before struts is executing actions and closed after that. The last thing is done by spring via managing Hibernate session. So, reorder filters and allow struts2 dispatcher accept requests from the first filter. openSessionInViewFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter openSessionInViewFilter /* struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* REQUEST FORWARD

http://stackoverflow.com/a/26039409
type: Answer
has comment: http://stackoverflow.com/comment/40792386
has body: Ummm, you're not explaining your question very well, but here's my shot at it. First things first, your code is all over the place, even this small of a program, it's hard for anyone to read anything, I would edit it to make it readable but I'm not sure I'm allowed. Anyways, bigrams = pairs of letters, words, or syllables (according to Google). And you're looking for the similarity value of it? Well I did a little bit of research on it, and it seems that the algorithm you would need is this. Now, let's start fleshing this out. OP, correct me if I misunderstood your question. You are looking for the similarity between words by breaking them down into bigrams and finding their respective similarity values, yes? If so, let's break down this formula before we start to use it, cuz it will most certainly be the one that you need. Now, we have 2 words, FRANCE, and FRENCH. We want to find the similarity values of them if they were broken down into bigrams. For FRANCE, we have {FR, RA, AN, NC, CE} For FRENCH, we have {FR, RE, EN, NC, CH} France and French are meant to represent s1 and s2 from the first equation. Next, we take matches that they have in both bigrams. What I mean by this is, which bigrams, or pairs of letters, can be found in both words?? In this case, the answer would be, FR and NC. Since we found 2 pairs, the value on top turns into 4 since the formula states, 2 multiplied by the number of matching bigrams. So we have 4 on the top, and nothing else. Now, the bottom half is solved by adding up the number of bigrams that can be made out of each of the words you are comparing, namely, 5 for FRANCE and 5 for FRENCH. So the denominator would be 10 So now, what do we have? We have 4/10, or .4. THAT is our similarity value, and that is the value you need to find when making your program. Let's try another example just to root this into our heads, let's say s1 = "GOLIATH" s2 = "GOALIE" So, using the bigrams, we come up with the array of Strings... {"GO","OL","LI","IA…
has comment: http://stackoverflow.com/comment/40792975
answers question: http://stackoverflow.com/q/26037351
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/40792270
upvote count: 10

http://stackoverflow.com/comment/41004624
comment on: http://stackoverflow.com/q/26145408
score: 1
has text: Similar to chrylis' comment, the modern approach is NOT to use app servers. Multi-tenancy is also dead, because why have the hassle of that when you can use VMs or containers like Docker to give you real separation?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/59893193
type: AnswerComment
comment on: http://stackoverflow.com/a/26147479
score: 0
type: Comment
has text: Hi mikeho, I am having the same problem as you had. I see that you will release a lib for encryption/decryption data between iOS and Android with RSA algorithm. Did you make it?

http://stackoverflow.com/q/26062140
has answer: http://stackoverflow.com/a/26064012
upvote count: 1
type: Question
tagged with: gwt
tagged with: java
tagged with: barcode-scanner
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26066309
has title: Scanning barcode into the textbox of a web application
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40831659
has body: I am working on a web based Java application (GWT is used for my UI). I have a warehouse management system.I need to scan the barcodes and show them in a textbox. I am aware that the scanners would send keyboard events. How do I capture these events and populate them in my textbox ? Should the cursor focus be on the textbox while scanning the barcode ? Can anyone please provide a code snippet of how to capture these events and populate in the textbox ? Please note that this needs to work across different OS and browsers. This should work for laptops/desktops. It is not for mobile apps.
has answer: http://stackoverflow.com/a/26065166
linked to: http://stackoverflow.com/q/4115770
score: 1

http://stackoverflow.com/a/26050625
answers question: http://stackoverflow.com/q/26050551
has body: Not sure about java, but this might work for any dimensions: /(-\d+x\d+)/g
score: 0
type: Answer

http://stackoverflow.com/a/26089401
upvote count: 1
score: 1
has body: If you add a print statement like this: if (isPalindrome(pp)) { System.out.format("i = %d, j = %d%n", i, j); return (pp); } you get the result: i = 995, j = 583 580085 So, your program never comes to 993 * 913.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40881764
type: Answer
accepted answer of: http://stackoverflow.com/q/26089316
answers question: http://stackoverflow.com/q/26089316

http://stackoverflow.com/a/26080910
answers question: http://stackoverflow.com/q/26080636
has body: My question here is how to add an external library using Make syntax? The Answer is in the question. You would use the same command as you would from the command line ... This is really a Java agnostic question. It is really about how to write a Makefile. But presumably if your teachers want you to use make to build Java, they will have provided you with a sample / template Makefile to get you started. If you showed us that template, we could tell you how best to modify it. But assuming that you don't have a specific template in mind, then this a duplicate of an existing Question.
score: 0
type: Answer

http://stackoverflow.com/comment/41040596
type: QuestionComment
has text: Please simplify your code example and show some example inputs that trigger the problem. There is a lot of code we don't need to see there - just focus on the substring stuff and demonstrate the problem.
comment on: http://stackoverflow.com/q/26176043
score: 0
type: Comment

http://stackoverflow.com/comment/40855892
type: QuestionComment
has text: Yes, Implemented it and its working as expected.
comment on: http://stackoverflow.com/q/26044877
score: 0
type: Comment

http://stackoverflow.com/q/26092061
has answer: http://stackoverflow.com/a/26092661
has answer: http://stackoverflow.com/a/26092105
has title: Error code when compiling in Java
has answer: http://stackoverflow.com/a/26092085
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/44622140
has body: Ok so I'm trying to get my code to give me a return type but it keeps giving me an error. Here is my code. import java.util.Scanner; public class Gradebookmodified { public static void main(String[] args ){ mainMenu(); mainInstructions(); mainGrades(); average(); } public static void mainMenu(){ Scanner input = new Scanner(System.in); System.out.print("Choose an option: \n1.Average grades for a new student \n2.Quit \n"); int selection; selection = input.nextInt(); if( selection == 1){ System.out.println("Enter name of new student"); String name = input.next(); }else { } } public static void mainInstructions(){ Scanner input = new Scanner(System.in); System.out.println("Grades will be entered in this order: \n1. Homework \n2. Quizzes \n3. Tests"); } public static void mainGrades(){ Scanner input= new Scanner(System.in); double[] homework = new double[5]; for(int i = 0; i &lt; homework.length; i++){ System.out.println("Enter homework grades."); homework[i] = input.nextDouble(); } double[] quizzes = new double[4]; for(int j = 0; j &lt;quizzes.length; j++){ System.out.println("Enter quiz grades."); quizzes[j] = input.nextDouble(); } double[] tests = new double[4]; for(int k = 0; k &lt;tests.length; k++){ System.out.println("Enter test grades."); tests[k] = input.nextDouble(); } } public static double average(double homework, int i){ Scanner input = new Scanner(System.in); double result = 0.0; if (homework &gt; 0){ result = i / homework; } return result; } } This is the error that the compiler keeps giving me. Gradebookmodified.java:16: error: method average in class Gradebookmodified cannot be applied to given types; average(); ^ required: double,int found: no arguments reason: actual and formal argument lists differ in length 1 error Im not sure why it keeps giving me this error but if anyone can tell me what I'm doing wrong, that would be fantastic.
has comment: http://stackoverflow.com/comment/40886711
answer count: 3
upvote count: 0
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40886719

surfaceview
tags question: http://stackoverflow.com/q/26034802
tags question: http://stackoverflow.com/q/26191163
type: Tag
tags question: http://stackoverflow.com/q/26156816
tag name: surfaceview

http://stackoverflow.com/comment/40876063
score: 0
type: Comment
type: QuestionComment
has text: helo indonesian, same here, give me the full stacktrace . dont use etc.....
comment on: http://stackoverflow.com/q/26086104

http://stackoverflow.com/a/26127097
has body: It should be mockStatic(Model.class); when(Post.find(eq(Post.class), eq(99))).thenReturn(this.post);
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26125605
answers question: http://stackoverflow.com/q/26125605
downvote count: 0
score: 1

http://stackoverflow.com/q/26056569
type: Question
score: 0
tagged with: atg
has title: Adding processes in payment pipeline in ATG
answer count: 1
tagged with: oracle-commerce
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26269727
has body: i am atg beginner I have to add few processes to payment pipeline(paymentpipeline.xml) as I have to do some integration stuff. Please let me know how to add processes to payment pipeline and how to invoke them ? Also, i am not able to find paymentpipeline.xml in my project. Do i need to create it or do changes in commercepipeline.xml? Thanks
tagged with: java
tagged with: commerce

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26153069
tags question: http://stackoverflow.com/q/26108351
type: Tag
tags question: http://stackoverflow.com/q/26172096
tags question: http://stackoverflow.com/q/26171656
tags question: http://stackoverflow.com/q/26081993

http://stackoverflow.com/comment/40968839
type: AnswerComment
comment on: http://stackoverflow.com/a/26116671
type: Comment
has text: are u getting the connection object atleast just try to print it and later show the stacktrace of error
score: 0

http://stackoverflow.com/a/26191049
accepted answer of: http://stackoverflow.com/q/26190981
type: Answer
answers question: http://stackoverflow.com/q/26190981
has comment: http://stackoverflow.com/comment/41069208
has comment: http://stackoverflow.com/comment/41071042
score: 4
upvote count: 4
has body: When calling String.format("%d",myInt), myInt is automatically (and implicitly) wrapped in an Integer instance, which extends Object, therefore it compiles. Concerning the arrays, the conversion from primitiveType[] to WrapperClass[] is not automatic for some reason. If you try to use an array of a primitive type where an array of the wrapper class is expected, it will result in a compile error. Using Integer creates an overhead compared to using int because you need to assign and store references. However, this overhead is limited when using Integer values between -128 and 127 because these values are pooled (which means that all instances of Integer wrapping a value in this in interval point to a unic reference).
has comment: http://stackoverflow.com/comment/41071085
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41076407

http://stackoverflow.com/comment/41002868
score: 0
comment on: http://stackoverflow.com/q/26155609
type: QuestionComment
type: Comment
has text: Find out which actual class the metadata is - you may find it has special methods (beyond those defined for ResultSetMetaData) that can help

http://stackoverflow.com/a/26041319
type: Answer
has body: I've never used SecureSocial before, so I can't promise a definitive answer, but there appear to be two problems. First of all, it appears as though the second URL you're using for the Maven repository is incorrect (http://securesocial.ws/repository/snapshots/ results in a 404). That's not the fatal error though, because according to the docs, SecureSocial is in Maven Central. The second, larger problem is that you appear to be requesting a version of SecureSocial to match the version of your own project ("ws.securesocial" %% "securesocial" % version.value). You probably don't want to do this, unless you want to pin your project's versioning to SecureSocial. It may resolve your issue to use one of the library dependency strings referred to in SecureSocial's docs: "ws.securesocial" %% "securesocial" % "2.1.4" if you want the latest version, or "ws.securesocial" %% "securesocial" % "master-SNAPSHOT" if you want the latest snapshot.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26040772
answers question: http://stackoverflow.com/q/26040772
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26070503
has comment: http://stackoverflow.com/comment/40847064
has title: SimpleDateFormat tacks on hours for no reason?
linked to: http://stackoverflow.com/q/1555262
answer count: 4
has answer: http://stackoverflow.com/a/26070867
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26070838
score: 3
has body: What is the proper way to turn an integer of seconds into a formatted string of hh:mm:ss in Java? For instance: int Seconds = 650 String Time = 00:10:50 Right now I'm using this: String Time = new SimpleDateFormat("hh:mm:ss").format(new Date((Seconds*1000))); But this seems to tack on hours for no reason, and I'm guessing it's because I'm misusing Date or SimpleDateFormat, but I'm too inexperienced to know what's wrong. Or is there just a built in system for this that I don't know about. EDIT: I should point out that I know I could use simple division to peel out the hours, then the remaining minutes, then the remaining seconds, and patch all three of those pieces into a string, but I was wondering if Java has a baked-in way to do this.
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26070765
has comment: http://stackoverflow.com/comment/40847686
possible better answer: http://stackoverflow.com/a/26070838
type: Question
has comment: http://stackoverflow.com/comment/40847052
has answer: http://stackoverflow.com/a/26070676
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26070765

http://stackoverflow.com/comment/40782830
comment on: http://stackoverflow.com/a/26035736
type: Comment
score: 0
has text: how to calculate level
type: AnswerComment

http://stackoverflow.com/q/26040316
tagged with: actionscript-3
has body: i've just recently started with java on my school, and i have a bit of a problem. Well not really a problem, since i've found a way to solve it (complicated one though). im supposed to make a poemgenerator. so, in a for loop, i want to build a string, of words that is in some arrayLists, so im using a StringBuilder for that. the thing is, that my sentence should consists of words from 4 different arrayLists, (different wordclasses) and, a while ago, i programmed in actionscript3, and there was something there that i could really use for this problem, that would make the code so much simplier. using This[] so. i have 4 lists: list0, list1, list2, list3 and in my loop, i would've done something like the following in AS3(flash, actionscript3) for(int i = 0; i&lt;4; i++){ poem.append(This["list" + i].get(randomindex)) } so that the first time the loop goes, i get a random word from list0, the second time, i get a random word from list1, and so on... is there any way to do this simple in java? x)
accepted answer: http://stackoverflow.com/a/26040419
type: AnsweredQuestion
tagged with: java
has title: Getting values from multiple arrayLists in java
has answer: http://stackoverflow.com/a/26040418
type: Question
has answer: http://stackoverflow.com/a/26040419
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/12231453
answer count: 3
possible better answer: http://stackoverflow.com/a/26040462
has answer: http://stackoverflow.com/a/26040462

http://stackoverflow.com/q/26151113
has comment: http://stackoverflow.com/comment/41010085
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/26153263
downvote count: 0
tagged with: java
has title: What's slowing this Clojure function down?
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/26151771
accepted answer: http://stackoverflow.com/a/26151771
answer count: 2
possible better answer: http://stackoverflow.com/a/26153263
has body: I am working on Project Euler problem 14 in Clojure. I have what I feel is a good general algorithm, and I am getting the correct result, but I am struggling to understand why my function is so slow compared to (what I believe to be) an equivalent function in Java. Here's my Clojure function to get the length of the Collatz chain from a given starting number: (defn collatz-length [n] (loop [x n acc 1] (if (= 1 x) acc (recur (if (even? x) (/ x 2) (inc (* 3 x))) (inc acc))))) And here's my Java function to do the same thing: public static int collatzLength(long x) { int count = 0; while (x &gt; 1) { if ((x % 2) == 0) { x = x / 2; } else { x = (x * 3) + 1; } count++; } return count; } To time the performance of these functions, I used the following Clojure code: (time (dorun (map collatz-length (range 1 1000000)))) And the following Java code: long starttime = System.currentTimeMillis(); int[] nums = new int[1000000]; for (int i = 0; i &lt; 1000000; i++) { nums[i] = collatzLength(i+1); } System.out.println("Total time (ms) : " + (System.currentTimeMillis() - starttime)); The Java code runs in 304 ms on my machine, but the Clojure code takes 4220 ms. What is causing this bottleneck and how can I improve the performance of my Clojure code?
tagged with: clojure
favorite count: 0
score: 6

http://stackoverflow.com/comment/87170165
type: Comment
has text: I have recalled and found the correct way, and added the comment to the question.
type: AnswerComment
comment on: http://stackoverflow.com/a/26191723
score: 0

http://stackoverflow.com/q/26097341
has answer: http://stackoverflow.com/a/60315166
answer count: 2
has answer: http://stackoverflow.com/a/26097437
upvote count: 1
has comment: http://stackoverflow.com/comment/40896022
tagged with: jsp
favorite count: 0
has title: how to set datasource in jsp?
has comment: http://stackoverflow.com/comment/40896071
type: UnansweredQuestion
tagged with: jdbc
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
has body: I have datasource.the code is as below: public class DataSource { Connection connection = null; BasicDataSource bdsource = new BasicDataSource(); public DataSource() { bdsource.setDriverClassName("com.mysql.jdbc.Driver"); bdsource.setUrl("jdbc:mysql://localhost:3306/databaseName"); bdsource.setUsername("UserName"); bdsource.setPassword("PassWord"); } public Connection createConnection() { Connection con = null; try { if (connection != null) { System.out.println("Can't create a new connection"); } else { con = bdsource.getConnection(); } } catch (Exception e) { e.printStackTrace(); } return con; } } I need to display some data from database on jsp. So how can i set the the datasource in jsp without letting the world know the username, password and database name in jsp?

http://stackoverflow.com/q/26156360
tagged with: memory
has answer: http://stackoverflow.com/a/26156603
has comment: http://stackoverflow.com/comment/41005982
has comment: http://stackoverflow.com/comment/41003769
answer count: 2
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/26156411
has comment: http://stackoverflow.com/comment/41003810
accepted answer: http://stackoverflow.com/a/26156411
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41006197
has comment: http://stackoverflow.com/comment/41003727
has comment: http://stackoverflow.com/comment/41006254
possible better answer: http://stackoverflow.com/a/26156603
has comment: http://stackoverflow.com/comment/41003981
type: AnsweredQuestion
has body: I have a text file, with a sequence of integer per line: 47202 1457 51821 59788 49330 98706 36031 16399 1465 ... The file has 3 million lines of this format. I have to load this file into the memory and extract 5-grams out of it and do some statistics on it. I do have memory limitation (8GB RAM). I tried to minimize the number of objects I create (only have 1 class with 6 float variables, and some methods). And each line of that file, basically generates number of objects of this class (proportional to the size of the line in temrs of #ofwords). I started to feel that Java is not a good way to do these things when C++ is around. Edit: Assume that each line produces (n-1) objects of that class. Where n is the number of tokens in that line separated by space (i.e. 1457). So considering the average size of 10 words per line, each line gets mapped to 9 objects on average. So, there will be 9*3*10^6 objects.So, the memory needed is: 9*3*10^6*(8 bytes obj header + 6 x 4 byte floats) + (a map(String,Objects) and another map (Integer,ArrayList(Objects))). I need to keep everything in the memory, because there will be some mathematical optimization happening afterwards.
type: Question
upvote count: 5
tagged with: java
has title: best way of loading a large text file in java

http://stackoverflow.com/comment/40814733
type: QuestionComment
has text: How many times do you want to display that message? And at what interval?
comment on: http://stackoverflow.com/q/26052994
score: 0
type: Comment

http://stackoverflow.com/q/26170721
answer count: 1
tagged with: branch
has comment: http://stackoverflow.com/comment/41030810
has comment: http://stackoverflow.com/comment/41032896
type: UnansweredQuestion
has body: the code show no error in the compiler but when the code run and the loops met the requirement it keep print out nonstop message here the picture http://i62.tinypic.com/23if4uv.png also here is the code that i use: Scanner keyb = new Scanner(System.in); int numbg = (int) (100*Math.random())+1; String one = "That was lucky!"; String twofour="That was amazing!"; String fivesix= "That was good."; String seven= "That was okay"; String enine = "That was not versy good"; String tm= "That just insn't your game"; System.out.println("Enter a guess between 1 and 100: "); int numbu = keyb.nextInt(); int wrong = 0; while (numbg != numbu) { if (numbu &lt; numbg) { System.out.println("Your guess too low. Try again. "); wrong++; System.out.println("Enter a guess between 1 and 100: "); numbu=keyb.nextInt(); } else if (numbu &gt; numbg &amp;&amp; numbu &lt;= 100) { System.out.println("Your guess too high. Try again."); wrong++; System.out.println("Enter a guess between 1 and 100: "); numbu=keyb.nextInt(); } else if (numbu &gt; 100) { System.out.println("Your guess is out of range. Pick a number betwen 1 and 100"); numbu=keyb.nextInt(); } while (numbg == numbu) { if (wrong &gt;= 1) { System.out.println(one); } else if (wrong &gt;= 2 &amp;&amp; wrong &lt;= 4) { System.out.println(twofour); } else if (wrong &gt;= 5 &amp;&amp; wrong &lt;= 6){ System.out.println(fivesix); } else if (wrong == 7) { System.out.println(seven); } else if (wrong &gt;=8 &amp;&amp; wrong &lt;= 9){ System.out.println(enine); } else if (wrong &gt;= 10) { System.out.println(tm); } } }
has comment: http://stackoverflow.com/comment/41030759
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26170812
has title: How to fix runtime error of while loops?
score: 0
tagged with: while-loop

http://stackoverflow.com/q/26129384
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I have a BIG problem with the following code. I would expect it to return n number of words before and after the found keyword (needle) but it never does. If I have a text, say "There is a lot of interesting stuff going on, when someone tries to find the needle in the haystack. Especially if there is anything to see blah blah blah". And I have this regular expression: "((?:[a-zA-Z'-]+[^a-zA-Z'-]+){0,5}\b)needle(\b(?:[^a-zA-Z'-]+[a-zA-Z'-]+){0,5})" Should this NOT exactly match needle in the given string and return the text as someone tries to find the needle in the haystack. Especially if It never does :-( On execution, my method always returns an empty string, although I definitely know, the keyword is within the given text. private String trimStringAtWordBoundary(String haystack, int wordsBefore, int wordsAfter, String needle) { if(haystack == null || haystack.trim().isEmpty()){ return haystack ; } String textsegments = ""; String patternString = "((?:[a-zA-Z'-]+[^a-zA-Z'-]+){0,"+wordsBefore+"}\b)" + needle + "(\b(?:[^a-zA-Z'-]+[a-zA-Z'-]+){0,"+wordsAfter+"})"; Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(haystack); logger.trace("&gt;&gt;&gt; using regular expression: " + matcher.toString()); while(matcher.find()){ logger.trace("&gt;&gt;&gt; found you between " + matcher.regionStart() + " and " + matcher.regionEnd()); String segText = matcher.group(0); // as well tried it with group(1) textsegments += segText + "..."; } return textsegments; } Quite obvious, the problem lies within my regular expression, but I can't figure out what is wrong with it.
type: Question
has title: Return specified number of words before and after given position in text
upvote count: 1
tagged with: words
answer count: 1
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/26129518
accepted answer: http://stackoverflow.com/a/26129518
has comment: http://stackoverflow.com/comment/40954607

http://stackoverflow.com/comment/40785850
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26037367
has text: @JunedAhsan, in my customer filter i just trying to check url ends with "web.xml". but the request itself is not coming to filter.

http://stackoverflow.com/comment/40908405
has text: I will try this, thanks , but i don't have a good feeling, because this counter will be accessed by one or more MDB, i don't how it will react and if it's threadsafe
type: QuestionComment
comment on: http://stackoverflow.com/q/26054657
score: 0
type: Comment

http://stackoverflow.com/comment/40794871
score: 2
comment on: http://stackoverflow.com/q/26042139
type: Comment
type: QuestionComment
has text: Travers your array and compare adjacent elements.

http://stackoverflow.com/a/26071444
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/47518729
answers question: http://stackoverflow.com/q/26050097
has comment: http://stackoverflow.com/comment/72916312
has body: I had a similar issue posted here But I got it resolved using @Doge's suggestion, I converted the dependency android project to library project. Thanks.

http://stackoverflow.com/q/26064020
accepted answer: http://stackoverflow.com/a/26064345
type: AnsweredQuestion
has title: Update row in sqlite android
has body: I am trying to update a row in a table in sqlite in android but it update all rows and not just the row that I want. This is my code: public void EditarLinhaRecorrencia(int escolhaMensal , int escolhaSemanal , int escolhaDiaria , int escolhaOutro , int frequencia , String hora , String iDPrescricao) { ContentValues valores =new ContentValues(); valores.put("Mensal", escolhaMensal); valores.put("Semanal", escolhaSemanal); valores.put("Diario", escolhaDiaria); valores.put("OutrasFrequencias",escolhaOutro); valores.put("Frequencia",frequencia); valores.put("HoraTomas",hora); abrir(); this.db.update("Recorrencia",valores, iDPrescricao,null); fechar(); }
has comment: http://stackoverflow.com/comment/40835138
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40835495
score: 0
tagged with: android
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/26064345
has comment: http://stackoverflow.com/comment/40835250
has comment: http://stackoverflow.com/comment/40835036
tagged with: android-sqlite

http://stackoverflow.com/a/26190077
has body: Here is a sample code with org.json. But the same can be used with Gson/Jackson with changes to appropriate types within those libraries. You could also using StringBuilder instead of String for the keys here. import java.util.Iterator; import org.json.JSONArray; import org.json.JSONObject; public class MyJSONTest { private static void listJson(JSONObject json) { listJSONObject("", json); } private static void listObject(String parent, Object data) { if (data instanceof JSONObject) { listJSONObject(parent, (JSONObject)data); } else if (data instanceof JSONArray) { listJSONArray(parent, (JSONArray) data); } else { listPrimitive(parent, data); } } private static void listJSONObject(String parent, JSONObject json) { Iterator it = json.keys(); while (it.hasNext()) { String key = (String)it.next(); Object child = json.get(key); String childKey = parent.isEmpty() ? key : parent + "." + key; listObject(childKey, child); } } private static void listJSONArray(String parent, JSONArray json) { for (int i = 0; i &lt; json.length(); i++) { Object data = json.get(i); listObject(parent + "[" + i + "]", data); } } private static void listPrimitive(String parent, Object obj) { System.out.println(parent + ":" + obj); } public static void main(String[] args) { String data = "{\"store\":{\"book\":[{\"category\":\"reference\",\"author\":\"NigelRees\",\"title\":\"SayingsoftheCentury\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"HermanMelville\",\"title\":\"MobyDick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},],\"bicycle\":{\"color\":\"red\",\"price\":19.95}},\"expensive\":10}"; JSONObject json = new JSONObject(data); System.out.println(json.toString(2)); listJson(json); } }
score: 8
type: Answer
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/26183948

http://stackoverflow.com/q/26186875
has answer: http://stackoverflow.com/a/26187114
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/26187114
has comment: http://stackoverflow.com/comment/41061153
type: Question
has comment: http://stackoverflow.com/comment/41061152
has body: I am going to deserialize this json string with Gson { "ads": [ { "ad": { "id": 1, "title": "...", "publicImage": "...", "publicUrl": "...", "adposition": { "name": "home" }, "ttl": 30, "debug": false } }, { "ad": { "id": 2, "title": "...", "publicImage": "...", "publicUrl": "...", "adposition": { "name": "splash" }, "ttl": 30, "debug": false } }, { "ad": { "id": 3, "title": "...", "publicImage": "...", "publicUrl": "...", "adposition": { "name": "home" }, "ttl": 30, "debug": false } } ], "message": "issue list generated", "status": "success" } and what I have create for classes is (getter setter has been removed) : public class Ad { public class AdPosition{ private String mName; public String getName() { return mName; } public void setName(String name) { mName = name; } } @SerializedName("id") private int mID; @SerializedName("title") private String mTitle; @SerializedName("publicImage") private String mPublicImage; @SerializedName("publicUrl") private String mPublicUrl; @SerializedName("ttl") private int mTtl; @SerializedName("adposition") private AdPosition mAdPosition; } and public class AdsListResponse { @SerializedName("ads") private List&lt;Ad&gt; mAds; @SerializedName("message") private String mMessage; @SerializedName("status") private String mStatus; } and for converting I use below code Gson gson = new GsonBuilder().setPrettyPrinting().create(); AdsListResponse ads = gson.fromJson(response, AdsListResponse.class); for(Ad ad : ads.getAds()){ if(ad.getAdPosition().getName().equalsIgnoreCase("splash")){ System.out.println(ad.getAdPosition().getName()); } But my list contains objects(Ad) but every field of them is null, for example it has 3 ad but id,title,... are all null, what should I do? Sorry I copied and paste it wrongly, but still the problem is there, my list of Ad contains Ad but each field of Ad is null
has title: How to deserialize this json with Gson?
has comment: http://stackoverflow.com/comment/41060987
tagged with: jackson
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41061107

http://stackoverflow.com/comment/40890178
type: QuestionComment
has text: Place a sysout above Scanner keyboard = new Scanner(System.in). Just to make sure its even getting in function or not.
comment on: http://stackoverflow.com/q/26093999
score: 0
type: Comment

http://stackoverflow.com/a/40766448
upvote count: 1
type: Answer
has body: I had the same issue using SolrJ as I simply used toString() to convert all attribute values to strings. SolrJ asks Solr to return the results in javabin format (saw the wt-parameter in the URL by logging with debug level for the HttpClient), so I assume the java.util.Date object is serialized on Solr side and deserialized on SolrJ client side and this Date instance does not wear any timezone information. That is why it takes the local timezone as default when toString() is called. So there will be no other way to format the Date explicitely using the pattern of your choice. The DateFormatUtils class of the Apache Commons Lang package may be used as an alternative to a self written util like the DateHelper above. DateFormatUtils.format(yourDateObj, "yyyy-MM-dd'T'HH:mm:ss'Z'"); DateFormatUtils.format(yourDateObj, "yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"));
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26065611

http://stackoverflow.com/a/26104226
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26104171
type: Answer
has body: A catch clause will catch any exception that is assignment-compatible with the declared type of the exception. In the case you describe, an instance of NewException (that is not a ChildException) will not be caught by that catch clause because you cannot assign a NewException object to a ChildException variable. The rules are spelled out in section 14.20.1 of the Java Language Specification: If execution of the try block completes abruptly because of a throw of a value V, then there is a choice: If the run-time type of V is assignment compatible with (§5.2) a catchable exception class of any catch clause of the try statement, then the first (leftmost) such catch clause is selected. The value V is assigned to the parameter of the selected catch clause, and the Block of that catch clause is executed, and then there is a choice: If that block completes normally, then the try statement completes normally. If that block completes abruptly for any reason, then the try statement completes abruptly for the same reason. If the run-time type of V is not assignment compatible with a catchable exception class of any catch clause of the try statement, then the try statement completes abruptly because of a throw of the value V.
accepted answer of: http://stackoverflow.com/q/26104171
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/a/26036247
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26034599
upvote count: 1
has body: Open standalone.xml Go to &lt;subsystem xmlns="urn:jboss:domain:logging:1.0"&gt; &lt;console-handler name="CONSOLE" autoflush="true"&gt; &lt;level name="DEBUG"/&gt; Change level to ERROR from DEBUG

http://stackoverflow.com/comment/40916004
has text: It is a file about 100Kb, that should be quite quick
comment on: http://stackoverflow.com/q/26107987
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41066925
type: Comment
comment on: http://stackoverflow.com/a/26189859
has text: I can view my applet in the appletviewer but when I try to load the webpage, it says classnotfoundexception, and then the name of my applet class.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41018887
has text: Then to get the KeyAdapter to call the si() method, you will have to add a setter method to the anonymous KeyAdapter that will take your new inner class CaretListener.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26151260
type: AnswerComment

http://stackoverflow.com/a/26202159
has body: The problem was the key. Perls LWP::Useragent needs also a key-file. But I need to add it not all within a PFX but all extra. If I did all was fine. Thanks anyway!
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26144361
answers question: http://stackoverflow.com/q/26144361
score: 0

http://stackoverflow.com/q/26094783
type: Question
has comment: http://stackoverflow.com/comment/40891612
score: 0
has comment: http://stackoverflow.com/comment/40892066
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40891936
has body: I have a little problem with my edittext fields, when you type in it, the whole field turns black when I type @ . - or any other symble. <TextView android:id="@+id/textViewEmail" android:layout_width="45dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" android:ems="10" android:gravity="top" android:text="@string/email" android:textColor="#000000" /> I did try to chage the input type to textEmail, but it is the same. My cell_shape looks like this <?xml version="1.0" encoding="utf-8"?> <solid android:color="#fff"/> <stroke android:width="1dp" android:color="#000"/> any ides? edit <?xml version="1.0" encoding="utf-8"?> <stroke android:width="1dp" android:color="#ffffff" />
answer count: 0
type: UnansweredQuestion
tagged with: android
has title: Edittext turns out to be black in color when I use special symbols like @
tagged with: java

http://stackoverflow.com/a/26138165
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40970162
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26138076
has body: If your goal is that all instances of Class2 would share the same instance of Class0, you can achieve it by making the c0 member of Class2 static. In that case, you'd initialize the c0 variable in a static initialization block instead of in the constructor. public class Class2 { private static Class0 c0; private Class3 c3; static { Class2.c0 = new Class0() { Class1 c1 = new Class1(); @Override public void abmethod1(){ System.out.println("Abstract method 1 called. Size is " + c1.getSize()); } @Override public void abmethod2(){ c1.add(1); c1.add(2); c1.add(3); System.out.println("Abstract method 2 called. Size is " + c1.getSize()); } }; } public Class2(){ this.c3 = new Class3(); c3.methodc2(c0); } } Whether all this makes sense is hard to say without knowing the purpose of your code.
answers question: http://stackoverflow.com/q/26138076

http://stackoverflow.com/q/26162883
tagged with: loops
has body: public static void main(String [] args) { Scanner input = new Scanner(System.in); double dblNumber, dblSquare, dblSqrt; String answer; String answery = "yes"; String answern = "no"; while (true) { System.out.println( "Welcome to Squarez! Where we do the math for you.\nPlease input a number you would like us to do some math with."); dblNumber = input.nextDouble(); dblSqrt = Math.sqrt(dblNumber); dblSquare = Math.pow(dblNumber, 3); System.out.println("" + dblSquare + " " + dblSqrt); System.out.println("Would you like to continue?"); answer = input.nextLine(); if (answer.equals(answery)) { System.out.println("You answered yes"); } if (answer.equals(answern)) { System.out.println("You answered no."); System.exit(0); } } } The program runs and completely ignores the prompt for asking the user if they want to continue. It goes straight back to the prompts for first number. Why is it skipping that?
type: Question
has answer: http://stackoverflow.com/a/26163521
score: 0
answer count: 3
type: UnansweredQuestion
has title: Java program asking user to continue
has answer: http://stackoverflow.com/a/26163107
tagged with: java
has answer: http://stackoverflow.com/a/26163025

http://stackoverflow.com/comment/40867895
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26081809
has text: The subsequent statements should not execute. Also, `return` in `finally` block can override previous exceptions.

http://stackoverflow.com/q/26054138
has answer: http://stackoverflow.com/a/26054932
score: 10
has comment: http://stackoverflow.com/comment/40817423
linked to: http://stackoverflow.com/q/26020872
type: Question
has comment: http://stackoverflow.com/comment/40840279
has title: Is the java.exe program the actual VM?
answer count: 3
upvote count: 10
tagged with: jvm
favorite count: 0
duplicate of: http://stackoverflow.com/q/26020872
has body: The JDK comes with the java.exe (for windows) program. You can use it to start programs from the command line. Wikipedia says it's the 'class loader', and 'an interpreter for class files'. Is this the actual full blown JVM? Is it a 'smaller, lightweight' JVM? Is it something else?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26054220
has answer: http://stackoverflow.com/a/26054178
downvote count: 0
tagged with: java

http://stackoverflow.com/q/26192821
has comment: http://stackoverflow.com/comment/41071358
has title: How to use Java generics to avoid casting?
has body: For the query, raised in link, Java generics is recommended to avoid difficulty in assessing run time type of an item. After using Java generics in the below code, I do not see the incompatible type errors unlike before. But a different compile time error at line 96 , DList1&lt;int&gt; l = new DList1&lt;int&gt;(); does not give any clue of the problem. Error message is: Syntax error on token 'int' /* DList1.java */ /** * A DList1 is a mutable doubly-linked list. (No sentinel, not * circularly linked.) */ public class DList1&lt;T&gt; { /** * head references the first node. * tail references the last node. * * DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS. */ protected DListNode1&lt;T&gt; head; protected DListNode1&lt;T&gt; tail; protected long size; /* DList1 invariants: * 1) head.prev == null. * 2) tail.next == null. * 3) For any DListNode1 x in a DList, if x.next == y and x.next != null, * then y.prev == x. * 4) For any DListNode1 x in a DList, if x.prev == y and x.prev != null, * then y.next == x. * 5) The tail can be accessed from the head by a sequence of "next" * references. * 6) size is the number of DListNode1s that can be accessed from the * head by a sequence of "next" references. */ /** * DList1() constructor for an empty DList1. */ public DList1() { this.head = null; this.tail = null; this.size = 0; } /** * insertFront() inserts an item at the front of a DList1. */ public void insertFront(T item) { if(this.head == null){ this.head = new DListNode1&lt;T&gt;(item); this.tail = this.head; }else{ DListNode1&lt;T&gt; newNode = new DListNode1&lt;T&gt;(item); newNode.next = this.head; this.head.prev = newNode; this.head = newNode; } this.size++; } /** * removeFront() removes the first item (and node) from a DList1. If the * list is empty, do nothing. */ public void removeFront() { if(this.size == 0){ return; }else if(size ==1){ this.head = null; this.tail = null; }else{ this.head.next.prev = null; this.head = this.head.next; } } /** * toString() returns a Strin…
score: 3
tagged with: generics
favorite count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/26192111
answer count: 1
has answer: http://stackoverflow.com/a/26192845
downvote count: 0

http://stackoverflow.com/a/26069221
type: Answer
has body: You are combining two different algorithms. One is to perform a/b+c/d=(a*d+b*c)/(bd). The other is to perform a/b+c/d=(a*(lcd(b,d)/b) + c*(lcd(b,d)/d))/lcd(b,d) numerator = numerator*d2+n2*denominator; denominator = denominator*d2; or int lcd = Fraction.getLCD(denominator, d2); numerator = numerator*(lcd/denominator)+n2*(lcd/d2); denominator = lcd; So in your example it would be: (1/8) + (16/64) = (1*64+16*8)/(8*64) = 192/512 = 3/8 or (1/8) + (16/64) = (1*(64/8) + 16*(64/64))/64 = 24/64 = 3/8
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26068982
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40845727
accepted answer of: http://stackoverflow.com/q/26068982

http://stackoverflow.com/a/26167334
has body: package net.rajkannan.stackoverflow; import java.util.*; public class InputSum { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out .print("Please enter integer values (-1 to to display numbers &amp; sum): "); int i = input.nextInt(); int j = 0; String numbers = ""; while (i != -1) { j += i; numbers = numbers + i + " "; i = input.nextInt(); } System.out.println("Entered Numbers: " + numbers); System.out.println("The Sum: " + j); } }
score: 0
answers question: http://stackoverflow.com/q/26167056
type: Answer

http://stackoverflow.com/q/26147127
answer count: 1
linked to: http://stackoverflow.com/q/13360430
has comment: http://stackoverflow.com/comment/40988589
has title: How to go back to my login screen?
tagged with: java
has comment: http://stackoverflow.com/comment/40988792
tagged with: jmenuitem
downvote count: 0
has comment: http://stackoverflow.com/comment/40988099
has answer: http://stackoverflow.com/a/26147678
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40987346
score: 1
favorite count: 0
tagged with: jmenubar
upvote count: 1
has body: My program is written in Java using Eclipse and what my program does is first you have to login your username and password to the server and once that is verified, then you go to a new page (frame) where I have a JMenuBar, JMenu, and JMenuItem. The JMenuItem that I am working on is called "Logout" under the JMenu Exit, when you click on logout at the moment, it closes the screen. What I want to happen is to redirect me back to the login page. I've tried many functions, but none of them worked. I would appreciate the help. Here is my program: public class ScanTest2 extends JFrame { /** * */ private static final long serialVersionUID = 1L; private static LoginDialog loginDialog; public ScanTest2() { loginDialog = new LoginDialog(this, true); loginDialog.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { // create new frame for new page JFrame frame = new ScanTest2(); //create a Menu bar JMenuBar menuBar = new JMenuBar(); frame.getContentPane().setBackground(Color.BLUE); try { frame.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("/home/a002384/logo2.bmp"))))); } catch (IOException e) { e.printStackTrace(); } frame.setTitle("Scan Gun Information"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // create Menus JMenu databaseMenu = new JMenu("Database"); JMenu ticketMenu = new JMenu("Tickets"); JMenu inquiriesMenu = new JMenu("Inquiries"); JMenu reportsMenu = new JMenu("Reports"); JMenu exitMenu = new JMenu("Exit"); // create Menu Items JMenuItem lotMenuItem = new JMenuItem("Lots"); lotMenuItem.setMnemonic(KeyEvent.VK_L); lotMenuItem.setActionCommand("Lots"); JMenuItem gunMenuItem = new JMenuItem("Guns"); gunMenuItem.setMnemonic(KeyEvent.VK_G); gunMenuItem.setActionCommand("Guns"); JMenuItem batteryMenuItem = new JMenuItem("Batteries"); batteryMenuItem.setMnemonic(KeyEvent.VK_B); batteryMenuItem.…
tagged with: jmenu
accepted answer: http://stackoverflow.com/a/26147678

http://stackoverflow.com/a/26101479
type: Answer
has body: got to Documents\NetBeansProjects\yourProjectName\build\classes\yourPackageName here you will see all your .class files that was generated after compilation and open them using any text editor. Note: the .class files might contain some binary data and you will see some strange symbols Note: an internal class will have the same name as its outer class but it will start with $ sign
score: 0
answers question: http://stackoverflow.com/q/26101202

http://stackoverflow.com/q/26076464
tagged with: junit
has body: Let's say I have a JUnit test like: Assert.assertTrue(complexResult.toString(), someMethod(in1, in2, complexResult) If the test fails, my message will be a complexResult string BEFORE the interesting part of the test that calls someMethod, not the string view of my complexResult after the test failed. Is there a better way than: if (!someMethod(in1, in2, complexResult)) { Assert.fail(complexResult.toString()); } ?
has answer: http://stackoverflow.com/a/26076509
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40857640
has answer: http://stackoverflow.com/a/26076510
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40857631
has title: Nice pattern for evaluating an assert message after a test fails
score: 0
answer count: 2

http://stackoverflow.com/q/26165587
accepted answer: http://stackoverflow.com/a/26166011
tagged with: semaphore
has answer: http://stackoverflow.com/a/26166011
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: mutex
tagged with: locking
answer count: 1
has body: I'm reading this tutorial at http://tutorials.jenkov.com/java-concurrency/semaphores.html And it's counting semaphore implementation is: public class CountingSemaphore { private int signals = 0; public synchronized void take() { this.signals++; this.notify(); } public synchronized void release() throws InterruptedException{ while(this.signals == 0) wait(); this.signals--; } } The code seems strange to me because from what I understand, semaphore records how much available resources there are, so we should decrease the count when we take() and increase the count when we release() (and of course start with a limit). Can anyone provide me with more insight in what's the difference between counting up and counting down approaches?
has title: Why in this code, the semaphore counts up instead of down?
has comment: http://stackoverflow.com/comment/41021436
tagged with: synchronization

http://stackoverflow.com/comment/41011932
score: 0
type: Comment
has text: I did compare the rezipped version with the original version. Everything seems to be okay except for the manifest.mf file. The manifest file seems to differ from the manifest file that came along with the original jar. Do you think it to be a concern?
comment on: http://stackoverflow.com/a/26137169
type: AnswerComment

http://stackoverflow.com/comment/41520578
comment on: http://stackoverflow.com/a/26405932
type: AnswerComment
score: 0
type: Comment
has text: Sorry for all these questions, but I want to learn :) Where is the JSOn body writer? Is it in-built in dropwizard?

spdy
tags question: http://stackoverflow.com/q/26143842
tag name: spdy
type: Tag

http://stackoverflow.com/comment/40899864
score: 0
type: Comment
has text: Awesome - it seemed to me that it would make sense to lock on whichever object would be accessed by multiple threads, but I understand your points. Will just creating a new `Object` work every time? While I'm still learning, it seems that the new object has no relation to the `List`.
comment on: http://stackoverflow.com/a/26099196
type: AnswerComment

http://stackoverflow.com/a/26193604
upvote count: 6
has body: An import declaration which ends with a package name and .* imports all public classes/interfaces/annotations of the package only and nothing else. If you need classes from the child package too, you have to import them separately. If an import declaration contains a specific class, only that class will be imported. If the import declaration contains a specific class plus .* (it's a static import, must be in the form of import static ...), then all static fields and methods will be imported from that class and nothing more. Usually only specific classes are imported. It decreases the chances of class name collisions (2 different classes with same name defined in 2 different packages). Also you are not required to import a class to use it, you can use a qualified name where every time you refer to that class, you always write full package name and class name.
answers question: http://stackoverflow.com/q/26193486
accepted answer of: http://stackoverflow.com/q/26193486
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6

http://stackoverflow.com/a/26134583
has comment: http://stackoverflow.com/comment/40967857
has body: Well, there's two potential problems: The ChartView is a custom component and it might not be working correctly with "wrap_content". The "wrap_content" directive relies on the widget being able to report its dimensions correctly, so there might be a problem there. Another issue is that the LinearLayout that you have below the cvChart has height set to "match_parent", which would make it overlap (and therefore occlude) the Chartview. Have you tried to change that to "wrap_content" and see if the chart appears?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26134482

http://stackoverflow.com/comment/41063304
comment on: http://stackoverflow.com/a/26187782
score: 0
type: Comment
has text: SOrry. Like this? : text1.setString(list.size().ToString());
type: AnswerComment

resteasy
tags question: http://stackoverflow.com/q/26114296
tags question: http://stackoverflow.com/q/26049308
tag name: resteasy
tags question: http://stackoverflow.com/q/26124919
tags question: http://stackoverflow.com/q/26102789
tags question: http://stackoverflow.com/q/26039920
tags question: http://stackoverflow.com/q/26140375
type: Tag
tags question: http://stackoverflow.com/q/26177848
tags question: http://stackoverflow.com/q/26094536
tags question: http://stackoverflow.com/q/26129843

http://stackoverflow.com/a/26153916
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Two possibilities : 1 - One of your dynamic pages is generating a bad URL and serves this URL to the clients who try to get the file from this bad URL. 2 - Someone who deliberately tries to DDoS your server by flooding him with bad requests. Your log may also contain useful information such IP address or clients and HTTP referer that may guide you in your quest for answer. The first option is more likely to be the good answer and can explain why your server performances are dropping and why the incriminated bad URL contain a duplicate part of themselves (something like a loop with a bad exit condition in one of your scripts ?)
answers question: http://stackoverflow.com/q/26153772

http://stackoverflow.com/a/26143113
type: Answer
accepted answer of: http://stackoverflow.com/q/26142280
answers question: http://stackoverflow.com/q/26142280
downvote count: 0
score: 1
has body: revalidate/repaint will do nothing. You need to actually create the new random icon and set the icons to the buttons again e.g @Override public void actionPerformed(ActionEvent e) { int random = (int)(Math.random()*55); b1.setIcon(new ImageIcon("image/card/"+random+".png")); random = (int)(Math.random()*55); b2.setIcon(new ImageIcon("image/card/"+random+".png")); random = (int)(Math.random()*55); b3.setIcon(new ImageIcon("image/card/"+random+".png")); random = (int)(Math.random()*55); b4.setIcon(new ImageIcon("image/card/"+random+".png")); } You will also need to declare the buttons as final, since you are accessing them locally from an anonymous class i.e final JButton b1 = new JButton(); As a side note, you constructor will become pretty large, as you application grows, if you continue to make all your objects locally. You may want to consider using some class members. Maybe create the buttons as class members. Then have a method reset() that will initialize the buttons with new random icons. For one, this will get rid of duplicate code, like in this case, where you're using two sets of code to do exactly the same thing. Instead just call the method. Once, in the constructor to first initialize them, then call it again in the reset listener Also Use Java naming convention. Class names begin with upper case letters. rest -> Rest
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26102191
downvote count: 0
answers question: http://stackoverflow.com/q/26101544
score: 3
accepted answer of: http://stackoverflow.com/q/26101544
type: AcceptedAnswer
has body: There are two basic types of pipe in UNIX/Linux: a named pipe and an anonymous one. An anonymous pipe is created by the "pipe()" system call, which returns 2 file descriptors associated with a newly created pipe, one for writing data, the other for reading from it. The shell uses anonymous pipes to connect the standard output of one process to the standard input of another when you connect two process with the "|" operator. A named pipe appears as a file in the file system, and can be opened with the normal "open()" system call. In blocking mode (the default), the process that reads from the pipe will block until data appears there; the writer can then send data which will appear as a byte stream to the reader. The important fact here is that the data that is transferred is a byte stream. The sender and receiver of the data must agree on a protocol to determine how to interpret the bytes. One typical method for this is serialization. Consider a 32 bit integer ... 4 bytes. Some systems store those bytes with the most significant bit in the first byte (known as big-endian), some store the least significant bit in the first byte (little-endian system, such as x86). When transmitting such data across a network, serialization of such data is important, since it is entirely possible that each end stores the data in a different order. But even when transmitting data between two processes on the same host, serialization helps. It can be used to encapsulate objects so that the receiver knows when it has received everything. For example, with our 32 bit integer, if the receiver doesn't know it is expecting an integer, and gets 3 bytes (the 4th having been delayed by some scheduling), it must know that it needs to wait before continuing. None of this is particular language specific, save that some languages have built in support for serialization. Java is one such language (see ObjectInputStream and ObjectOutputStream). If you are trying to move data between Java and C program…
upvote count: 3
type: Answer

http://stackoverflow.com/comment/40930421
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26109969
has text: Is this character `U+00A0` or byte `A0`? Also, post the code.
score: 0

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

http://stackoverflow.com/q/26095955
has comment: http://stackoverflow.com/comment/40893674
has comment: http://stackoverflow.com/comment/40893643
has comment: http://stackoverflow.com/comment/40894001
has answer: http://stackoverflow.com/a/26096470
answer count: 5
has answer: http://stackoverflow.com/a/26096040
has comment: http://stackoverflow.com/comment/40893775
has body: Why won't this program compile? It has 7 errors when I try to run it. I am trying to do this: Write a method called inputBirthday that accepts a Scanner for the console as a parameter and prompts the user to enter a month, day, and year of birth, then prints the birthdate in a suitable format. Here is an example dialogue with the user: On what day of the month were you born? 8 What is the name of the month in which you were born? May During what year were you born? 1981 You were born on May 8, 1981. You're mighty old! import java.util.*; public class Practice2 { public static void inputBirthday(int number, String sentence, int number2){ Scanner console = new Scanner(System.in); System.out.println("On what day of the month were you born?"); int number = console.nextInt(); System.out.println("What is the name of the month in which you were born?"); String sentence = console.nextString(); System.out.println("During what year where you born?"); int number2 = console.nextInt(); } public static void main(String[] args){ System.out.print("You were born on" + sentence + number + "," + number2 + ". You're might old!"); } }
has comment: http://stackoverflow.com/comment/40893601
has comment: http://stackoverflow.com/comment/40894059
has comment: http://stackoverflow.com/comment/40893666
has comment: http://stackoverflow.com/comment/40893693
has comment: http://stackoverflow.com/comment/40894148
upvote count: 2
score: -3
has title: Beginner Java- Why won't this compile?
type: Question
tagged with: parameters
has comment: http://stackoverflow.com/comment/40893717
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40893969
has answer: http://stackoverflow.com/a/26096074
has comment: http://stackoverflow.com/comment/40893908
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/40893790
tagged with: methods
has comment: http://stackoverflow.com/comment/40893743
has answer: http://stackoverflow.com/a/26096451
has comment: http://stackoverflow.com/comment/40893616
tagged with: string
has answer: http://stackoverflow.com/a/26096004
favorite count: 0
possible better answer: http://stackoverflow.com/a/26096470
tagged with: int
accepted answer: http://stackoverflow.com/a/26096074

http://stackoverflow.com/q/26186152
tagged with: cluster-computing
type: Question
tagged with: hazelcast
score: -1
has title: which strategy does Hazelcast used for load balancing RMI OR THREAD MIGRATION?
answer count: 1
tagged with: distributed-computing
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: multithreading
has body: I want to study Hazelcast's internal architecture for load balancing in cluster. Can somebody tell me the proper links? Does Hazelcast use RMI for load balancing ? if not then does it use Thread migration for load balancing? kindly guide me the strategy of load balancing used by HAZELCAST in cluster environment.
has answer: http://stackoverflow.com/a/26222580
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26083654
has comment: http://stackoverflow.com/comment/40871932
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40870898
has title: Spring MVC - race conditions?
has body: Suppose I have the following Spring MVC controller @RestController @RequestMapping("/books") public class BooksController { @Autowired private final BooksRepository booksRepository; @RequestMapping(value="/search", method=RequestMethod.POST, consumes="application/json") public Collection&lt;Book&gt; doSearch(@RequestBody final SearchCriteria criteria) { return booksRepository.find(criteria); } } and the following repository @Service public class BooksRepository { @Autowired private final JdbcTemplate jdbcTemplate; @Autowired private final SearchQueryBuilder searchQueryBuilder; public Collection&lt;BookLite&gt; find(final SearchCriteria criteria) { // TODO: will this cause race conditions? searchQueryBuilder.clear().addKeywords(criteria.getKeywords()); final String query = searchQueryBuilder.buildQuery(); final Object[] params = searchQueryBuilder.buildParams(); return jdbcTemplate.query(query, params, new BookExtractor()); } } with the following SearchQueryBuilder implementation @Component public class SearchQueryBuilder { private final List&lt;String&gt; keywords = new LinkedList&lt;String&gt;(); public SearchQueryBuilder clear() { keywords.clear(); return this; } public SearchQueryBuilder addKeywords(final List&lt;String&gt; keywords) { for (String keyword : keywords) { add(keyword); } return this; } private SearchQueryBuilder add(final String keyword) { keywords.add(keyword); return this; } public String buildQuery() { ... } public Object[] buildParams() { ... } } My concerns are the following. Since the SearchQueryBuilder class is not thread safe, injecting it this way will probably cause race conditions. What is a good way to handle this? Is it enough (and a good practice) to change the bean scope to e.g. request?
has comment: http://stackoverflow.com/comment/40891529
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26083911
has comment: http://stackoverflow.com/comment/40871270
has comment: http://stackoverflow.com/comment/40871959
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40871532
has comment: http://stackoverflow.com/comment/40871475
type: Question
has comment: http://stackoverflow.com/comment/40870923
tagged with: spring
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/comment/111289969
type: Comment
has text: Was it a kind of appreciation? Even some of my questions never got any answer yet!
comment on: http://stackoverflow.com/a/26169594
score: 0
type: AnswerComment

http://stackoverflow.com/comment/82673269
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26152154
type: AnswerComment
has text: @MoGa I was young, foolish and in love. Who can blame me for such folly? (thanks - code corrected)

http://stackoverflow.com/comment/40915507
score: 0
type: Comment
has text: Changing the result of `compareTo` does nothing without a caller. The result is interpreted by the caller, and it's documented in the [Comparator](http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html) javadoc.
type: QuestionComment
comment on: http://stackoverflow.com/q/26107921

http://stackoverflow.com/comment/41023494
type: AnswerComment
has text: There are quite a few mistakes in this code. One of the big ones is that you are comparing apples and oranges. For instance, the first time you collect is (after = System.currentTimeMillis() - before). The remaining times you calculate time is (after = System.currentTimeMillis() - after) which includes printing stuff out. If you fix that, the substring method is 5 times faster on my machine. Also you never create the object stringBuilders. Not to mention, before and after do not have types. Plus, it is generally good to run each test 5 or 10 times so you can see the outliers.
type: Comment
comment on: http://stackoverflow.com/a/26159501
score: 1

http://stackoverflow.com/a/26185501
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26185193
has body: Simply transforming your Long to string doesn't work because Lucene uses a special encoding for numeric types. As such, you should use a query. A NumericRangeQuery specifically. Something like: Query query = NumericRangeQuery.newLongRange(Book.ID, item.getISBN(), item.getISBN(), true, true) writer.deleteDocuments(query); For a point of interest, in order to delete using terms, instead of a query, you would need to transform the numbers to lucene's prefix-coded string representation, using NumericUtils, something like: BytesRefBuilder bytes = new BytesRefBuilder(); NumericUtils.longToPrefixCoded(item.getISBN(), 0, bytes); Term term = new Term(Book.ID, bytes.toBytesRef()); writer.deleteDocuments(term); You generally shouldn't do that though. NumericUtils is really only intended for internal use. But perhaps it does elucidate why simple to-string approaches don't work.
type: Answer
has comment: http://stackoverflow.com/comment/41058878
downvote count: 0

http://stackoverflow.com/comment/40784051
has text: actually one iteration should be enough and using `get` `set` of the `List` interface.
comment on: http://stackoverflow.com/a/26036458
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26132862
tagged with: android-uiautomator
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/26209728
has body: I need to set an alarm in Google's clock using UiAutomator, but UiAutomatorViewer does not retrieve information about the circle. Another solution could be using the ativity parameters, but I google it and I did not find that info.
has title: How to set an Alarm using UiAutomator for google's clock?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26182115
answer count: 2
has body: I cant find how to remove the errors in the code below package com.example.hellocodelearn; import java.util.ArrayList; import java.util.List; import android.app.ListActivity; import android.support.v7.app.ActionBarActivity; 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.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import com.example.hellocodelearn.models.Notes; public class NotesListActivity extends ListActivity { private ArrayAdapter NotesItemArrayAdapter ; private List&lt;Notes&gt; notes = new ArrayList&lt;Notes&gt;() ; for ( int i = 0; i &lt; 20; i++ ) { Notes tweet = new Notes(); tweet.setTitle("A nice header for Tweet # " +i); tweet.setBody("Some random body text for the tweet # " +i); notes.add(tweet); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notes_list); NotesItemArrayAdapter = new NotesAdapter(this, new String[10]); setListAdapter(NotesItemArrayAdapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { Intent intent = new Intent(this, NotesDetailActivity.class); startActivity(intent); } } I get errors : Description Resource Path Location Type Syntax error on token ",", ; expected NotesListActivity.java /HelloCodeLearn/src/com/example/hellocodelearn line 47 Java Problem Pleas help.Thanks.
has answer: http://stackoverflow.com/a/26182192
score: 0
tagged with: android
type: UnansweredQuestion
has title: Error in Compiling Java code
tagged with: java
has answer: http://stackoverflow.com/a/26182188
type: Question
tagged with: debugging

http://stackoverflow.com/q/26128341
has comment: http://stackoverflow.com/comment/40952246
score: -1
tagged with: int
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26128417
tagged with: java
has title: Why isn't my return working for hailstone?
upvote count: 1
has comment: http://stackoverflow.com/comment/40952221
type: Question
has body: String hailstone(int n){ if(n &gt;= 1) if(n%2 == 0) n = (n/2); else n = (n*3)+1; else return n; } I know it needs to return a string and I tried Integer.toString(n) but this didn't work so I don't know what to do.

http://stackoverflow.com/q/26122051
favorite count: 0
accepted answer: http://stackoverflow.com/a/26122398
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40940190
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40940400
has comment: http://stackoverflow.com/comment/40940366
tagged with: java
has body: I am still getting an out of bounds error and I don't know why. I added a print statement to see what the firstList and secondList actually is and it is all messed up I will post the output below so maybe someone can see what is going wrong. output: Names before sorting: [Justin, Butch, Mandy, Sarah, Jack, Natalie, Brent, Ashley] [Justin, null, null, null] [Justin, Butch, null, null] [Justin, Butch, Mandy, null] [Justin, Butch, Mandy, Sarah] [Natalie, null, null, null] [Natalie, Natalie, null, null] [Natalie, Natalie, Natalie, null] [Natalie, Natalie, Natalie, Natalie] [Justin, null] [Justin, Butch] [Sarah, null] [Sarah, Sarah] [Justin] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at MergeSorter.sort(MergeSorter.java:22) at MergeSorter.sort(MergeSorter.java:25) at MergeSorter.sort(MergeSorter.java:25) at MergeSorter.main(MergeSorter.java:68) As you can see, the array is all messed up and I don't know why, please help! import java.util.*; public class MergeSorter { public static void sort(String[] names) { if (names.length &lt;= 1) { return; } String[] firstList = new String[names.length / 2]; String[] secondList = new String[names.length - firstList.length]; for (int i = 0; i &lt; firstList.length; i++) { firstList[i] = names[i]; System.out.println(Arrays.toString(firstList)); } for (int i = 0; i &lt; secondList.length; i++) { secondList[i] = names[firstList.length + 1]; System.out.println(Arrays.toString(secondList)); } sort(firstList); sort(secondList); merge(firstList, secondList, names); } private static void merge(String[] firstList, String[] secondList, String[] names) { int first = 0; int second = 0; int names1 = 0; while (first &lt; firstList.length &amp;&amp; second &lt; secondList.length) { if (firstList[first].compareTo(secondList[second]) &lt; 0) { names[names1] = firstList[first]; first++; } else { names[names1] = secondList[second]; second++; } names1++; } while(first &lt; firstList.length) { names[names1] = firstList[first]; …
type: Question
has comment: http://stackoverflow.com/comment/40940455
has comment: http://stackoverflow.com/comment/40940265
answer count: 2
has answer: http://stackoverflow.com/a/26122398
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/26122176
possible better answer: http://stackoverflow.com/a/26122176
has title: Having problems with an Array

http://stackoverflow.com/comment/40789695
has text: `why is my activity destroyed and not just paused ?` because OS decide to kill the app(lack of resouces, PMS, etc..., don't bother why) ... `If it is destroyed why my app won't ...` becuase system is "remeber" last activity that you use in your app and back to it `If only the latest Activity is Destroyed and not the whole app...` you are right about it ... conclusion: whole app was killed ...
comment on: http://stackoverflow.com/q/26039047
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40897459
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26096415
has text: @Hamish258 http://java-sl.com/tip_multiple_floatable_toolbars.html this also could be useful. You can do the same on LayoutManager level

http://stackoverflow.com/q/26122344
accepted answer: http://stackoverflow.com/a/41218387
type: Question
answer count: 1
downvote count: 0
tagged with: inheritance
tagged with: persistence
favorite count: 0
has body: I have a base (abstract) class A and two subclasses B and C which I want to persist them using table-per-hierarchy approach in Hibernate. Suppose B has 'width' and C has 'height' field which are of the same type. By default Hibernate creates two separate columns but fills only one column for each row. Now, what happens if I map both fields to the same column in DB, say 'length'? @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.INTEGER) public abstract class A { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Integer id; } @Entity @DiscriminatorValue("1") public class B extends A { @Column(name="length") public Integer width; } @Entity @DiscriminatorValue("2") public class C extends A { @Column(name="length") public Integer height; } I ran some basic tests and no error happened, but I didn't see anything like this in documentations -considering this practice prevents creation of lots of empty columns in a complex application and should be mentioned - and really don't have the expertise to declare this as a safe practice. Has anyone done something like this? Are there any drawbacks to this approach? Also does the no-NOT-NULL-on-subclasses limitation holds in this scenario?
has answer: http://stackoverflow.com/a/41218387
score: 2
upvote count: 2
has title: Mapping same DB column to different fields/properties of subclasses in Hibernate when using table per hierarchy
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/41056202
score: 2
comment on: http://stackoverflow.com/a/26177281
type: AnswerComment
has text: You are right. Seems as though jpa is inconsistent. When there's only one statement there should not be a semi-colon at the end.
type: Comment

http://stackoverflow.com/q/26042901
type: UnansweredQuestion
tagged with: java
has body: I have a java web app running in Windows enviroment and I want to move it to Ubuntu system. In windows I use an environment variable to store the main path: MAIN_PATH=C:\test This variable is used in many configuration files and also by application, for example: Apache and Tomcat configuration file Application logging configuration (log4j) Java application itself by System.getEnv(...) examples: tomcat config &lt;Host name="localhost" appBase="${MAIN_PATH}/webapps" unpackWARs="true" autoDeploy="true"&gt; apache virtualhost &lt;VirtualHost *:80&gt; DocumentRoot "${MAIN_PATH}/www" ServerName testmain &lt;Directory "${MAIN_PATH}/www"&gt; ... I can not find some way to set it in ubuntu, I tried this places: /etc/enviroment /etc/profile export MAIN_PATH=/opt/test in /etc/init.d/tomcat7.sh All this solution didn't work or works just in one of my requirements (only in server configuration but not in application or vice versa). Is nothing like windows global environment variable to use for all this cases?
type: Question
answer count: 2
tagged with: environment-variables
tagged with: apache
tagged with: ubuntu
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/26078373
has answer: http://stackoverflow.com/a/26043256
has title: Environment variables in Ubuntu Tomcat, Apache and Java

http://stackoverflow.com/a/26168523
score: 3
has body: The problem is the first scanner nextInt() entry. You enter this data by entering a number and pressing enter. But the nextInt just reads the integer and the return carriage still remains on the input. When the code proceeds the next scanner nextLine() method will read that return carriage immediatly as it is still pending on the input. Leaving the firstname empty during the process. To avoid this you could do a call to nextLine() before the loop. You could also avoid this by always using nextLine() and parsing the resulting string to an integer in the first question.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41026688
has comment: http://stackoverflow.com/comment/41026784
type: Answer
answers question: http://stackoverflow.com/q/26168393
accepted answer of: http://stackoverflow.com/q/26168393
upvote count: 3

http://stackoverflow.com/comment/40932488
comment on: http://stackoverflow.com/q/26114938
score: 0
has text: @Smar It is ``qtjambi-linux64-gcc-4.7.0.jar``.
type: Comment
type: QuestionComment

collision-detection
tags question: http://stackoverflow.com/q/26108352
type: Tag
tags question: http://stackoverflow.com/q/26136721
tag name: collision-detection
tags question: http://stackoverflow.com/q/26108627
tags question: http://stackoverflow.com/q/26037759

http://stackoverflow.com/q/26147971
upvote count: 4
tagged with: aspectj
has body: I am looking to create around advice on methods with a specific return type. I'm curious if something like that is possible. I have this method for example: @Around("execution(* com.mytest.example.*Resource.*(..))") public Object restCallMade(ProceedingJoinPoint pjp) { Response response = null; try { response = (Response) pjp.proceed(); // Do other stuff } catch (Throwable e) { } return response; } However, if possible I would like that this advice only gets called if the return type of the method is Response. Is that possible?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-aop
has title: Specific return type on AspectJ around call
accepted answer: http://stackoverflow.com/a/26151806
score: 4
type: AnsweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26151806

http://stackoverflow.com/a/26116586
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26109380
answers question: http://stackoverflow.com/q/26109380
type: Answer
score: 1
downvote count: 0
has body: You can get all the parameters by their name as request.getParameters("firstname") to get the value of the input fields. public class ServletClass extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String firstName = request.getParameter("firstname"); String lastName = request.getParameter("lastName"); // and so on..... } }

http://stackoverflow.com/comment/40875969
comment on: http://stackoverflow.com/a/26086039
score: 0
type: AnswerComment
type: Comment
has text: Thanks, CamelCase is already corrected. I'd like to have somethig like this: `public Abcd(OilShip oship){ this.ship = oship; }` Or something like that. Is that impossible?

http://stackoverflow.com/q/26037076
score: 0
has title: Calculate a point from latitude and longitude with a distance
upvote count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: gps
tagged with: java
has comment: http://stackoverflow.com/comment/40785104
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26037144
tagged with: latitude-longitude
accepted answer: http://stackoverflow.com/a/26037144
has body: I am trying to calculate a point from a latitude and longitude location and a distance and bearing, but I am mixing up my maths, and probably messing up the units. Is there anybody who can help? This is my code: public static double[] distFromPointWithDistance(float lat1Deg, float lng1Deg, float d, float brngDeg) { double lat1 = Math.toRadians(lat1Deg); double lng1 = Math.toRadians(lng1Deg); double brng = Math.toRadians(brngDeg); double R = 6371; //kilometers double lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) ); double lng2 = lng1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2)); double[] result = new double[2]; result[0] = lat2; result[1] = lng2; return result; } For lat1Deg: 41.884344 For lng1Deg: 12.479627 For dist: 1 For brngDeg: 90. What I would expect is 41°53′04″N, 012°29′30″E, but I get something completely different, lat2 = 0.73101. Any pointers are appreciated! [edit]: I added the conversion, but still get very strange results

http://stackoverflow.com/comment/40942075
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26122965
score: 0
has text: `get(int)` is for getting a specific index of an element in the arraylist. `get(0)` gets the first element.

http://stackoverflow.com/q/26168369
linked to: http://stackoverflow.com/q/25635636
has comment: http://stackoverflow.com/comment/41033376
has comment: http://stackoverflow.com/comment/41033324
tagged with: imageicon
has answer: http://stackoverflow.com/a/26169520
linked to: http://stackoverflow.com/q/9864267
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/41034410
tagged with: embedded-resource
linked to: http://stackoverflow.com/q/17912041
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41033349
has comment: http://stackoverflow.com/comment/41026272
has comment: http://stackoverflow.com/comment/41033395
has comment: http://stackoverflow.com/comment/41064896
accepted answer: http://stackoverflow.com/a/26169520
tagged with: java
has comment: http://stackoverflow.com/comment/41027496
has comment: http://stackoverflow.com/comment/41033425
has title: Image is not being displayed with setIcon()
has body: I have the following code in my program: JLabel status = new JLabel(); status.setBorder(BorderFactory.createLineBorder(Color.BLACK)); status.setBounds(400, 30, 380, 200); status.setIcon(new ImageIcon("C:........./logo2.png")); status.setLocation(50, 750); add(status); But now I want to remove the path from setIcon(new ImageIcon("path")) to an image that I have inside a folder in my project. I tried to do this: status.setIcon(new ImageIcon("src/folder/logo2.png")); But it didn't display anything. I find this topic and tried this too: ImageIcon(this.getClass().getResource("src/files/logo2.png")); But it gives me a NullPointer. This is the structure of my project: How can I display this image correctly?
has comment: http://stackoverflow.com/comment/41026579
score: 0
has comment: http://stackoverflow.com/comment/41026456
linked to: http://stackoverflow.com/q/5621338
answer count: 1

http://stackoverflow.com/q/26100587
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26120953
has comment: http://stackoverflow.com/comment/40902092
has answer: http://stackoverflow.com/a/26100700
has title: Mapping all request parameters into a class object
has comment: http://stackoverflow.com/comment/40902228
has comment: http://stackoverflow.com/comment/40907460
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/38878378
answer count: 3
has comment: http://stackoverflow.com/comment/40902262
downvote count: 0
has comment: http://stackoverflow.com/comment/40901632
has body: Long story short, I'm trying to map all the parameters that are being sent as part of the request to a custom class. custom.class public class data { private String a; private String b; public String GetA() { return this.a; } public String SetA(String a) { this.a = a; } public String GetB() { return this.a; } public String SetB(String b) { this.b = b; } } now I can access the parameters like this: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getParameter("a"); request.getParameter("b"); } But as I mentioned above , I would like all the parameters to be loaded to the class object. I think the best way would be converting the parameters into a map object and then somehow evaluate the class object with all the values we retrieve from the map object. However I have no idea how to make this happen. So I'd really appreciate if someone could point me to a documentation or advise me as how could this be done? Apologies for my bad english. Thanks in advance, Alex

http://stackoverflow.com/q/26104058
accepted answer: http://stackoverflow.com/a/26104573
tagged with: java
score: 0
answer count: 1
tagged with: bouncycastle
has body: this is my first Questing here and i didn't found any solutions to my Problem. Please don't take it amiss, if my text is broken English. For my program I want to resize images inside an existing PDF-Document. This should happens automatically within a Java program. During my search, I found the Ghost4j Library in the web, which can solve my problem - maybe! As a first test with Ghost4j to tryout if it works, I want to load my PDF Document out of the MySQL Database and check out the pageCount. Here ist my short code: ... for (File file : convertableFiles) { InputStream inputStream = new ByteArrayInputStream(file.getFile()); PDFDocument doc = new PDFDocument(); doc.load(inputStream); System.out.println(doc.getPageCount()); } ... The error comes at line 45 = doc.load(inputStream) (Note: if I use new File(Path) for doc.load and set a pdfSample Document. It works. But not with inputStream) When I execute my programm i'll get everytime this Excption: Sep 29, 2014 4:54:53 PM ch.carauktion.dbresize.DBFileResizer convert INFORMATION: P1 (asc): 0 / 1 Sep 29, 2014 4:54:54 PM ch.carauktion.dbresize.DBFileResizer run SCHWERWIEGEND: P1 (asc): Exception java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString at com.lowagie.text.pdf.PdfEncryption.&lt;init&gt;(Unknown Source) at com.lowagie.text.pdf.PdfReader.readDecryptedDocObj(Unknown Source) at com.lowagie.text.pdf.PdfReader.readDocObj(Unknown Source) at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source) at com.lowagie.text.pdf.PdfReader.&lt;init&gt;(Unknown Source) at com.lowagie.text.pdf.PdfReader.&lt;init&gt;(Unknown Source) at org.ghost4j.document.PDFDocument.load(PDFDocument.java:45) at ch.carauktion.dbresize.pdf.DBPdfResizer.convertFiles(DBPdfResizer.java:50) at ch.carauktion.dbresize.DBFileResizer.convert(DBFileResizer.java:114) at ch.carauktion.dbresize.DBFileResizer.run(DBFileResizer.java:59) Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1OctetString at java.net.URLClassLoader$1.…
tagged with: pdf-conversion
has title: Getting NoClassDefFoundError by using Ghost4j
type: AnsweredQuestion
tagged with: itext
type: Question
tagged with: ghost4j
has answer: http://stackoverflow.com/a/26104573

http://stackoverflow.com/comment/40986203
has text: @gstackoverflow I have removed the word 'thus', and made a sentence tweak to make it clearer.
comment on: http://stackoverflow.com/a/26141039
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26107776
answers question: http://stackoverflow.com/q/26107608
downvote count: 0
has comment: http://stackoverflow.com/comment/40915234
has body: Assuming performance is not a big issue I would do public String format(String template) { return template.replaceAll ("%%", "\uffff") .replaceAll("%t", ""+inSeconds()) .replaceAll("\uffff", "%"); }
has comment: http://stackoverflow.com/comment/40926572
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/41284788
type: QuestionComment
comment on: http://stackoverflow.com/q/26168069
has text: @KalpeshSoni Composite key (cust_id, which is a FK and another field called address type).
score: 0
type: Comment

http://stackoverflow.com/q/26134765
has comment: http://stackoverflow.com/comment/40963900
has comment: http://stackoverflow.com/comment/40963855
has comment: http://stackoverflow.com/comment/40963995
tagged with: java
has comment: http://stackoverflow.com/comment/40963958
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/40963876
type: Question
has body: I have this Java file that takes in two ints from the user and it prints out the sum of the numbers, this file is called JavaAdd.java . To test this file, I would need to make a file that can contain possible testing numbers, called JavaAddTest. When I create a the JavaAddTest, the first line looks like: 2 2 and when I run the script: java JavaAdd &lt; JavaAddTest I get the output to the console: Please input 2 ints: The sum of the 2 values are: 4 which is what I want. But I want to be able to populate JavaAddTest with a set of numbers like: 2 2 0 2 -2 -2 10 10 and be able to get an output like: Please input 2 ints: The sum of the 2 values are: 4 Please input 2 ints: The sum of the 2 values are: 2 Please input 2 ints: The sum of the 2 values are: -4 Please input 2 ints: The sum of the 2 values are: 20 Hoe can I do this in a linux environment? What would I have to do the JavaAddTest in order for it to be able to read all of my inputs?
tagged with: testing
has title: Reading a file with input values and making a .out with the results
score: 0
tagged with: linux
answer count: 1
has answer: http://stackoverflow.com/a/26134885
type: UnansweredQuestion

http://stackoverflow.com/comment/41286748
type: QuestionComment
comment on: http://stackoverflow.com/q/26121610
has text: Also, the code you give does not compile (e.g., `Sprite` is not declared as a class).
score: 1
type: Comment

http://stackoverflow.com/q/26166103
type: Question
has answer: http://stackoverflow.com/a/26166936
has title: relaunch an Activity after notification
score: 0
tagged with: notifications
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I Have an Activity A, it launch Activity B, and B launch a Service S. at this point if i am in B and touch HOME BUTTON and then start again the app shows me Activity B. Thats OK. The problem is when Service S launch a Notification, if I open the notification, and then press BACK BUTTON or use finish(), if I start app again shows me Activity A, and it not ok, i want to see Activity B. Another solucion that im trying to find is that notificacion sends me directly to Activity B after press it. Thanks!!
tagged with: java

http://stackoverflow.com/q/26187465
has body: I'm trying to expose a service that needs authentication, but I want to make it transparent to the client The route looks like this: client sends a POST camel calls the WS using config parameters and gets the authentication token camel calls the WS using client's POST data and the token I thought "enrich" was the answer but it will route the initial POST to the enricher endpoint. Is there a way to get the token and put it as a header of the message?
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41134396
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Get an authentication token while routing in camel
tagged with: web-services
has comment: http://stackoverflow.com/comment/41170777
score: 1
tagged with: java
tagged with: authentication
tagged with: apache-camel

http://stackoverflow.com/q/26055611
tagged with: keycode
score: 0
tagged with: key-events
answer count: 1
accepted answer: http://stackoverflow.com/a/26057094
has title: How can i get unique key code for character key
type: AnsweredQuestion
has body: The default listner has only character value for character keys, and code for all of them is VK_UNDEFINED, but this make difference between characters and system keys processing. How to handle all keys with one method, independently of its type? This is a problem, because I try to save key in a text file, so I need to check if there is a code or a character to parse this file back.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26057094

http://stackoverflow.com/comment/40971723
type: QuestionComment
has text: Sorry i didnt mention this. I am getting this during compile time in Android studio.
score: 0
comment on: http://stackoverflow.com/q/26139115
type: Comment

http://stackoverflow.com/comment/60582540
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26040811
has text: @TobiasSchulte I've seen that one before. I think you need to cast with the closure with `as Callable`
score: 0

http://stackoverflow.com/q/26050097
downvote count: 0
has body: I'm trying to compile an App utilising a separate App as a dependency but when I compile referencing modules from this library I see several "error:package does not exist" and "error:cannot find symbol class" messages from graddle. The following are my two build files. apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { minSdkVersion 11 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } packagingOptions { exclude 'AndroidManifest.xml' exclude 'resources.arsc' exclude 'classes.dex' } } dependencies { repositories { mavenCentral() } compile 'com.android.support:support-v4:+' compile 'com.google.code.gson:gson:2.2.2' compile 'com.google.android.gms:play-services:+' compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' compile 'com.android.support:support-v4:+' compile 'com.readystatesoftware.systembartint:systembartint:1.0.3' compile 'se.emilsjolander:stickylistheaders:2.+' compile 'com.googlecode.libphonenumber:libphonenumber:+' compile files('libs/crashlytics.jar') compile files('libs/httpclient-4.2.3.jar') compile files('libs/libphonenumber-5.9.jar') compile files('libs/mobileservices-0.2.0-javadoc.jar') compile files('libs/mobileservices-0.2.0.jar') compile files('libs/stringtotime-1.0.4.jar') compile files('libs/urbanairship-lib-2.0.2.jar') compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+' compile files('libs/FlurryAnalytics-4.0.0.jar') compile 'com.squareup.picasso:picasso:2.3.3' compile project(':wheel') } Dependency gradle: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId "kankan.wheel" minSdkVersion 5 targetSdkVersion 7 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } Can anyone help/experienced this before? Android Studio does not highlight any issues…
favorite count: 0
score: 8
tagged with: android-studio
has title: Package does not exist when using separate App as a dependency
upvote count: 8
answer count: 5
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26050273
has answer: http://stackoverflow.com/a/26050245
tagged with: java
has answer: http://stackoverflow.com/a/26071444
possible better answer: http://stackoverflow.com/a/38815242
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/38815242
has answer: http://stackoverflow.com/a/28531277
has answer: http://stackoverflow.com/a/26050273

http://stackoverflow.com/a/26211807
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26083994
answers question: http://stackoverflow.com/q/26083994
has body: In JsonIdentityInfo parameter generator need a class as a value. @JsonIdentityInfo(generator = ObjectIdGenerators.None.class, property = "@id") ... import com.fasterxml.jackson.annotation.ObjectIdGenerators; @Entity @JsonIdentityInfo(generator = ObjectIdGenerators.None.class, property = "@id") @Table(name = "t_user") public class User implements Serializable { ...

http://stackoverflow.com/q/26050143
tagged with: encoding
has comment: http://stackoverflow.com/comment/40829088
tagged with: character-encoding
has answer: http://stackoverflow.com/a/27297807
has body: In Java, I am polling a WebSphere MQ message queue, expecting a message of `STRING format, that is composed entirely of XML. Part of this XML will contain bytes to a file attachment (any format: pdf, image, etc) which will then be converted to a blob for storage in an Oracle Db and later retrieval. The issue I am having is that the known size of example files being sent over end up in my Db with a different size. I am not adding anything to the bytes (as far as I know), and the size appears to be larger directly after I get the message. I cannot determine if I am somehow adding information at retrieve, conversion from bytes -> String, or if this is happening on the front end when the sender populates the message. My code at retrieve of the message: inboundmsg = new MQMessage(); inboundmsg = getMQMsg(FrontIncomingQueue, gmo); strLen = inboundmsg.getMessageLength(); strData = new byte[strLen]; ibm_id = inboundmsg.messageId; inboundmsg.readFully(strData); inboundmsgContents = new String(strData); I see a file known to have size 21K go to 28K. A coworker has suggested that charset/encoding may be the issue. I do not specify a charset in the constructor call to String above, nor in any of the calls to getBytes when converting back from a string (for other unrelated uses). My default charset is ISO-8859-1. When speaking with the vendor who is initiating the message transfer, I asked her what charset she is using. Her reply: "I am using the File.WriteAllBytes method in C# - I pass it the path of my file and it writes it to a byte[]. I could not find any documentation on the MSDN about what encoding the function uses. The method creates a byte array and from what I have read online this morning there is no encoding, its just a sequence of 8bit unsigned binary data with no encoding." Another coworker has suggested that perhaps the MQ charset is the culprit, but my reading of the documentation suggests that MQ charset only affects the behavior of readString, readLine, &amp; w…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40829449
has title: Byte length difference when retrieving from WebSphere MQ Message
favorite count: 0
tagged with: ibm-mq
tagged with: byte
accepted answer: http://stackoverflow.com/a/27297807
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40815621
has comment: http://stackoverflow.com/comment/40829318
type: Question

http://stackoverflow.com/comment/40918560
type: QuestionComment
has text: Unless you provide a detailed context for your question, it has good chances to be closed rather quickly.
score: 0
comment on: http://stackoverflow.com/q/26109678
type: Comment

http://stackoverflow.com/comment/40851531
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26072732
has text: As a note, don't use `new Integer`. Use `Integer.valueOf()` instead if you really need the wrapper class--and here, it's cheaper and simpler to just use an `int`.
type: Comment

http://stackoverflow.com/q/26119715
tagged with: speech-recognition
favorite count: 0
type: AnsweredQuestion
tagged with: java
tagged with: speech
tagged with: sphinx4
type: Question
linked to: http://stackoverflow.com/q/33786658
has title: How to add custom grammar in Sphinx4 for speech recognition in Java?
score: 0
has answer: http://stackoverflow.com/a/26962486
accepted answer: http://stackoverflow.com/a/26962486
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40937579
has body: I am using sphinx4 1.0 beta 6 to make a voice recognizer in Java. In sphinx4 there is demo sample called HelloWorld. That demo runs well without any problem. But it recognize only few words. I have to change its hello.gram file. If I add some extra words in that grammar file it doesn't work for those word. How can I add my own grammar file and load in HelloWorld sample? I have studied a lot on JSGFGrammar. But I couldn't understand. I am using Netbeans IDE.

http://stackoverflow.com/comment/40803390
type: Comment
comment on: http://stackoverflow.com/a/26044542
has text: @Kurter21 I added some prints that could help you achieve that
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40889963
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26093352
has text: No was i asked is whether both lib compactibile with each other and it is not. I tried it out. ANd made the change and corrected the compile errors. Now im getting runtime errors. Here is the error: org.json.JSONException: JSONObject["test"] not a string. at org.json.JSONObject.getString(JSONObject.java:644) at com.command.Main.main(Main.java:34) This is shooting at "if(object.getString("test") != null){" line. What should i do?

http://stackoverflow.com/comment/40965769
has text: @PeterLawrey that was my point.. thx for the beautiful answer btw. +1
type: AnswerComment
comment on: http://stackoverflow.com/a/26120449
score: 0
type: Comment

http://stackoverflow.com/comment/40934854
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/26119232
has text: `intersection(Multiset<E> multiset1, Multiset<?> multiset2)`, details [here](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multisets.html) for Guava Multiset

http://stackoverflow.com/q/26165020
has answer: http://stackoverflow.com/a/26165073
score: -3
has answer: http://stackoverflow.com/a/26166576
answer count: 4
has title: print gender in java from this link list?
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/26165091
has comment: http://stackoverflow.com/comment/41020288
has body: public class Main { public static void main(String[] args) { LinkedList&lt;User&gt; list=new LinkedList&lt;User&gt;(); list.add(new User(1, "Haidar Ali", "male", true)); list.add(new User(2, "Mehmood Usmani", "male", false)); list.add(new User(3, "Ayesha Abbasi", "female", true)); list.add(new User(4,"Nilofur","female",true)); } } (how can i write the code which print the male gender or female gender form mix list code above)
has answer: http://stackoverflow.com/a/26165114
upvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26188678
linked to: http://stackoverflow.com/q/5297096
has comment: http://stackoverflow.com/comment/41064541
score: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/5297096
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41064567
has comment: http://stackoverflow.com/comment/41064559
has title: Get the name of the caller before programmatically ending the call
tagged with: android
has body: I have successfully written the code to end calls programmatically. But before the call ends, I want to retrieve the caller's name to log it. How would I retrieve the caller's name? Note, the caller is presumed to be within the contact list. I've already come across How to retrieve the contact name from incoming call number?, and I didn't find the answer satisfying. It has no context, and very little information.
answer count: 0

http://stackoverflow.com/q/26154715
tagged with: sorting
has title: Sort 2d ArrayList by the length of the sub ArrayList
tagged with: arraylist
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41000801
favorite count: 0
accepted answer: http://stackoverflow.com/a/26154809
has body: I have a two dimensional array: ArrayList&lt;List&lt;Integer&gt;&gt; main= new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; sub=new ArrayList&lt;&gt;(); sub.add(1); sub.add(2); main.add(sub); ............. now main array looks like main-&gt; [[1,2],[3],[4,5,6],[6,6,8,4]] Now I want to sort array by length of the sub array. How can i get following result? Or is there a way to get max element length [in this case 4] of the sub-array without going through a loop? Can I get 4 without looping ? I need to sort but if it's not possible I want to get max length of sub array maxlength=4; [[6,6,8,4],[4,5,6],[1,2],[3]]
has comment: http://stackoverflow.com/comment/41000755
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26154809
tagged with: arrays

http://stackoverflow.com/q/26047109
tagged with: tomcat
score: 0
has title: Error: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
has comment: http://stackoverflow.com/comment/40804153
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4928271
linked to: http://stackoverflow.com/q/31043869
answer count: 0
tagged with: java
has body: I've seen a lot of posts for this but all of them assume I have a knowledge of java that I don't. The only thing I know is HTML and javascript and I want to follow the example showed in this URL: http://www.tutorialspoint.com/jsp/jstl_format_message_tag.htm When I create an JSP with name juane.jsp in Program Files\Apache Software Foundation\Tomcat 6.0\webapps\juane and add the html/jsp code posted in the mentioned URL I get the error: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application I went to Program Files\Apache Software Foundation\Tomcat 6.0\webapps\juane\WEB-INF\lib and see that I have jstl.jar. So not sure what is missing. Thanks!
type: Question
has comment: http://stackoverflow.com/comment/52780449
tagged with: jstl
tagged with: jsp

http://stackoverflow.com/comment/40989494
type: QuestionComment
comment on: http://stackoverflow.com/q/26148591
score: 2
has text: You can't do it because it doesn't make any sense. Can you explain what you expect to happen? What should `testString` before you call the method and after it?
type: Comment

http://stackoverflow.com/comment/40860592
has text: If you put in the time and effort to format your code well, others will more willingly put in the time and effort to help you. Yours is currently formatted terribly, making it hard to read since you've got code blocks that are not indented, other blocks that seem randomly indented, stacked curly braces...
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26078064

http://stackoverflow.com/comment/41637588
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26493165
type: Comment
has text: I don't have a java class representation. The input XML structure must be dynamic and can change.

http://stackoverflow.com/comment/40957430
has text: Yes, ElliotFrisch and I have just came to the same conclusion if you read our comments. This is the answer.
type: Comment
comment on: http://stackoverflow.com/a/26130972
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41000327
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26154412
has text: If the condition at the top of the `if` statement is `true`, the code will always return something or throw an exception. So either the condition at the top is false, or it's throwing an exception and you missed it, or it's returning something but you missed it.

http://stackoverflow.com/q/26084781
type: AnsweredQuestion
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/26085696
type: Question
linked to: http://stackoverflow.com/q/4853622
has title: onNewIntent in Fragments in android
answer count: 2
downvote count: 0
has body: I am trying to develop a NFC application. I need to recognize the NFC TAG from the OnNewIntent that in the Activity class. Now I need to move and use fragments and not activity. Is their a way to replace the onNewIntent in the fragment class?
has answer: http://stackoverflow.com/a/26085696
favorite count: 0
has answer: http://stackoverflow.com/a/27303058
tagged with: nfc
accepted answer: http://stackoverflow.com/a/27303058
tagged with: android
score: 2

http://stackoverflow.com/comment/41101041
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26172555
has text: Brice: I will try your solution!

http://stackoverflow.com/q/26055319
accepted answer: http://stackoverflow.com/a/26055621
score: 0
answer count: 1
tagged with: elasticsearch
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26055621
has body: I want to rely on JAVA_HOME environment variable to install the Elasticsearch instead want to hardcode the path of java for elasticsearch.I tried hard coding the path in service.bat but it didn't work.Then i looked in some more files in the bin folder of ES elasticsearch.bat and elasticsearch.sh and figured out the the changes to only service.bat wont suffice. Just want to make sure where i need to make the changes as i have very limited knowledge of java. Thanks
tagged with: java
linked to: http://stackoverflow.com/q/21428002
has title: HardCode JAVA_HOME environment variable for Elasticsearch
type: Question
linked to: http://stackoverflow.com/q/25579876
tagged with: lucene

http://stackoverflow.com/a/26079769
has body: Because you are comparing strings with ==, while you should use .equals(..). In addition there is no need to scan the strings one character each. Just use public int indexOf(String str, int fromIndex) So that you can skip many more characters per step. Eg: for (int i = 0; i &lt; str.length(); /* do nothing */) { int x == str.indexOf("dog", 0); if (x == -1) { // no more occurrences } else { i = x + "dog".length(); } }
type: Answer
answers question: http://stackoverflow.com/q/26079731
score: 0

http://stackoverflow.com/q/26159402
downvote count: 0
accepted answer: http://stackoverflow.com/a/26193380
favorite count: 0
tagged with: oracle-database
tagged with: regex
upvote count: 1
possible better answer: http://stackoverflow.com/a/41788068
has answer: http://stackoverflow.com/a/26193380
type: Question
has answer: http://stackoverflow.com/a/41788068
type: AnsweredQuestion
tagged with: named-query
score: 1
tagged with: java
has body: I have following Oracle SQL query: SELECT SUBSTR(col, 0, INSTR(col, REGEXP_SUBSTR(col, '\.\d+$')) -1) AS col_new, col as col_orig AS col_orig FROM tab; I have data in table like: col ABC.A.01 ABC.A.02 Above query returns results like: col_new col_orig ABC.A ABC.A.01 ABC.A ABC.A.02 I am trying to migrate it to JPA named query. Till now I could make query only like this: SELECT SUBSTRING(f.col, 0, LENGTH(f.col) - LOCATE('.', REVERSE(f.col))), f.col FROM tab f; I did this as I was not able to find equivalent in JPA for Oracle's REGEXP_SUBSTR. My JPA named query fails in data examples like ABC.A.P01. Can you please let me know how can I migrate my SQL query to JPA named query using equivalent for REGEXP_SUBSTR.
has title: JPA: Equivalent for Oracle's REGEXP_SUBSTR
answer count: 2
has comment: http://stackoverflow.com/comment/41009792
tagged with: jpa

http://stackoverflow.com/comment/41045008
comment on: http://stackoverflow.com/a/26177744
score: 0
type: AnswerComment
has text: @user3639557 I changed my answer to match your question - my first version simply wasn't efficient for triangular matrices.
type: Comment

http://stackoverflow.com/q/26145547
has body: I have a java webapp running under Tomcat 7 behind IIS 8 (both are configured for multihost). To update the web application, I usually undeploy the existing one and deploy a new WAR (which gets exploded in its folder structure), but this causes the IIS web.config file to be erased, thus loosing all the (IIS) website settings. As far as I can tell (but I'm new to IIS), in IIS the website physical path is the webapp ROOT folder (i.e. /path/to/tomcat/webapp/ROOT exploded from the WAR named ROOT.war) and when I configure an error page in IIS, the file ROOT/web.config is created. Is there any way to avoid losing that configuration file? Or should I always redeploy the new war without undeploying the web application first? If necessay, here are a couple of details: my web application has nothing to do with the web.config file, it is read and written by IIS only; IIS and Tomcat are connected with the BonCode connector; the BonCode connector is installed for all sites; I'm running only one Tomcat instance; I'm changing IIS configuration to set custom error pages and SSL requirements.
score: 0
has title: How to undeploy a java webapp in Tomcat but keep IIS website configuration?
type: UnansweredQuestion
tagged with: iis
tagged with: web-applications
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/25999277
tagged with: web-config
answer count: 1
has answer: http://stackoverflow.com/a/26145985
tagged with: tomcat

http://stackoverflow.com/comment/117625001
has text: Glad it helped.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/35317687

http://stackoverflow.com/comment/40905227
has text: The String `148.0` cannot be parsed to a `Long`.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26102493

http://stackoverflow.com/comment/40857640
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26076464
has text: If the value you want to display depends on `someMethod` then you need to call `someMethod`, not quite sure how there would be a way around this.
score: 0

http://stackoverflow.com/comment/40920709
type: QuestionComment
comment on: http://stackoverflow.com/q/26090873
type: Comment
has text: Yeah but I'd still like to be educated on the subject
score: 0

http://stackoverflow.com/q/26134420
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26134457
has comment: http://stackoverflow.com/comment/40963242
has comment: http://stackoverflow.com/comment/40963213
has comment: http://stackoverflow.com/comment/40963181
type: UnansweredQuestion
has title: Unable to recover a full image using java bufferwriter?
has body: From Input Stream i am reading the image data and convert it to string. From string am writing to an image directly by following type. final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); final char[] cbuf = new char[1024]; final int length = reader.read(cbuf); String packet=new String(cbuf,0,length); BufferedWriter out = null ; FileWriter fstream ; File file = new File(fileName); fstream = new FileWriter(file); out.write(packet); Please guide me in this issue. I am not getting full image.
tagged with: java
has comment: http://stackoverflow.com/comment/40963134
type: Question
has comment: http://stackoverflow.com/comment/40963297
linked to: http://stackoverflow.com/q/309424
has comment: http://stackoverflow.com/comment/40963313
has comment: http://stackoverflow.com/comment/40963378
tagged with: image

plsql
tags question: http://stackoverflow.com/q/26182869
tags question: http://stackoverflow.com/q/26055530
tags question: http://stackoverflow.com/q/26137693
type: Tag
tags question: http://stackoverflow.com/q/26141289
tags question: http://stackoverflow.com/q/26176800
tag name: plsql

http://stackoverflow.com/a/26106560
type: Answer
upvote count: 1
has body: You can make it simpler by using nested for loops. Modify your loop to: for (int i=0;i&lt;target_line;i++) { for (int j=0;j&lt;=i;j++) { System.out.print("*"); } System.out.println(); }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26106434

http://stackoverflow.com/a/26191752
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26191545
has comment: http://stackoverflow.com/comment/41069859
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41069688
accepted answer of: http://stackoverflow.com/q/26191545
has body: I assume this method gets called regularly whether things are near each other or not. Otherwise, you wouldn't need to ask if it was intersecting anything - you'd already know it was. But what looks weird to me is that you don't break out of the loop when you find one colliding object. Your falling variable will probably always end up true unless the colliding object is the last one in the list. The real problem is that this falling variable exists at all. You don't need it cos you already have velY. If velY is non-zero, (or negative or whatever,) it's falling, right? So my advice is to get rid of falling and save yourself the hassle of maintaining it.
has comment: http://stackoverflow.com/comment/41069794

http://stackoverflow.com/comment/40793839
score: 0
type: Comment
type: QuestionComment
has text: Ok I got this working - I was using two classes when instead I should have been using one. Here's a gist with the code, not pretty but it works: https://gist.github.com/mcamilleri/bb7eacb6ea02caa1e263
comment on: http://stackoverflow.com/q/26038811

http://stackoverflow.com/comment/43737027
comment on: http://stackoverflow.com/q/26089297
has text: Were you able to find a solution? I am facing the same issue.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26093799
tagged with: listview
downvote count: 0
has comment: http://stackoverflow.com/comment/40889885
favorite count: 0
has title: Sorting Listview Java
has answer: http://stackoverflow.com/a/26100228
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26093951
answer count: 4
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26094003
has body: I wish to sort my listView by the variable called score. Anybody know how to do this? Currently here is my code that get's information from a database and displays it in a list view. List&lt;String&gt; queryTable(){ List&lt;String&gt; player = new ArrayList&lt;String&gt;(); SQLiteDatabase db = myOpenHelper.getReadableDatabase(); Cursor cursor = db.query(CustomOpenHelper.TABLE_NAME, null, null, null, null, null, null); while (cursor.moveToNext()) { int id = cursor.getInt(cursor.getColumnIndex("_id")); String name = cursor.getString(cursor.getColumnIndex("name")); int score = cursor.getInt(cursor.getColumnIndex("score")); player.add(id + " --&gt; the player " + name + " has got a score of " + score +"s"); } So how would I go about sorting this listview by the variable "score"? Thanks guys.
type: Question
has comment: http://stackoverflow.com/comment/40889844
has answer: http://stackoverflow.com/a/26093832
tagged with: sorting

http://stackoverflow.com/comment/40880316
type: QuestionComment
score: 6
has text: I can't explain the issue yet, but have to state that your question is very well presented, thank you and 1+.
comment on: http://stackoverflow.com/q/26088675
type: Comment

http://stackoverflow.com/q/26106783
favorite count: 0
has body: I'm trying to create a deck of cards (based on the SET game) that has 81 unique cards. I'm trying to accomplish this by using three generalized for loops. Now, I have three arrays of Strings with the features (shapes, colors, patterns). However, upon adding println statements into the loops, I found out that only red cards are created with only one type of pattern. ArrayList&lt;Card&gt; deck = new ArrayList&lt;Card&gt;(); static public Deck create() { Deck deck = new Deck(); String[] shapes = new String[] { "diamond", "squiggly", "oval", "double diamond", "double squiggly", "double oval", "triple diamond", "triple squiggly", "triple oval" }; String[] colors = new String[] { "red", "green", "purple" }; String[] patterns = new String[] { "stripes", "filled in", "outlined" }; // Shapes for (String shape : shapes) { System.out.println(shape); // Colors for (String color : colors) { System.out.println(color); // Patterns for (String pattern : patterns) { System.out.println(pattern + "\n"); Card card = new Card(shape, color, pattern); deck.deck.add(card); break; } break; } } return null; } This is the output: diamond red stripes squiggly red stripes oval red stripes double diamond red stripes double squiggly red stripes double oval red stripes triple diamond red stripes triple squiggly red stripes triple oval red stripes Now, it's supposed to create all the shapes with each individual pattern and shape. I'm totally lost with this, and I would appreciate any help!
upvote count: 2
has answer: http://stackoverflow.com/a/26106826
type: AnsweredQuestion
tagged with: object
score: 2
accepted answer: http://stackoverflow.com/a/26106820
has title: How can I use nested for/each loops to create objects with different features?
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26106822
tagged with: arrays
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26106822
answer count: 3
has answer: http://stackoverflow.com/a/26106820

http://stackoverflow.com/comment/40952775
type: QuestionComment
type: Comment
has text: you are counting swaps, not comparisons. (i.e. you are not counting comparison that result in `<=0`)
comment on: http://stackoverflow.com/q/26128580
score: 0

http://stackoverflow.com/comment/41004158
score: 0
has text: About `ByteBuffer` and other concerns, your requirement is definitely outside any wholesale guarantees and strictly specified behavior because that would go against the grain of the Java platform. But, as you already concluded, it can be verified on a case-by-case basis that the guarantees are stronger than those in the official specification.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26121105

http://stackoverflow.com/q/26103564
tagged with: android-studio
tagged with: android
has answer: http://stackoverflow.com/a/26108974
score: 2
type: AnsweredQuestion
upvote count: 3
possible better answer: http://stackoverflow.com/a/26103982
tagged with: java
has answer: http://stackoverflow.com/a/26103982
downvote count: 1
type: Question
has title: Android Studio 0.8.2 URI has an authority component
accepted answer: http://stackoverflow.com/a/26108974
answer count: 2
tagged with: windows
has body: I am getting "Gradle project sync failed." when I start up Android Studio. When I try to clean the project, I get "Failed to complete Gradle execution Cause: URI has an authority component" I've tried several things already and am still stuck. I moved my config files out of my user folders and put them in my root directory where I have Android Studio. (C:/Studio). I've also tried to invalidate caches but that still didn't help. I'm on a networked VDI so I'm not sure if that might have something to do with it. Below is the message I'm getting from Gradle sync. Any ideas what can be going wrong here? Gradle Sync Message: 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: java.lang.IllegalArgumentException: URI has an authority component at java.io.File.(File.java:423) at org.gradle.api.internal.classpath.EffectiveClassPath.findAvailableClasspathFiles(EffectiveClassPath.java:41) at org.gradle.api.internal.classpath.EffectiveClassPath.(EffectiveClassPath.java:32) at org.gradle.api.internal.classpath.DefaultModuleRegistry.(DefaultModuleRegistry.java:61) at org.gradle.api.internal.classpath.DefaultModuleRegistry.(DefaultModuleRegistry.java:55) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:41) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) at org.gradle.launcher.daemon.bootstrap.GradleDaemon.main(GradleDaemon.java:22)
favorite count: 0

http://stackoverflow.com/comment/41036655
comment on: http://stackoverflow.com/q/26173887
type: QuestionComment
type: Comment
has text: and you haven't output averageExamScore,
score: 0

http://stackoverflow.com/comment/40957993
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26130752
has text: Use `StandardCharsets.UTF_8` instead of `Charset.forName("UTF-8")` and `new String(str, StandardCharsets.UTF_8)` instead of `new String(str, "UTF-8")`.

http://stackoverflow.com/a/26043877
has body: Encoding a String is the process of transforming a sequence of characters into a sequence of bytes. For that use the getBytes() method. This method accepts and encoding parameter, which defines the encoding used in this process. Therefore, you can use : byte[] encoded = "文字列".getBytes("UTF-8"); As per Jon Skeet comment, don't use magic strings: byte[] encoded = "文字列".getBytes(StandardCharsets.UTF_8);
has comment: http://stackoverflow.com/comment/40797846
has comment: http://stackoverflow.com/comment/40797926
downvote count: 0
has comment: http://stackoverflow.com/comment/40801377
has comment: http://stackoverflow.com/comment/40801309
has comment: http://stackoverflow.com/comment/40797893
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40798118
upvote count: 2
answers question: http://stackoverflow.com/q/26043808

http://stackoverflow.com/a/26135209
has comment: http://stackoverflow.com/comment/40964902
type: Answer
downvote count: 0
score: 1
has body: I am not experienced in JOGL, I am used to c++ GL. However there are several problems: First, as Reto Koradi stated you are using the same value to ebo, vbo and vao. It should be like, gl.glGenVertexArrays(1, IntBuffer.wrap(tempV)); int vao = tempV[0]; gl.glGenBuffers(2, IntBuffer.wrap(tempB)); int vbo = tempB[0]; int ebo = tempB[1]; Lastly, your draw seems a bit problematic, you seem to skip a step."bind the array to want to draw." Then draw. gl.glBindVertexArray (vao); gl.glDrawElements(GL.GL_TRIANGLES, 2, GL.GL_UNSIGNED_INT, 0); I hope these help.
answers question: http://stackoverflow.com/q/26134716
upvote count: 1

http://stackoverflow.com/q/26138228
upvote count: 0
has comment: http://stackoverflow.com/comment/40970489
has comment: http://stackoverflow.com/comment/40970253
has title: Regex to separate hexcode
favorite count: 0
has answer: http://stackoverflow.com/a/26139427
has comment: http://stackoverflow.com/comment/40970209
type: UnansweredQuestion
tagged with: regex
score: -1
linked to: http://stackoverflow.com/q/994331
tagged with: java
has comment: http://stackoverflow.com/comment/40971912
downvote count: 1
type: Question
has body: I have a String like: String s = "IPhone 5s &amp;#x0024;400" Which I want to get as: String s1 = "IPhone 5s"; String s2 = "$400"; What I tried was getting the last word of the String and checking if it starts with "&amp;#" and if yes, take it out of the String and make it UTF-8. But it might be possible that the Price may not be at the end of the String. Also, does all the currency symbols start with "$#"?
has comment: http://stackoverflow.com/comment/40970252
has answer: http://stackoverflow.com/a/26138467
has comment: http://stackoverflow.com/comment/40970130
answer count: 2
has comment: http://stackoverflow.com/comment/40970190

http://stackoverflow.com/q/26122192
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26122772
linked to: http://stackoverflow.com/q/5897785
tagged with: cxf
tagged with: java
tagged with: jax-ws
tagged with: jaxb
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/40940602
has comment: http://stackoverflow.com/comment/68590369
has comment: http://stackoverflow.com/comment/40940514
has comment: http://stackoverflow.com/comment/40940752
has answer: http://stackoverflow.com/a/26122772
answer count: 1
has body: I have an autogenerated soap webservice client (using cxf), and some elements are marked to be optional. If I do not set these elements, the XML request send to the webservice has lot's of elements as follows: &lt;PayText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/&gt; &lt;Name xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/&gt; These are generated if the wsdl contains: minOccurs="0" nillable="true" How can I prevent the generation of these nil elements? Probably the webservice itself does not need this information, as when I use soapUI and the send the pure xml requests stripping out the nil elements, the request still works. My binding file: &lt;jaxb:globalBindings generateElementProperty="false" /&gt; So, how can I prevent them being generated during send?
has title: How to prevent generation of xml 'nil' elements in soap webservice client?
favorite count: 0
score: 6
tagged with: spring
upvote count: 6

spring-boot
tags question: http://stackoverflow.com/q/26054020
type: Tag
tags question: http://stackoverflow.com/q/26165126
tags question: http://stackoverflow.com/q/26105187
tags question: http://stackoverflow.com/q/26129299
tags question: http://stackoverflow.com/q/26176366
tags question: http://stackoverflow.com/q/26136313
tags question: http://stackoverflow.com/q/26095937
tags question: http://stackoverflow.com/q/26098840
tags question: http://stackoverflow.com/q/26045569
tags question: http://stackoverflow.com/q/26070286
tags question: http://stackoverflow.com/q/26105061
tag name: spring-boot
tags question: http://stackoverflow.com/q/26046377
tags question: http://stackoverflow.com/q/26166992
tags question: http://stackoverflow.com/q/26149711
tags question: http://stackoverflow.com/q/26167874
tags question: http://stackoverflow.com/q/26111050
tags question: http://stackoverflow.com/q/26064999
tags question: http://stackoverflow.com/q/26137932
tags question: http://stackoverflow.com/q/26185137
tags question: http://stackoverflow.com/q/26174317

http://stackoverflow.com/a/26094157
has body: Do you want output to be "Leonard, Charlotte, L" or "Leonard, Emma, C". Current output of your program is the second option. And if you desired first output then you should declare middleInitial as String middleInitial =last.charAt(0);.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26093999

http://stackoverflow.com/comment/41010664
comment on: http://stackoverflow.com/a/26134703
type: AnswerComment
has text: You're definitely catching the drift! Although we don't *need* to upcast like this, it allows for another layer of generality. As programmers, the more general we can make our code, the easier code reuse and becomes.
score: 0
type: Comment

http://stackoverflow.com/a/26151143
has body: You could use a mutable wrapper around boolean to simulate pass-by-reference. AtomicBoolean can be reappropriated for this purpose. You wouldn't be using it for its atomic-ness, just the ability to set its value in one function and read it in another. private void F1() { AtomicBoolean foo = new AtomicBoolean(false); List&lt;String&gt; result = F2(foo); if(foo.get()) { // do something } } private List&lt;String&gt; F2(AtomicBoolean foo) { // Logic to set the result List&lt;String&gt; result = new ArrayList(); if(condition) { foo.set(true); } return result; } Another common, though even kludgier, way to do this is with a 1-element array. boolean[] foo = new boolean[] {false}; The same trick applies. F2 would do foo[0] = true; This is pretty ugly, but you'll see it from time to time, because hey, sometimes you gotta do what you gotta do.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26151072
answers question: http://stackoverflow.com/q/26151072
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/40984571
type: Comment
comment on: http://stackoverflow.com/a/26145985
score: 0
has text: One small clarification: the *web.config* is an IIS read and written file, my web application has nothing to do with it. The best would be to move it somewhere else, but I have no idea if this is even possible.
type: AnswerComment

http://stackoverflow.com/comment/92817826
has text: If I understand your answer, you're talking about generic Sets in both bullet items, right? If so, then there's a kind of set that has a "predictable iteration order": LinkedHashSet. Which could still bear the question: "Why can't one get the Nth element of an LHS directly, without iterating through N-1 elements?" The general contract of Sets is that any kind of ordering is not guaranteed so direct positional access could not be guaranteed. And I do agree with your suggestion on using lists.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26189039
type: AnswerComment

http://stackoverflow.com/comment/40939939
type: AnswerComment
type: Comment
has text: It almost makes me want to post a new question.
comment on: http://stackoverflow.com/a/26118747
score: 0

http://stackoverflow.com/a/26129992
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40956018
answers question: http://stackoverflow.com/q/26129861
has comment: http://stackoverflow.com/comment/40955779
has body: This is a scope problem. You are not returning and assigning the result of sorting from mergeSortFreq. Change that method so that it returns an ArrayList. Otherwise the sorting will take place within the method, but will never be returned back.

http://stackoverflow.com/a/26133071
has comment: http://stackoverflow.com/comment/40960871
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40960804
upvote count: 1
has body: Likewise, @August said. Before line booklist[0] = b; You must initial by using booklist = new Book[3];
has comment: http://stackoverflow.com/comment/40961063
answers question: http://stackoverflow.com/q/26133031
type: Answer

http://stackoverflow.com/comment/40949963
comment on: http://stackoverflow.com/a/26104669
type: Comment
has text: Unfortunately there's no way to avoid writing those 14 wrappers when using option 2... But if you can give me some more details on where the serialization takes place on the server I'm sure we can find the spot that wraps the list into the object as the "region" propery. Any file that is related to the configuration may help here...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41032862
comment on: http://stackoverflow.com/q/26171586
type: Comment
has text: For Java, you don't divide anything. You just call `System.nanotime()` and use the difference to determine how much time has passed since the last call. That difference is your time step.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40945883
type: AnswerComment
score: 0
type: Comment
has text: Thanks. Although I'm quite certain that's what I'm doing. Yet its giving me a java.lang.ClassFormatError: Illegal method name "<init>$" in class ... (ie my eqivalent of StudentAndSubjects)
comment on: http://stackoverflow.com/a/26083203

http://stackoverflow.com/comment/40942154
score: 0
type: AnswerComment
has text: @Necrozze I can't comment about code in another Class, which is not included in the question.
type: Comment
comment on: http://stackoverflow.com/a/26121283

http://stackoverflow.com/q/26110648
answer count: 1
downvote count: 0
favorite count: 0
has body: I am very new to java, I have one class ConnectR.java and it has main method, also I have MainApp class which is the main application. so I want to know If I want to click a button in the MAinApp how can I implement the ConnerR.java Class. thank you very mcuh
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40993475
upvote count: 1
type: Question
has title: Connect a class to the main class
tagged with: http://stackoverflow.com/tag/r
has answer: http://stackoverflow.com/a/26110673

http://stackoverflow.com/comment/41047581
score: 0
type: AnswerComment
type: Comment
has text: Yes. I get it. But in my opinion you don't understand how loops work. I try to understand the poit from which I'll try to start my answer.
comment on: http://stackoverflow.com/a/26179275

http://stackoverflow.com/comment/40972431
comment on: http://stackoverflow.com/q/26138557
type: Comment
type: QuestionComment
score: 1
has text: Force is usually applied continuously over many time steps, not just once like in your code. Maybe you could try ApplyLinearImpulse or SetLinearVelocity instead.

http://stackoverflow.com/comment/41024884
type: QuestionComment
has text: What are you feeding to `amountStr = cin.nextLine()` statement?
comment on: http://stackoverflow.com/q/26167357
score: 0
type: Comment

http://stackoverflow.com/q/26129100
downvote count: 0
score: 1
tagged with: java
tagged with: gradle
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/26130365
tagged with: jar
has body: org.apache.hadoop.mapred.WeightAdjuster and org.apache.hadoop.mapred.NewJobWeightBooster I've added all the jars I can find on Maven almost. Here's my current build.gradle: dependencies { compile group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.1' compile group: 'org.apache.hadoop', name: 'hadoop-common', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-yarn-common', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-yarn-server-common', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-core', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-common', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-jobclient', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-app', version: '2.5.1' compile group: 'org.apache.hadoop', name: 'hadoop-tools', version: '1.2.1' } Which jar should I be grabbing? This link gives a partial description.
upvote count: 1
answer count: 1
favorite count: 0
tagged with: maven
has title: what hadoop jar do i need to get the WeightAdjuster interface
accepted answer: http://stackoverflow.com/a/26130365
type: AnsweredQuestion

http://stackoverflow.com/q/26043098
has title: Google Map not display on the Mobile Screen in Android
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40796582
has comment: http://stackoverflow.com/comment/40796459
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
has body: My error shows Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). But wifi is working on phone. I have generated API Key of same application. //MainActivity code is below: public class MainActivity extends Activity { private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap(); } } //activity_main.xml code is below : &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/&gt; //Menifest code is Below : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.gpslocator2222" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-permission android:name="com.example.gpslocator2222.permission.MAPS_RECEIVE" /&gt; &lt;uses-sdk android:minSdkVersion="17" android:targetSdkVersion="19" /&gt; &lt;!-- permission --&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;permission android:name="com.example.gpslocator2222.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@…

http://stackoverflow.com/comment/40795568
type: AnswerComment
score: 1
type: Comment
has text: @arashams you need to handle the checked exception, see the answer
comment on: http://stackoverflow.com/a/26042265

http://stackoverflow.com/q/26165024
tagged with: java
has comment: http://stackoverflow.com/comment/41024103
has title: Change encoding from T1
linked to: http://stackoverflow.com/q/6308587
type: Question
has comment: http://stackoverflow.com/comment/41024635
tagged with: encoding
upvote count: 3
tagged with: utf-8
favorite count: 0
answer count: 0
type: UnansweredQuestion
has body: I want to change encoding from T1 to UTF-8 in Java. I read and parse pdf to String using Tika. Then I change the ecoding using decode and encode methods in Charset class. There is no problem with common encodings like windows-1252 or UTF-8, but I cannot find class with T1 encoding. Text sample: Przykªady zastosowa« I can properly decode this text on this page: http://kanjidict.stc.cx/recode.php
score: 3
downvote count: 0

http://stackoverflow.com/comment/40918124
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26083337
has text: @Alex: yes, that would make a lot of sense. I don't use Java 8 day-to-day yet, so I don't think of Java 8 idioms first. Will edit when I get a chance.
type: AnswerComment

http://stackoverflow.com/comment/40950547
comment on: http://stackoverflow.com/q/26125155
score: 0
has text: Now I am completely confused. But I recommend using some helper from the concurrent namespace. Maybe a cyclicBarrier for the repeating task ...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26092522
has body: No, arrayCopy is not suitable. Note that you are copying toolArray.length - 1 elements and I am not sure how you don't encounter IndexOutOfBoundExceptions. Assuming testArray, and index are ints, and toolArray is an array of some object type, I think you can do this: public void delete(int ID) { testArray = searchArray(ID); //method used to search array for specified ID // do things on the element that is returned from searchArray(). toolArray[testArray].setQuality(0); toolArray[testArray].setToolName(""); toolArray[testArray].setID(0); toolArray[testArray].setNumberInStock(0); toolArray[testArray].setPrice(0.0); // shift the rest. for (index = testArray + 1; index &lt; toolArray.length; index++) { toolArray[index - 1] = toolArray[index]; } // now toolArray[toolArray.length - 2] and toolArray[toolArray.length - 1] //points to the same object. Let's empty the last cell of the array toolArray[toolArray.length - 1] = null; }//end delete Note that every time you shift, there is a null cell(s) at the end of the array. I think you should consider using a collection that can grow or shrink, ArrayList for example.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26092354
answers question: http://stackoverflow.com/q/26092354
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40887528
type: Answer
score: 1

http://stackoverflow.com/a/26044149
upvote count: 4
has body: You need if (!image1.getPixelReader().getColor(i, j).equals(image2.getPixelReader().getColor(i, j))) return false; or if (image1.getPixelReader().getArgb(i, j) != image2.getPixelReader().getArgb(i, j)) return false; The second version may be faster.
has comment: http://stackoverflow.com/comment/40838542
has comment: http://stackoverflow.com/comment/40803586
answers question: http://stackoverflow.com/q/26044106
downvote count: 0
has comment: http://stackoverflow.com/comment/40803421
accepted answer of: http://stackoverflow.com/q/26044106
has comment: http://stackoverflow.com/comment/40838444
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/q/26089303
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
has body: When trying to program a game using Box2D, I ran into a problem with Box2D. I filled in pixel numbers for the lengths of the the textures and sprites to create a box around it. Everything was at the right place, but for some reason everything went very slowly. By looking on the internet I found out that if you didn't convert pixels to meters box2d might handle shapes as very large objects. this seemed to be a logical cause of everything moving slowly. I found similar questions on this site, but the answers didn't really seem to help out. in most of the cases the solution was to make methods to convert the pixel numbers to meters using a scaling factor. I tried this out, but everything got misplaced and had wrong sizes. this seemed logical to me since the numbers where changed but had the same meaning. I was wondering if there is a way to make the pixels mean less meters, so everything whould be at the same place with the same (pixel) size, but mean less meters. If you have a different way which you think might help, I whould also like to hear it.. Here is the code i use to create the camera width = Gdx.graphics.getWidth() / 5; height = Gdx.graphics.getHeight() / 5; camera = new OrthographicCamera(width, height); camera.setToOrtho(false, 1628, 440); camera.update(); This is the method I use to create an object: public void Create(float X, float Y, float Width, float Height, float density, float friction, float restitution, World world){ //Method to create an item width = Width; height = Height; polygonDef = new BodyDef(); polygonDef.type = BodyType.DynamicBody; polygonDef.position.set(X + (Width / 2f), Y + (Height / 2f)); polygonBody = world.createBody(polygonDef); polygonShape = new PolygonShape(); polygonShape.setAsBox(Width / 2f, Height / 2f); polygonFixture = new FixtureDef(); polygonFixture.shape = polygonShape; polygonFixture.density = density; polygonFixture.friction = friction; polygonFixture.restitution = restitution; polygonBody.createFixture(polygonFixture…
accepted answer: http://stackoverflow.com/a/26107062
type: AnsweredQuestion
tagged with: jbox2d
type: Question
has title: Libgdx Box2D pixel to meter conversion?
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/26107062
score: 4
tagged with: eclipse

http://stackoverflow.com/a/26116319
has comment: http://stackoverflow.com/comment/40930021
answers question: http://stackoverflow.com/q/26116284
has comment: http://stackoverflow.com/comment/40929971
score: 1
has body: Java is a pass by value language. Variables that you pass to a method cannot be changed by that method beyond the scope of the method.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40930099
downvote count: 0

http://stackoverflow.com/comment/40931073
comment on: http://stackoverflow.com/q/26116826
type: Comment
type: QuestionComment
has text: Thanks you! but can u plz say y my visit methods are not getting executed?
score: 0

web-services
tags question: http://stackoverflow.com/q/26065917
type: Tag
tags question: http://stackoverflow.com/q/26112966
tags question: http://stackoverflow.com/q/26111865
tags question: http://stackoverflow.com/q/26063913
tags question: http://stackoverflow.com/q/26060322
tags question: http://stackoverflow.com/q/26189173
tags question: http://stackoverflow.com/q/26080364
tags question: http://stackoverflow.com/q/26174572
tags question: http://stackoverflow.com/q/26175838
tags question: http://stackoverflow.com/q/26134348
tags question: http://stackoverflow.com/q/26148873
tags question: http://stackoverflow.com/q/26170982
tags question: http://stackoverflow.com/q/26121406
tags question: http://stackoverflow.com/q/26120085
tags question: http://stackoverflow.com/q/26124260
tags question: http://stackoverflow.com/q/26144787
tags question: http://stackoverflow.com/q/26078617
tags question: http://stackoverflow.com/q/26057468
tags question: http://stackoverflow.com/q/26099535
tags question: http://stackoverflow.com/q/26124423
tags question: http://stackoverflow.com/q/26123728
tags question: http://stackoverflow.com/q/26095881
tags question: http://stackoverflow.com/q/26188410
tags question: http://stackoverflow.com/q/26061820
tags question: http://stackoverflow.com/q/26081813
tags question: http://stackoverflow.com/q/26047280
tags question: http://stackoverflow.com/q/26041535
tags question: http://stackoverflow.com/q/26042804
tags question: http://stackoverflow.com/q/26074497
tags question: http://stackoverflow.com/q/26037713
tags question: http://stackoverflow.com/q/26163316
tags question: http://stackoverflow.com/q/26057769
tags question: http://stackoverflow.com/q/26117364
tags question: http://stackoverflow.com/q/26034338
tags question: http://stackoverflow.com/q/26178774
tags question: http://stackoverflow.com/q/26183209
tags question: http://stackoverflow.com/q/26187465
tags question: http://stackoverflow.com/q/26140203
tags question: http://stackoverflow.com/q/26159206
tags question: http://stackoverflow.com/q/26058930
tags question: http://stackoverflow.com/q/26076107
tag name: web-services
tags question: http://stackoverflow.com/q/26141432
tags question: http://stackoverflow.com/q/26079848
tags question: http://stackoverflow.com/q/26063730
tags question: http://stackoverflow.com/q/26074939
tags question: http://stackoverflow.com/q/26094047
tags question: http://stackoverflow.com/q/26095752
tags question: http://stackoverflow.com/q/26139434
tags question: http://stackoverflow.com/q/26117070
tags question: http://stackoverflow.com/q/26095905

http://stackoverflow.com/q/26178156
score: 4
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/26178217
upvote count: 5
has title: What does "leftmost" mean in that definition?
has answer: http://stackoverflow.com/a/26178281
answer count: 4
has comment: http://stackoverflow.com/comment/41044107
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26178298
has answer: http://stackoverflow.com/a/26178292
favorite count: 0
possible better answer: http://stackoverflow.com/a/26178298
type: Question
tagged with: exception
has body: JLS at the 14.20.1 says: If the run-time type of V is assignment compatible with (§5.2) a catchable exception class of any catch clause of the try statement, then the first (leftmost) such catch clause is selected. What is leftmost? We put catch clauses from top-to bottom as, for instance: try{ } catch(IndexOutOfBoundException e){ } catch(SQLException e){ } catch(NullPointerException e){ } //etc
accepted answer: http://stackoverflow.com/a/26178281

http://stackoverflow.com/a/26115166
answers question: http://stackoverflow.com/q/26113441
upvote count: 1
has body: If you have such a bug then it is always helpful to imagine what is done. I've added (personal) comments to you implementation: private void balanceRight() { TreeNode oldRoot = root; // Save the current root (1) if (root.left != null) // This does not matter as first an assignment of null does not matter // second the next assignment is a NoOp oldRoot.left = root.left; // this is an assignment with no effect (2) if (root.right != null) root = root.right; // Setting the new root (3) if (root.left != null) // Now root.left is the left part of the previous root.right // the left part of the previous root is discarded this way oldRoot.right = root.left; // oldRoot will be invalid after this operation therefore it does not matter (4) } I've corrected your algorithm (at least for the right balancing. The left balancing can be done by you if you follow my guidelines). To create such an algorithm you can use a technique that I introduce in the following: private void balanceRight() { TreeNode oldRoot = root; // Save the current root (1) if (root.right != null) { // Can this ever happen? (*) root = root.right; // Setting the new root (2) } oldRoot.right = root.left; // Assign the left sub tree to the previous root right tree (3) root.left = oldRoot; // Assign to the new left tree the prevouis left tree (4) } (*) This should never happen as if we balance right then the right tree is larger than the left one. To understand the algorithm it is helpful to write down what happens in the algorithm: First I draw a tree that is as simple as needed for this algorithm. 1 / \ 2 3 / \ 4 5 Now I write down all pointers link at every stage of the algorithm (the numbers correspondent with the numbers in the algorithm): (1) root -&gt; 1 / left -&gt; 2 / right -&gt; 3 oldRoot -&gt; 1 / left -&gt; 2 / right -&gt; 3 (2) root -&gt; 3 / left -&gt; 4 / right -&gt; 5 oldRoot -&gt; 1 / left -&gt; 2 / right -&gt; 3 (3) root -&gt; 3 / left -&gt; 4 / right -&gt; 5 oldRoot -&gt; 1 / left -&gt; 2 / righ…
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40929551
has comment: http://stackoverflow.com/comment/40932695
has comment: http://stackoverflow.com/comment/40931394
score: 1

http://stackoverflow.com/comment/41086894
score: 0
type: Comment
type: QuestionComment
has text: I found another way to rezolve my particular problem,but I will try your ideea with storing locally the credentails and then load that in another session.Thanks!
comment on: http://stackoverflow.com/q/26177864

http://stackoverflow.com/a/26159750
has comment: http://stackoverflow.com/comment/96358922
has body: Your compareTo() method works. Use Collections.sort() and you are good to go. List&lt;Interval&gt; intervals = new ArrayList&lt;Interval&gt;(); intervals.add(new Interval(2, 3)); intervals.add(new Interval(5, 6)); intervals.add(new Interval(9, 11)); intervals.add(new Interval(3, 10)); Collections.sort(intervals);
answers question: http://stackoverflow.com/q/26159630
has comment: http://stackoverflow.com/comment/96358247
type: Answer
score: 0

http://stackoverflow.com/comment/40828538
type: Comment
has text: No particular reason, I was basing my code off of an old code I found on GitHub so that's probably why there are some inconsistencies. What do I change so that the mapper and reducer api's match?
comment on: http://stackoverflow.com/a/26047886
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40845821
type: AnswerComment
has text: Thanks. I was going back and forth on storing in the DB. But kept thinking that storing it in the backend DB would mean that backend is aware of those settings even though it holds meaning only for the UI. If its per user settings, then I agree that DB is the best place but in my case its a system level setting so I wasn't sure. I might just store it in the DB for lack of better/simpler solution.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26069538

http://stackoverflow.com/q/26150143
possible better answer: http://stackoverflow.com/a/26150317
tagged with: java
has answer: http://stackoverflow.com/a/26150317
tagged with: string-parsing
type: Question
has answer: http://stackoverflow.com/a/26150433
has title: Java: match all strings that do not end in .htm?"
accepted answer: http://stackoverflow.com/a/26150458
score: 0
answer count: 3
has body: I'm parsing an HTML file in Java using regular expressions and I want to know how to match for all href="" elements that do not end in a .htm or .html, and, if it matches, capture the content between quotes into a group These are the ones I've tried so far: href\s*[=]\s*"(.+?)(?![.]htm[l]?)" href\s*[=]\s*"(.*?)(?![.]htm[l]?)" href\s*[=]\s*"(?![.]htm[l]?)" I understand that with the first two, the entire string between quotes is being captured into the first group, including the .htm(l) if it is present. Does anyone know how I can avoid this from happening?
tagged with: http://stackoverflow.com/tag/html
tagged with: regex
has comment: http://stackoverflow.com/comment/40992664
has answer: http://stackoverflow.com/a/26150458
type: AnsweredQuestion

http://stackoverflow.com/a/31283640
answers question: http://stackoverflow.com/q/26135131
upvote count: 1
type: Answer
has body: Not sure why you have to open up security on all those directories (nor do most of them exist on my system). I'm using Fedora 22 with Eclipse Luna (installed from dnf package manager) and Tomcat 8.0.23 (installed via tarball), but I imagine this would apply to other Linux distributions and versions of Tomcat. All I needed to do was the following: # chmod -R 777 /opt/apache-tomcat-8.0.23 Also, it was important to select in Eclipse under "Server Locations" the option to "Use Tomcat Installation (Takes Control of Tomcat Instatallation)" to be able to access Tomcat's home/configuration page via port 8080. Ran Tomcat from Eclipse under servers and everything worked perfectly. Good luck!
downvote count: 0
score: 1

http://stackoverflow.com/a/26067855
has comment: http://stackoverflow.com/comment/40842476
score: 12
upvote count: 12
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40842500
type: Answer
has body: You've declared separate name and price variables in Car, and never assigned a value to them - they're not the same as the name and price variables declared (and initialized) in Transport. So you're seeing the default values for String and double, basically. Get rid of those extra variables in Car, and use super.carPrice() to get the original price from Transport: public class Car extends Transport { public Car(String name, double price) { super(name, price); } @Override public double carPrice(){ return super.carPrice() * 1.5; } } Note that there's no need to override carName() at all unless you really want it to change behaviour. I'd also suggest changing carName() and carPrice() to getName() and getPrice() to be more idiomatic.
accepted answer of: http://stackoverflow.com/q/26067831
has comment: http://stackoverflow.com/comment/97663204
answers question: http://stackoverflow.com/q/26067831
has comment: http://stackoverflow.com/comment/40842573

http://stackoverflow.com/q/26062625
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/26063112
tagged with: connection-pooling
has answer: http://stackoverflow.com/a/26063363
tagged with: java
possible better answer: http://stackoverflow.com/a/26063363
has title: Can I change the maxActive property of a org.apache.tomcat.jdbc.pool.DataSource dynamically?
has answer: http://stackoverflow.com/a/26063112
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has body: I have a webapp running with a Groovy console attached. I have the following bean configured via XML: &lt;bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"&gt; &lt;property name="driverClassName" value="${db.driverClass}"/&gt; &lt;property name="url" value="${db.url}"/&gt; &lt;property name="username" value="${db.username}"/&gt; &lt;property name="password" value="${db.password}"/&gt; &lt;property name="validationQuery" value="${db.validationQuery}" /&gt; &lt;property name="testOnBorrow" value="true" /&gt; &lt;property name="testWhileIdle" value="true" /&gt; &lt;property name="timeBetweenEvictionRunsMillis" value="1800000" /&gt; &lt;property name="numTestsPerEvictionRun" value="8" /&gt; &lt;property name="removeAbandoned" value="true"/&gt; &lt;property name="logAbandoned" value="true"/&gt; &lt;property name="removeAbandonedTimeout" value="60"/&gt; &lt;!--connection pooling props --&gt; &lt;property name="maxActive" value="${db.maxActive}"/&gt; &lt;property name="maxIdle" value="${db.maxIdle}"/&gt; &lt;property name="maxAge" value="${db.maxAge}"/&gt; &lt;property name="maxWait" value="${db.maxWait}"/&gt; &lt;property name="initialSize" value="${db.initialSize}"/&gt; &lt;property name="minIdle" value="${db.minIdle}"/&gt; &lt;/bean&gt; Via the Groovy console, I can easily call: appCtx.getBean("dataSource").setMaxActive(someNumber); where appCtx is my Spring application context. My question is, will this actually change the connection pool behaviour. All the links I've found seem to focus on initial configuration. I'm trying to modify configuration after the pool is established.

http://stackoverflow.com/a/26135350
answers question: http://stackoverflow.com/q/26135131
has body: Follow Ruchira Gayan Ranaweera's comment, with: Eclispe directory is: /opt/eclipse IntelliJ IDEA directory is /opt/intellij-idea Tomcat directory is: /opt/tomcat8 Eclipse workspace directory is default sudo chmod 777 /opt/eclipse -R sudo chmod 777 /opt/intellij-idea -R sudo chmod 777 /opt/tomcat8 -R sudo chmod 777 /home/user_name/workspace/Servers – R I have fired up the application server successfully from the IDE.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26135131
score: 2
upvote count: 2

http://stackoverflow.com/q/26185252
tagged with: morphia
answer count: 1
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has title: clean way to force morphia to overwrite existing entries
has body: I am getting information from a sql DB and moving them into mongo using morphia. We detect delta changes on the SQL side and import changed values to Monog as well, but my first attempt didn't work because I ended up with both the old and the new entry in the DB, instead of tossing the old entry with the new one. My next approch was to take the 'sqlID' field and mark it with @id. This did what I wanted, but it also prevented sqlid from being added as a normal field. When I want to query mongo for the sqlID the query no longer works. the other recommendations I found were to do a query to mongo to get the current @id that I can then save over, and to write a custom query that overwrites every field in an existing table if it exists. I don't like the former option because it would require an extra mongo query for every row I pull from sql, with the data-volume I'm working with that's too expensive. The later would work, but considering how many fields are in a single record I really don't want to have to manually write out a query to overwrite each one by hand. My current lazy hack is to save sqlID twice, once as the @id and once as a normal field. It does what I want, but still feels hack-y (it's a word if I say it is!). Is there not some easier way of specifying a field and saying "overwrite if this field already exists" when you save to mongo?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26214456
type: Question
tagged with: mongodb
downvote count: 0
accepted answer: http://stackoverflow.com/a/26214456

http://stackoverflow.com/q/26096401
has comment: http://stackoverflow.com/comment/40894316
tagged with: junit4
has title: How to make a SWT button call a java class
has comment: http://stackoverflow.com/comment/40923254
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40909324
tagged with: button
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/41220516
favorite count: 0
has body: I have a Driver class (that does not have main method) (actually it has junit annotations @Before, @After etc). Now i have created a SWT class and created a gui. Here i want to have a button. Clicking on this button should call the Driver class.
has comment: http://stackoverflow.com/comment/40908538
type: UnansweredQuestion
downvote count: 2
tagged with: swt
has answer: http://stackoverflow.com/a/26115878

http://stackoverflow.com/a/50069288
has body: I was seeing this exception: Invalid keystore format while running a java application using JRE-1.8.0_40 on CentOS 6.6 64-bit linux. On using JRE-1.8.0_172, the exception went away.
answers question: http://stackoverflow.com/q/26071429
type: Answer
upvote count: 3
downvote count: 1
score: 2

http://stackoverflow.com/a/26097990
type: Answer
has body: If it's possible for you to disable the event listener, you could do it by: A) set a (boolean) flag in the PropertyChangeListener object or B) remove the eventlistener from the optionPane: final PropertyChangeListener pcl = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() &amp;&amp; (e.getSource() == optionPane) &amp;&amp; (JOptionPane.VALUE_PROPERTY.equals(prop))){ java.lang.System.out.println("Code Reached"); optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); optionPane.removePropertyChangeListener(pcl); } } } optionPane.addPropertyChangeListener(pcl); However, this depends on the dialogs purpose. If you close the dialog, then option B is good. EDIT: The second event is caused by optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE) , so if you check against that value, it could work. if (dialog.isVisible() &amp;&amp; e.getSource() == optionPane &amp;&amp; JOptionPane.VALUE_PROPERTY.equals(prop) &amp;&amp; !optionPane.getValue().equals(JOptionPane.UNINITIALIZED_VALUE)){ java.lang.System.out.println("Code Reached"); optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); }
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26096978
answers question: http://stackoverflow.com/q/26096978
has comment: http://stackoverflow.com/comment/40899397
has comment: http://stackoverflow.com/comment/40897391
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26139520
downvote count: 0
answers question: http://stackoverflow.com/q/26139437
accepted answer of: http://stackoverflow.com/q/26139437
score: 17
type: AcceptedAnswer
upvote count: 17
type: Answer
has body: You need to set the format symbols using an instance of DecimalFormatSymbols: public void testDec() { DecimalFormat df = new DecimalFormat("#.000"); DecimalFormatSymbols sym = DecimalFormatSymbols.getInstance(); sym.setDecimalSeparator(','); df.setDecimalFormatSymbols(sym); System.out.println(df.format(1234567/1000000.0)); } Output is 1,235

http://stackoverflow.com/comment/40847064
type: QuestionComment
comment on: http://stackoverflow.com/q/26070503
has text: Yeah I figured I was doing it wrong. How should I be doing it?
score: 0
type: Comment

http://stackoverflow.com/q/26160076
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/15972574
tagged with: spring
has answer: http://stackoverflow.com/a/30453872
score: 0
tagged with: java
type: Question
tagged with: android-annotations
has title: Android Annotations : Using a String resource to provide annotation value
has answer: http://stackoverflow.com/a/70639800
answer count: 3
has body: Maybe I'm not seeing the forest for the trees but is there a way to use a String resource to provide a value to a annotation field. What I would like is something like so @Rest(rootUrl=@StringRes(R.string.root_url), converters=MappingJackson2HttpMessageConverter.class) public interface MyRestService extends RestClientErrorHandling {... The rootUrl value in the @Rest annotation should get the value from the String resource R.string.root_url. Any direction is much appreciated.
has answer: http://stackoverflow.com/a/26160263

http://stackoverflow.com/a/26141103
has comment: http://stackoverflow.com/comment/40975727
has comment: http://stackoverflow.com/comment/40976266
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26140993
type: Answer
has comment: http://stackoverflow.com/comment/40976002
has comment: http://stackoverflow.com/comment/40976812
has comment: http://stackoverflow.com/comment/40975641
answers question: http://stackoverflow.com/q/26140993
score: 2
has comment: http://stackoverflow.com/comment/41256323
has body: It's interesting what is com.dsths.common.container.ContainerClassLoader... Looks like spring-integration-http is loaded by this ClassLoader, but MappingJackson2HttpMessageConverter and all others spring-web classes with another ClassLoader. Would be great, if you place all spring jars within the same class loader. The app is not able to find MappingJackson2HttpMessageConverter in the class path. The problem is one class loader is picking one version and another class loader is picking another version.
downvote count: 0
has comment: http://stackoverflow.com/comment/40977102
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41256307

http://stackoverflow.com/comment/40845779
type: AnswerComment
has text: LOL, enjoy the weekend!
comment on: http://stackoverflow.com/a/26069770
type: Comment
score: 0

http://stackoverflow.com/comment/72805779
score: 1
comment on: http://stackoverflow.com/a/42848413
type: AnswerComment
has text: Not 1.8.0_66, I made a mistake, it's my JDK version. It doesn't work on my colleague's jre1.8.0_25, relatively lower than 66 or the latest, reinstall the JDK is ok, you can try.
type: Comment

http://stackoverflow.com/q/26122884
tagged with: stdout
has comment: http://stackoverflow.com/comment/40941927
has title: Redirect Shared Library Output
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26127057
has comment: http://stackoverflow.com/comment/40942017
has body: I am using a C++ .so with JNA. When I run it through Netbeans the output from C++ cout is directly printed in the Netbeans console. The thing is that I want to redirect this output to a JFrame for example. As suggested in other similar topics I found on the web, I used freopen() to redirect stdout to a file. It works fine but I have one problem with this solution. The data can be read and then redirected to a JFrame as I want only after the execution of C++ code has stopped (or at least this I understand - maybe I am wrong). So I want to ask is there really any way of redirecting C++ ouput somethere that can be accessed from my Java code in real time? I mean during the execution of the C++ code and not after the end of the operation in the C++ part. Thanks.
has comment: http://stackoverflow.com/comment/40942187
tagged with: jna
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40950867
accepted answer: http://stackoverflow.com/a/26127057
type: Question
tagged with: java

http://stackoverflow.com/comment/40865164
comment on: http://stackoverflow.com/a/26080498
type: Comment
has text: Thanks, I got the MouseListener to work for the dragging. BUT when I remove repaint() my graphics aren't added. Why is this?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40933485
has text: Could you show us the spring configuration (XML/Java)
score: 0
comment on: http://stackoverflow.com/q/26117070
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26079560
upvote count: 1
has body: The garbage collection is non-deterministic and complicated. That, combined with other things such as the JIT compilation make precise memory usage patterns hard to predict and replicate. You mentioned that it's including Scala? That makes things even more interesting. The "nice" functional constructs may be generating more garbage than it appears. Even little things like wrapping objects in Option-s need additional memory that has to be cleaned up.
downvote count: 0
answers question: http://stackoverflow.com/q/26078600
type: Answer
score: 1

http://stackoverflow.com/comment/40891043
type: Comment
has text: I see. In this case may be serial no. of records would work and save the serial no. with each record. Random no. will be between min and max serial no. Though feasibility of this solution varies depending upon the requirements whether its worth it or not in particular cases.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26093347

http://stackoverflow.com/comment/40996219
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26131271
type: Comment
has text: Which bersion of android

private-key
tags question: http://stackoverflow.com/q/26116689
type: Tag
tag name: private-key

http://stackoverflow.com/comment/40973439
type: Comment
comment on: http://stackoverflow.com/a/26070584
has text: @MikeM. But again, it only trigger the alarm after the minute I've set it regardless on how long I set it to repeat and stopped the recurring. Do you have any idea?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26180992
score: 6
has title: Get the first character of each word in a String
linked to: http://stackoverflow.com/q/513832
type: AnsweredQuestion
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26183099
accepted answer: http://stackoverflow.com/a/26181091
has answer: http://stackoverflow.com/a/47353996
type: Question
has answer: http://stackoverflow.com/a/26181033
has answer: http://stackoverflow.com/a/26181039
has answer: http://stackoverflow.com/a/26181052
upvote count: 6
has answer: http://stackoverflow.com/a/26181091
answer count: 11
has body: I am trying to get a program working which does the following: Let's say we have a String called name, set to "Stack Overflow Exchange". I want to output to the user "SOE", with the first characters of each word. I tried with the split() method, but I failed to do it. My code: public class q4 { public static void main(String args[]) { String x = "michele jones"; String[] myName = x.split(""); for(int i = 0; i &lt; myName.length; i++) { if(myName[i] == "") { String s = myName[i]; System.out.println(s); } } } } I am trying to detect if there are any spaces, then I can simply take the next index. Could anyone tell me what I am doing wrong?
possible better answer: http://stackoverflow.com/a/26181033
has answer: http://stackoverflow.com/a/61499188
tagged with: java
has answer: http://stackoverflow.com/a/64630255
has answer: http://stackoverflow.com/a/60078160
has answer: http://stackoverflow.com/a/26181047
has answer: http://stackoverflow.com/a/26184251
has comment: http://stackoverflow.com/comment/41053708

http://stackoverflow.com/q/26157561
type: UnansweredQuestion
tagged with: android
tagged with: apk
has comment: http://stackoverflow.com/comment/41060784
type: Question
tagged with: air
tagged with: java
has title: Install apk over 250mb from another application
score: 0
has body: Problem I'm using the following java code to simple call the installation dialog with stored locally on sd card apk file: Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + args[0].getAsString()), "application/vnd.android.package-archive"); context.getActivity().startActivity(intent); And everything is going to be fine when i'm using apk files < 250mb in other case application would crash. The problem is that i totally need every single part of this >250mb apk and there is no way to split it by extension packs. So is there any workaround about this limitation? Manifest <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-feature android:name="android.hardware.microphone" android:required="false" /> <action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-permission android:name="android.permission.INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.RESTART_PACKAGES"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch" /> Also Maybe you need to know that my application is written by AS3 with Adobe Air and using this java code as native extension to execute apk files. But be sure that it isn't necessary and you will face the same problem using pure java application.
answer count: 1
has answer: http://stackoverflow.com/a/26186810
tagged with: actionscript-3

http://stackoverflow.com/q/26157594
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/26157723
has comment: http://stackoverflow.com/comment/41008206
has comment: http://stackoverflow.com/comment/41008012
type: Question
has body: I am an android developer. any body give me answer for my question. suppose i developed one application and that application install in android device so, can i get information about that android device.
has comment: http://stackoverflow.com/comment/41008069
has answer: http://stackoverflow.com/a/26157751
has title: How to get notification when android mobile user install my application?
answer count: 2
tagged with: notifications
has comment: http://stackoverflow.com/comment/41008140
has comment: http://stackoverflow.com/comment/41005904
has answer: http://stackoverflow.com/a/26157723
favorite count: 0
tagged with: android
score: -3
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/26157751
has comment: http://stackoverflow.com/comment/41008124

http://stackoverflow.com/comment/40848141
comment on: http://stackoverflow.com/q/26070799
type: Comment
type: QuestionComment
score: 0
has text: Does not work when I set it up in oncreateoptionsmenu.

http://stackoverflow.com/q/26185522
has title: How do I make my program continue on?
has comment: http://stackoverflow.com/comment/41058242
score: 0
has answer: http://stackoverflow.com/a/26185602
possible better answer: http://stackoverflow.com/a/26185749
has answer: http://stackoverflow.com/a/26185749
accepted answer: http://stackoverflow.com/a/26185602
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has body: I'm writing a program that will draw a "cootie" monster. The player inputs a number, either a 1 or 2 for now, and the program draws the monster for them. (A 1 gives you the body and a 2 gives you the head BUT, before you can draw the head, you HAVE to draw the body first) I'm having some trouble figuring out how to get my program to keep going until the user has drawn both the head and the body. Right now, my program only gets 1 user input before ending, even though the player hasn't drawn the whole monster yet. Help is appreciated! import java.util.Scanner; public class Cootie { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("BODY PARTS:"); System.out.println("1 = body"); System.out.println("2 = head"); System.out.println("3 = one leg"); System.out.println("4 = one antenna"); System.out.println("5 = one eye"); System.out.println("6 = tail"); System.out.println("What number did you roll?: "); int rollValue = scanner.nextInt(); int body = 0; int error = 0; int head = 0; if (rollValue == 1) { if (body == 0) { body = 1; } else { error = 1; } } else if (rollValue == 2) { if (body == 1 &amp;&amp; head == 0) { head = 1; } else { error = 1; } } else { System.out.println("Enter a valid input!"); } if (body == 1) { System.out.println("You got the body!"); System.out.println(" "); System.out.println(" "); System.out.println(" [ ]"); System.out.println(" "); System.out.println(" [ ]"); System.out.println(" "); System.out.println(" [ ]"); } else if (head == 1) { System.out.println("You got the head!"); System.out.println(" "); System.out.println(" ( )"); } if (error == 1) { System.out.println("Can't add body part!"); } } }
has comment: http://stackoverflow.com/comment/41058249

http://stackoverflow.com/q/26137159
accepted answer: http://stackoverflow.com/a/26137725
has comment: http://stackoverflow.com/comment/40968599
has comment: http://stackoverflow.com/comment/40968055
tagged with: google-app-engine
tagged with: android
has comment: http://stackoverflow.com/comment/40968412
type: AnsweredQuestion
tagged with: java
has body: I am trying to run this example. I reached upto "Modify the Client Application" and I am then having the following errors (and below is my file organization screenshot: At this stage, as you can see below, I have the following issues in MainActivity.java. activity_main.xml is called out but the project in its layout folder only has activity_register.xml (see here) "Checkinendpoint" class is undefined but there is a CheckInEndPoint.java in the "MobileAssistant-AppEngine" project, as you can see in the image below. Is that not supposed to get picked up in MainActivity.java - how to import that? (doesnt work like a normal library import, i.e. "MobileAssistant-AppEngine" is not a library that "MobileAssistant" can reference. Same question as above for CheckIn class that is also undefinted in the picture below.
type: Question
has answer: http://stackoverflow.com/a/26137725
has comment: http://stackoverflow.com/comment/40968236
score: 0
has title: Unable to run Google's example - Android App Engine Mobile Backend
answer count: 1

http://stackoverflow.com/comment/40996680
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26117935
type: Comment
has text: @TayyabGulsherVOhra My comment was actually directed to the poster of this answer (not you). Don't worry. We'll help you out

http://stackoverflow.com/q/26069181
answer count: 2
has title: Java runtime exec getInputStream when process pauses
score: 0
has body: I am creating a wrapper for a executable that runs on the windows command line. The executable takes a few commands then attempts to connect to another device. then it outputs and ERROR! or Ready For "Device Name" i do not get this message until the app exits. The problem is this app is a tunnel allowing me to run telnet on the external box but i need to make sure the Device is ready this is my code. public void startUDPTunnel() { //TODO Pull Amino serial number from webportal Properties prop = new Properties(); InputStream inConfig = getClass().getClassLoader().getResourceAsStream("config.properties"); try { prop.load(inConfig); } catch (IOException e) { System.out.println(e.getMessage()); } String server = prop.getProperty("server");//config.GetProp("server"); System.out.println(server); String port = prop.getProperty("port");//config.GetProp("port"); System.out.println(port); String location = prop.getProperty("location");//config.GetProp("location"); System.out.println(location); String url = prop.getProperty("URL"); System.out.println(url); String input = ""; try { input = getSerial(url); System.out.println(input); Process p = Runtime.getRuntime().exec(location+"udptunnel.exe -c 127.0.0.1 23 "+input+" "+server+" "+port+" 127.0.0.1 23"); threadSleep(); BufferedReader in = new BufferedReader( new InputStreamReader(p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { if(line.equals("ERROR!")){ System.out.println("There was an ERROR"); } if(line.equals("Ready for \""+input+"\"")){ System.out.println("Load Telnet"); } } p.destroy(); } catch (IOException e) { e.printStackTrace(); } } Sorry there is a lot of debug code left in this function. EDIT OK I am pretty sure know what the issue is bufferReader.readLine() requires a \n or \r or just hangs is there anyway to watch the stream with out the buffer?
possible better answer: http://stackoverflow.com/a/26080883
has answer: http://stackoverflow.com/a/26080883
accepted answer: http://stackoverflow.com/a/26069539
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40846882
tagged with: java
has answer: http://stackoverflow.com/a/26069539
has comment: http://stackoverflow.com/comment/40845077
type: Question

http://stackoverflow.com/q/26161357
has comment: http://stackoverflow.com/comment/41013190
possible better answer: http://stackoverflow.com/a/26162239
has answer: http://stackoverflow.com/a/26162239
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Find the earliest date from an array
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/26161462
answer count: 2
has comment: http://stackoverflow.com/comment/41012861
tagged with: arrays
has body: So, the array will be of the format: String[][] resultsArray = new String[][] { { X, Y, "2014-10-22 12:00", Z}, { X, Y, "2014-10-24 12:00", Z}, { X, Y, "2014-10-26 12:00", Z}, }; From this I need to retrieve the earliest date. I already have a loop for another purpose that is looping through each item in the array, so I intend to reuse it. It is in the format: for (int i=0; i &lt; resultsArray.length; i++) { result += resultsArray[i][1] + "text" + resultArray[i][2]; } My current thinking is to add the date value from the array into a new array (dateArray) on each iteration, then call Arrays.sort(dateArray) and grab dateArray[0]. However, this seems pretty inefficient and clumsy, and I suspect I'm missing some simple trick.
has answer: http://stackoverflow.com/a/26161462
favorite count: 0

http://stackoverflow.com/a/26058946
accepted answer of: http://stackoverflow.com/q/26057851
score: 1
answers question: http://stackoverflow.com/q/26057851
downvote count: 0
has body: You can separate multiple lines with the \ character multiline.message=First line \ Second line message.with.html=Strong message The output for @Messages("multiline.message") will be: First line Second line HTML tags can be escaped with the helper object @Html(Messages("message.with.html"))
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40867656
type: QuestionComment
has text: I was wondering if you have suggestions for how to add user content from the console to the class?
comment on: http://stackoverflow.com/q/26081622
score: 0
type: Comment

http://stackoverflow.com/q/26076988
answer count: 1
linked to: http://stackoverflow.com/q/7038228
has comment: http://stackoverflow.com/comment/40858682
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26077046
type: Question
has body: Hi everyone i try to show content of epub using epublib. this is my code File f = new File(Environment.getExternalStorageDirectory() + "/documents/cindersilly.epub"); String path = f.getPath(); FileInputStream epubInputStream = new FileInputStream(f); Book book = new EpubReader().readEpub(epubInputStream); wvTest.loadDataWithBaseURL(f.getAbsolutePath(), book.getContents().get(0).getData().toString(), "text/html", "UTF-8", null); and i get result : [B@41408d8 what is that? and how to solve this so the content will show on the webview? thanks
has title: why epublib for android web view load data url show [B@41408d8?
has comment: http://stackoverflow.com/comment/40858672
tagged with: epublib
has comment: http://stackoverflow.com/comment/40858473
accepted answer: http://stackoverflow.com/a/26077046
tagged with: android

http://stackoverflow.com/comment/41220024
type: Comment
has text: @JasperN.Brouwer This is comparable to [XDoclet](http://xdoclet.sourceforge.net/xdoclet/index.html) library in java which was create before the annotations were introduced in Java, so this still confirms that Symfony relies on limitations of php, since it needs to use extra library... but after all it is something, I agree.
comment on: http://stackoverflow.com/a/26175026
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41003570
comment on: http://stackoverflow.com/q/26143842
type: Comment
type: QuestionComment
has text: @CommonsWare http://hc.apache.org/httpcomponents-client-4.3.x/android-port.html
score: 0

http://stackoverflow.com/q/26163574
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26163861
score: 0
tagged with: android
has title: Getting entryValue from ListPreference and set the changes
linked to: http://stackoverflow.com/q/6148952
tagged with: listpreference
type: AnsweredQuestion
tagged with: java
has body: I don't understand about getting entryValue from the ListPreference. I want to set localization to my app. But the code must be set before setContentView(R.layout.activity_main);. Simply, my app is a multi-language app. What should I do? And how to get an entryValue from ListPreference? Here is my code: ListPreference <ListPreference android:key="pref.language" android:title="@string/language" android:dialogTitle="@string/select_language" android:entries="@array/pref_language_entries" android:entryValues="@array/pref_language_values" android:defaultValue="en_US" android:summary="%s" /> strings.xml English Indonesian Russian en_US in_ID ru_RU As I know, this code is used to change the locale from an activity: Locale locale = new Locale("entryValue goes here"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); Thanks for your effort...
accepted answer: http://stackoverflow.com/a/26163861

http://stackoverflow.com/comment/86251447
has text: Can you post a link to the library?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26106564
score: 0

http://stackoverflow.com/comment/41008949
comment on: http://stackoverflow.com/q/26159214
has text: u r saying that if at JAVA_HOME enviromental you set JDK 6 , the app is running normally?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/40908336
score: 0
has text: Ahh. I understand now. I was the button was set in the panel therefore not taking up the Center Space of the Frame. Makes sense! Thank you, I appreciate it!
type: Comment
comment on: http://stackoverflow.com/a/26104016
type: AnswerComment

http://stackoverflow.com/comment/40948367
score: 0
comment on: http://stackoverflow.com/q/26125963
type: Comment
type: QuestionComment
has text: @CoryKlein edited my post, it now includes the error

http://stackoverflow.com/q/26048755
has comment: http://stackoverflow.com/comment/40807281
score: 0
tagged with: java
answer count: 1
tagged with: network-programming
type: UnansweredQuestion
has body: I learned Java Swing enough for developing some not so complicated applications, such as Hotel Management, some Cafe Bar tools and so. I also made some tools for myself. Now, my brother opened a Internet And Gaming Center, and asked me if I can make some simple software for managing time counters for each PC he has, extend, reduce time and so on. So I ask which aspects I have to learn now in order to be able to do this? What do I need to upgrade my knowledge. Is this a Java Server Sockets and Client Sockets? Java Thread server?
has title: Java network Development
type: Question
has answer: http://stackoverflow.com/a/26048922

http://stackoverflow.com/q/26068048
tagged with: security
tagged with: stereotype
has answer: http://stackoverflow.com/a/26150944
has title: Multiple Deltasike securityBindingType annotations on class
tagged with: deltaspike
has body: I'm using the Deltaspike (1.0.3) security Module with @Secured (functionality that allows to integrating 3rd party security frameworks). Is working well when I use only one annotation(SecurityBinding) on class level. When I add a second one annotation on the same class the CustomAccessDecisionVoter for the second securityBinding is never called. As I understend the api - is possible to have multiples annotations on class level, but is not working in my case. What I'm doing wrong? This is how I declare a SecurityBinding: @Retention(value = RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Documented @Stereotype @Secured(AnnotationOneAccessDecisionVoter.class) public @interface AnnotationOne { } This is the Custom AccessDecisionVoter for the AnnotationOne: @ApplicationScoped public class AnnotationOneAccessDecisionVoter implements AccessDecisionVoter { public Set&lt;SecurityViolation&gt; checkPermission(AccessDecisionVoterContext voterContext) { Set&lt;SecurityViolation&gt; violations = new HashSet&lt;SecurityViolation&gt;(1); if(some validation...) { violations.add(new SecurityViolation() { private static final long serialVersionUID = ...; @Override public String getReason() { return "..."; } }); Anf finnally the bean: @Named("...") @ViewScoped //Permission @AnnotationOne @AnnotationTwo public class Bean implements Serializable {...}
accepted answer: http://stackoverflow.com/a/26150944
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
answer count: 1
tagged with: jsf-2.2

http://stackoverflow.com/comment/40906685
comment on: http://stackoverflow.com/q/26095538
score: 0
type: Comment
type: QuestionComment
has text: Just to be sure - you want the data to scroll across the screen at a rate of 25 millimeters per second? If so, how close is the result of what you currently have above?

http://stackoverflow.com/comment/40899764
type: Comment
type: QuestionComment
score: 8
has text: You don't get to throw exceptions at compile time.
comment on: http://stackoverflow.com/q/26099616

http://stackoverflow.com/comment/41021872
has text: Already exists in mockito : `AddtionalAnswers.returnsFirstArg()`
type: AnswerComment
comment on: http://stackoverflow.com/a/26161959
type: Comment
score: 27

http://stackoverflow.com/comment/137196893
comment on: http://stackoverflow.com/q/26190851
score: 0
type: QuestionComment
has text: @ccjmne Happy NY to you, too. If this method is ineffective, is very important for me, but you mentioned incorrectness. The question we are all solving here is about SOME solution. Sometimes the better solution is easy and fast in writing, sometimes the better solution is fast in running. The question is: if jackson is useful for the second case , or it is better to use GSon? I always thought that jackson is a cheap solution for easy cases.
type: Comment

http://stackoverflow.com/comment/120513787
type: AnswerComment
comment on: http://stackoverflow.com/a/68188085
type: Comment
has text: This is a java question. Not dotnet. The api of `ArrayList` is quite the same, but java don't use first upper case method names.
score: 0

http://stackoverflow.com/q/26180650
has body: I'm developing a Java application that connects to SOAP services exposed at https://ut.eurodw.eu/ (test environment for European Datawarehouse). I'm working on my development machine, recently reformatted with Windows 8.1. Today, I tried to send them a creation request via SOAP from my program and got this error: Caused by: javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146) at com.sun.proxy.$Proxy110.createDeal(Unknown Source) at it.csttech.edwin.services.spring.EdwinServiceImpl.createDeal(EdwinServiceImpl.java:102) at it.csttech.edwin.consumercredit.data.managers.spring.DealManagerImpl.createEdCode(DealManagerImpl.java:319) ... 77 more Caused by: javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking https://ut.eurodw.eu/edservices/2.2/DealService.svc: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1339) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1323) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:628) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) at org.apache.cxf.endpoint.ClientImpl.doInvo…
tagged with: java
score: 34
downvote count: 1
type: Question
tagged with: ssl
tagged with: ssl-certificate
has answer: http://stackoverflow.com/a/26183328
has title: "unable to find valid certification path to requested target", but browser says it's OK
upvote count: 35
answer count: 1
accepted answer: http://stackoverflow.com/a/26183328
tagged with: windows-8.1
favorite count: 0
linked to: http://stackoverflow.com/q/21076179
has comment: http://stackoverflow.com/comment/41107766
tagged with: tomcat7
duplicate of: http://stackoverflow.com/q/21076179
type: AnsweredQuestion

http://stackoverflow.com/q/26063603
upvote count: 1
type: Question
answer count: 1
downvote count: 0
tagged with: messagebroker
tagged with: jms
favorite count: 0
has body: My Goal + Progress I'm interested in using ActiveMQ to publish a message to a topic and have it bridge to multiple queues. I have managed to achieve this with the command-line broker by providing an xml-config containing a composite topic: &lt;destinationInterceptors&gt; &lt;virtualDestinationInterceptor&gt; &lt;virtualDestinations&gt; &lt;compositeTopic name="LOCAL.EC.T"&gt; &lt;forwardTo&gt; &lt;queue physicalName="LOCAL.EC.Q.1" /&gt; &lt;queue physicalName="LOCAL.EC.Q.2" /&gt; &lt;/forwardTo&gt; &lt;/compositeTopic&gt; &lt;/virtualDestinations&gt; &lt;/virtualDestinationInterceptor&gt; &lt;/destinationInterceptors&gt; Using this start-up command: activemq start xbean:amq.xml. In this case, amq.xml is my active MQ XML configuration file. There is more on xml configuration here: http://activemq.apache.org/xml-configuration.html. My Problem If I publish a message to the topic above using the web console, it shows up in both queues as expected. But now I want to switch to using an embedded broker. In the following code, I can tell that it is using my amq.xml file (as when I change it I get relevant errors), but when I publish to the topic, the receive on the queue blocks forever. If I publish and receive to the same topic or queue though, everything works fine. Why is my composite topic not working here? //Create the broker using the xbean configuration and start it. brokerService = BrokerFactory.createBroker(new URI("xbean:amq.xml")); brokerService.setBrokerName("localhost"); brokerService.setPersistent(false); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setUseJmx(false); brokerService.start(); //Create the connection factory and JMS template. connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL("vm://localhost?create=false&amp;jms.redeliveryPolicy.maximumRedeliveries=-1"); //Send the message to the topic. template = new JmsTemplate(connectionFactory); ActiveMQMapMessage message = new ActiveMQMapMessage(); message.…
type: UnansweredQuestion
has title: ActiveMQ embedded broker topic-to-queue bridge with XML config
tagged with: activemq-classic
score: 1
has answer: http://stackoverflow.com/a/26065806
tagged with: java

http://stackoverflow.com/comment/40956183
type: Comment
type: AnswerComment
has text: Next time when you can't remove getters you will come back here for the solution. See also http://stackoverflow.com/a/24445373/573032
comment on: http://stackoverflow.com/a/26097092
score: 0

http://stackoverflow.com/q/26067405
linked to: http://stackoverflow.com/q/24779440
upvote count: 1
has answer: http://stackoverflow.com/a/26089438
has answer: http://stackoverflow.com/a/76045380
favorite count: 0
has comment: http://stackoverflow.com/comment/40844721
tagged with: out-of-memory
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/26086917
tagged with: apache-poi
downvote count: 0
score: 1
tagged with: java
has body: I am trying to parse a large excel file(.xlsx) using Apache POI XSSF library. After 100,000 rows it throws heap space error. I tried increasing the memory but it does not help. Is there a workaround for this problem? Or can someone suggest me a another library to parse large excel files. Thanks!
type: Question
has title: Heap space error with Apache POI XSSF
has answer: http://stackoverflow.com/a/26067521

http://stackoverflow.com/a/26063890
has body: As shown here for JTable, you can override the list's getPreferredScrollableViewportSize() method to specify the initial, preferred size. Uisng a multiple of getRowHeight() offers a nice appearance.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26063639
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40836168
has comment: http://stackoverflow.com/comment/40835952

http://stackoverflow.com/a/26094127
answers question: http://stackoverflow.com/q/26094081
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40890429
type: Answer
has body: This will not even compile as the line System.out.println(); is after `return` statement,hence it is unreachable Just print the value you are returning using this:- public class Practice { public static void main(String[] args){ System.out.println( min(3, -2, 7)); System.out.println(min(19, 27, 6)); } public static int min(int number1, int number2, int number3){ return Math.min(number1, Math.min(number2, number3)); } }
accepted answer of: http://stackoverflow.com/q/26094081
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40890888
has comment: http://stackoverflow.com/comment/40890531
has comment: http://stackoverflow.com/comment/40890837

http://stackoverflow.com/a/26146621
downvote count: 0
upvote count: 2
has body: You can't instantiate with a wildcard. You have to specify the type. "?" isn't a type. This is okay, because you're giving List&lt;?&gt; a type, which is Set&lt;?&gt;. Set&lt;?&gt; is a type. Correct. ArrayList&lt;T&gt; is a subtype of List&lt;T&gt;. This is where things get ugly. The right hand is not a subtype of the left hand, because of the screwy way that Java deals with type parameters. The type parameters have to match exactly, or you have to use covariance/contravariance (the &lt;A extends B&gt; or &lt;A super B&gt; stuff). List&lt;String&gt; is not a subtype of List&lt;Object&gt;. It is a subtype of List&lt;? extends Object&gt; or just List&lt;?&gt;. Same as above. If you had declared it as List&lt;? extends Set&lt;?&gt;&gt; it would work.
has comment: http://stackoverflow.com/comment/40985901
has comment: http://stackoverflow.com/comment/40988836
type: Answer
answers question: http://stackoverflow.com/q/26146371
has comment: http://stackoverflow.com/comment/40985962
has comment: http://stackoverflow.com/comment/40987116
score: 2

http://stackoverflow.com/a/26056707
score: 0
type: Answer
has body: Your java code and keystore looks good. Maybe text encoding is different in C# and java and you getting different byte arrays to sign. In that case you will getting different result. Try to compare raw bytes before signing. Maybe you are use different keys - double check path to private keys on both platform.
answers question: http://stackoverflow.com/q/26053991

http://stackoverflow.com/q/26051899
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40814920
linked to: http://stackoverflow.com/q/4240080
score: 1
has comment: http://stackoverflow.com/comment/40813039
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26061703
has answer: http://stackoverflow.com/a/26056865
has answer: http://stackoverflow.com/a/26053284
has answer: http://stackoverflow.com/a/26053152
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40813480
has body: I need to compute and get all the permutations for a large number. Like an array which contains 13 numbers. But though the code I found from the internet worked for 10 values , for 13 numbers it doesn't work as I got an Exception. It says the memory is not enough to show the total permutations. I do not need to print the permutations. For me storing them in the database will be perfectly oki. Still can't I do the calculation if I directly store them in the database. I couldn't find a proper answer for this from internet. This is the code I used to calculate the permutations. public class PermutationCalc { /** * @param args the command line arguments */ static &lt;E&gt; String arrayToString( E[] arr ) { final StringBuffer str = new StringBuffer(); for ( E e : arr ){ str.append( e.toString() ); } return str.toString(); } static &lt;E&gt; ArrayList&lt;E[]&gt; permutations(E[] arr) { final ArrayList&lt;E[]&gt; resultList = new ArrayList&lt;E[]&gt;(); final int l = arr.length; if ( l == 0 ) return resultList; if ( l == 1 ) { resultList.add( arr ); return resultList; } E[] subClone = Arrays.copyOf( arr, l - 1); System.arraycopy( arr, 1, subClone, 0, l - 1 ); for ( int i = 0; i &lt; l; ++i ){ E e = arr[i]; if ( i &gt; 0 ) subClone[i-1] = arr[0]; final ArrayList&lt;E[]&gt; subPermutations = permutations( subClone ); for ( E[] sc : subPermutations ) { E[] clone = Arrays.copyOf( arr, l ); clone[0] = e; System.arraycopy( sc, 0, clone, 1, l - 1 ); resultList.add( clone ); } if ( i &gt; 0 ) subClone[i-1] = e; } return resultList; } static ArrayList&lt;String&gt; permutations(String arr) { final Character[] c = new Character[arr.length()]; for ( int i = 0; i &lt; arr.length(); ++i ) c[i] = arr.charAt( i ); final ArrayList&lt;Character[]&gt; perms = permutations(c); final ArrayList&lt;String&gt; resultList = new ArrayList&lt;String&gt;( perms.size() ); for ( Character[] p : perms ) { resultList.add( arrayToString( p ) ); } return resultList; } public static void main(String[] args…
has title: Storing the permutation of a large number in a database
answer count: 5
has answer: http://stackoverflow.com/a/26052737

http://stackoverflow.com/comment/40913160
type: Comment
type: QuestionComment
has text: You already have, it's running as `root` which is the super-user (e.g. Administrator) on UNIX systems.
score: 2
comment on: http://stackoverflow.com/q/26106723

http://stackoverflow.com/comment/40941371
comment on: http://stackoverflow.com/a/26121130
has text: Yes @Iker-Aguayo there are not hosted by Maven Central, but we've added the JBoss repository in our Nexus (https://repository.jboss.org/nexus/content/groups/public/), as a proxy repository, to get those artifacts. And in that repository, you can find the artifact: https://repository.jboss.org/org/jboss/seam/seam-bom/3.1.0.Final/seam-bom-3.1.0.Final.pom
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26085490
has body: presumably because there are no cases after 9. Your code is using UNICODE superscript characters, and the cases that you have cover only numbers zero through ten for x and zero through nine for y. You can fix this by defining a method that produces a superscript UNICODE conversion of a multidigit number, and calling it from both places where you need to produce such representation: switch (powx) { case 0: System.out.print ("("+nCr*y*z); break; case 1: System.out.print ("("+nCr*y*z+"x"); break; default: System.out.print ("("+nCr*y*z+"x"+toSuperscript(powx)); break; } The other switch (i.e. switch (r)) should be converted in a similar way. You can implement String toSuperscript(int n) by producing a decimal representation of n, and then replacing '0' with '\u2070', '1' with '\u00B9', and so on.
upvote count: 2
answers question: http://stackoverflow.com/q/26085361
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/26163316
tagged with: http://stackoverflow.com/tag/xml
score: 2
has comment: http://stackoverflow.com/comment/41061538
downvote count: 0
tagged with: java
tagged with: web-services
has body: hi i am going to develop web-services in java (NetBeans) but have problems with get conection, i get the following error: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.net.UnknownHostException: C Caused by: java.net.UnknownHostException: C at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:957) at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917) at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012) at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998) at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294) at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393) at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:103) at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:179) at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:158) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(Proper at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:68) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:76) at com.rsa.ims.components.spring.SimpleAp…
type: Question
has title: Could not load properties
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/28901853
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/26163183
has comment: http://stackoverflow.com/comment/41016945
has comment: http://stackoverflow.com/comment/41016470
has comment: http://stackoverflow.com/comment/41017447
tagged with: java
has answer: http://stackoverflow.com/a/26163913
has title: How to read integers from System.in with BufferedReader?
has comment: http://stackoverflow.com/comment/41016478
type: Question
has comment: http://stackoverflow.com/comment/41017158
has comment: http://stackoverflow.com/comment/41017352
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/41017236
has comment: http://stackoverflow.com/comment/41017405
score: 0
has comment: http://stackoverflow.com/comment/41017052
has comment: http://stackoverflow.com/comment/41016629
has comment: http://stackoverflow.com/comment/41017346
has body: I want to take input as 1 to 10 numbers using BufferedReader. For that i am using a loop. ERROR is : Exception in thread "main" java.lang.NumberFormatException: For input string: "" The code is : import java.io.*; class TEST { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int input=0; for(int i=0;i&lt;10;i++) { input = Integer.parseInt(br.readLine()); } } }
answer count: 1
has comment: http://stackoverflow.com/comment/41017125
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41016899

http://stackoverflow.com/a/26098254
accepted answer of: http://stackoverflow.com/q/26097214
type: Answer
has comment: http://stackoverflow.com/comment/106909386
has comment: http://stackoverflow.com/comment/78531394
score: 1
has comment: http://stackoverflow.com/comment/40898142
upvote count: 5
has comment: http://stackoverflow.com/comment/40897857
has body: You can use the java.security.cert.CertificateFactory to validate your certificate chain. InputStream inStream = ByteArrayInputStream(&lt;data&gt;); CertificateFactory cf = CertificateFactory.getInstance("X.509"); CertPath cp = cf.generateCertPath(inStream); List&lt;Certificate&gt; certs = cp.getCertificates(); The certs now contains the certificate chain. The first entry in certs (certs[0]) contais the certificate and the following certificates are the chain. The last entry in certs is the root certificate which should be compared to a already existing certificate in your application. In the case that the certification path could not be built up the above code will throw a CertificateException.
downvote count: 4
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26097214

http://stackoverflow.com/q/26100947
has comment: http://stackoverflow.com/comment/40908303
tagged with: maven
has comment: http://stackoverflow.com/comment/40902516
has comment: http://stackoverflow.com/comment/40902411
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40903721
has title: Why is this class in my Java 6 JDK look like the Java 5 version?
tagged with: java
has comment: http://stackoverflow.com/comment/40905217
has comment: http://stackoverflow.com/comment/40907342
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/26104319
answer count: 1
has body: I'm running IntelliJ with Java 6 to build my project. I'm doing a clean checkout via SVN and trying to do a mvn clean install It runs successfully but then when I try to deploy my application I get a compile time error. It says that I'm trying to use a constructor that doesn't exist. Specifically, I'm trying to use a constructor from Here . This constructor is NOT in the Java 5 version. But for some reason, the .class file in my jdk 1.6 install appears to be the Java 5 version. The location of the .class file is /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar!/javax/xml/ws/Service.class and that path was copied directly from IntelliJ when I drill down . Here is the decompiled code from IntelliJ // IntelliJ API Decompiler stub source generated from a class file // Implementation of methods is not available package javax.xml.ws; public class Service { private javax.xml.ws.spi.ServiceDelegate delegate; protected Service(java.net.URL url, javax.xml.namespace.QName qName) { /* compiled code */ } public &lt;T&gt; T getPort(javax.xml.namespace.QName qName, java.lang.Class&lt;T&gt; aClass) { /* compiled code */ } public &lt;T&gt; T getPort(javax.xml.namespace.QName qName, java.lang.Class&lt;T&gt; aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ } public &lt;T&gt; T getPort(java.lang.Class&lt;T&gt; aClass) { /* compiled code */ } public &lt;T&gt; T getPort(java.lang.Class&lt;T&gt; aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ } public &lt;T&gt; T getPort(javax.xml.ws.EndpointReference endpointReference, java.lang.Class&lt;T&gt; aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ } public void addPort(javax.xml.namespace.QName qName, java.lang.String s, java.lang.String s1) { /* compiled code */ } public &lt;T&gt; javax.xml.ws.Dispatch&lt;T&gt; createDispatch(javax.xml.namespace.QName qName, java.lang.Class&lt;T&gt; aClass, javax.xml.ws.Serv…
has comment: http://stackoverflow.com/comment/40902584
tagged with: intellij-13
has comment: http://stackoverflow.com/comment/40903915
accepted answer: http://stackoverflow.com/a/26104319
linked to: http://stackoverflow.com/q/14131503
score: 0

http://stackoverflow.com/a/26189726
has body: myHandler is not being initialised, and since the initialize() method isn't being called in your onCreate(), myRunnable is also not initialised before you try to post it.
score: 0
accepted answer of: http://stackoverflow.com/q/26189649
answers question: http://stackoverflow.com/q/26189649
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26193029
type: Answer
score: 2
upvote count: 2
has body: Use a FutureTask and implement a Callable. public class Foo implements Callable&lt;String&gt; { @Override public String call() { String result = null; HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); HttpResponse response; try { HttpPost post = new HttpPost("http://www.example.com/json_android.php"); StringEntity se = new StringEntity( json.toString()); se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(se); response = client.execute(post); if(response!=null){ InputStream stream = response.getEntity().getContent(); result = convertToString(stream); /* I can Log result with below line */ Log.e("response is: ", result); /* result is {"username = ":"Hello"} */ } } catch(Exception e) { e.printStackTrace(); Log.e("Error", String.valueOf(e)); } return result; } } and than use it with the FutureTask public String request() throws ExecutionException, InterruptedException { Foo foo = new Foo(); FutureTask&lt;String&gt; fooFuture = new FutureTask&lt;String&gt;(foo); new Thread(fooFuture).start(); return fooFuture.get(); }
accepted answer of: http://stackoverflow.com/q/26192965
answers question: http://stackoverflow.com/q/26192965
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41075138
downvote count: 0

http://stackoverflow.com/a/26071244
has body: nah, you dont need that second while loop. what you need is add sum every loop with finalaverage and increment count each loop while(again!=0){ ... sum += finalaverage; count++; } full source is like this : public static void main(String[] args) { float discussionweight, hwweight, examweight, discussion, hw, exam, finalaverage = 0; Scanner scan = new Scanner(System.in); System.out.print("Enter the weight of the discussions as an integer: "); discussionweight = scan.nextFloat(); // Prompts for the weight of the homework grade in an integer System.out.print("Enter the weight of the homework as an integer: "); hwweight = scan.nextFloat(); System.out.print("Enter the weight of the exam as an integer:"); examweight = scan.nextFloat(); int again = -1; int count = 0, sum = 0; while (again != 0) { count++; System.out.print("Enter the students name: "); String student = scan.next(); // Prompts for the discussions grade System.out.print("Enter the score of the discussion as an integer: "); discussion = scan.nextFloat(); // Prompts for hw grade System.out.print("Enter the hw grade: "); hw = scan.nextFloat(); System.out.print("Enter the exam grade"); exam = scan.nextFloat(); finalaverage = (((discussionweight * discussion) + (hw * hwweight) + (exam * examweight)) / 100); if (finalaverage &gt;= 90) { System.out.println(student + "'s " + "final grade is an A."); } else if (finalaverage &gt;= 80) { System.out.println(student + "'s " + "final grade is a B."); } else if (finalaverage &gt;= 70) { System.out.println(student + "'s " + "final grade is a C."); } else if (finalaverage &gt;= 60) { System.out.println(student + "'s " + "final grade is a D."); } else if (finalaverage &gt;= 10) { System.out.println(student + "'s " + "final grade is an F."); } System.out.println("The final average is " + finalaverage); sum += finalaverage; System.out.print("Would you like to continue? Enter 0 to exit or enter 1 to continue."); again = scan.nextInt(); } System.out.print("End Gradebook"); // set …
type: Answer
answers question: http://stackoverflow.com/q/26070832
score: 0

http://stackoverflow.com/a/26104737
has comment: http://stackoverflow.com/comment/40924525
type: Answer
has body: the first app doesn't have spring configuration, which you can see clearly by comparing your code with example on spring.io. for the second, i guess it's because spring-boot has a different version of spring-core. you should start from following the official guide, before doing such an experiment
has comment: http://stackoverflow.com/comment/40921950
has comment: http://stackoverflow.com/comment/40909274
answers question: http://stackoverflow.com/q/26102916
score: 0

http://stackoverflow.com/q/26085454
has comment: http://stackoverflow.com/comment/40874204
tagged with: generator
has comment: http://stackoverflow.com/comment/40877020
tagged with: java
linked to: http://stackoverflow.com/q/363681
accepted answer: http://stackoverflow.com/a/26085512
has comment: http://stackoverflow.com/comment/40874239
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40874150
has title: Code with random number generator and loop
downvote count: 5
favorite count: 0
has comment: http://stackoverflow.com/comment/40874157
tagged with: random
type: Question
possible better answer: http://stackoverflow.com/a/26085479
score: -2
has answer: http://stackoverflow.com/a/26085479
has body: I use this random number generator and it works fine but then I needed a range (e.g. 16-20) of numbers but I can't get it to work. I have no idea what to do. for (int i = 1; i &lt;= 1; i++) { int RandomAttack = (int) Math.random() * 20; System.out.println(RandomAttack); } I need the simplest code there is.
has answer: http://stackoverflow.com/a/26085512
upvote count: 3
answer count: 2

http://stackoverflow.com/comment/40793688
comment on: http://stackoverflow.com/q/26041546
type: QuestionComment
has text: Debug that program in an IDE such as Eclipse, and you can follow the flow in detail.
score: 0
type: Comment

http://stackoverflow.com/a/26127546
has comment: http://stackoverflow.com/comment/40952402
has comment: http://stackoverflow.com/comment/40952766
has body: The first 2 lines of Map javadoc explains it all. public interface Map&lt;K,V&gt; An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value. The javadoc for Map can be found here - http://docs.oracle.com/javase/7/docs/api/java/util/Map.html
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26127225

http://stackoverflow.com/q/26104672
type: Question
has answer: http://stackoverflow.com/a/26104776
score: 0
answer count: 2
has title: How does this void function for deleting a duplicate linkedlists accomplish anything? Parameter passing in Java
has answer: http://stackoverflow.com/a/26104762
accepted answer: http://stackoverflow.com/a/26104776
tagged with: parameter-passing
possible better answer: http://stackoverflow.com/a/26104762
tagged with: parameters
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has body: So I'm looking through problems in Gayle Lackermaan's Cracking the Coding Interview, and came upon this question: Write code to remove duplicates from an unsorted linked list The solution is this public static void deleteDups (LinkedListNode n){ Hashset&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); LinkedListNode previous = null; while(n!=null){ if(set.contains(n.data){ previous.next = n.next; } else { set.add(n.data); previous = n; } n = n.next; } } I don't understand the point of previous; The scope of previous is within the function, since it is created inside the function, right? It isn't being used for anything, so why is it there? Also, previous doesn't seem to be moving forward; instead isn't it just being overridden with every iteration? Also, if I understand Java's passing by value reference style, passing a head node n into a function that does n = n.next a bunch of times will not affect the value of n after it returns right? What if the function did a bunch of n.next = n, or n.data = 3? Would that affect the value of n after it returns? (I assume yes) I've looked this function for a long time, and I still don't see how calling it will do anything.

http://stackoverflow.com/comment/40809692
type: Comment
type: QuestionComment
has text: Yes, so it would go and highlight `doEvenMoreStuff()` in the method `doStuff()` and say something like, "Redundant method call"
comment on: http://stackoverflow.com/q/26050157
score: 0

http://stackoverflow.com/comment/41988440
type: Comment
score: 0
has text: You *can* have multiple frames open. Is an exception being thrown?
type: QuestionComment
comment on: http://stackoverflow.com/q/26087622

http://stackoverflow.com/comment/40881479
comment on: http://stackoverflow.com/q/26089184
score: 0
type: QuestionComment
type: Comment
has text: @HovercraftFullOfEels which do you prefer for my situation? I have no experience with Serialization, any helpful links/tutorials/guides? Thanks

http://stackoverflow.com/q/26137291
upvote count: 3
has answer: http://stackoverflow.com/a/26137383
has title: WHo will decide that any object is eligible for garbage collection and what are the parameters that decides this?
answer count: 3
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/3299604
has answer: http://stackoverflow.com/a/26137391
has answer: http://stackoverflow.com/a/26137402
downvote count: 0
has body: When is any particular object eligible for garbage collection? And which are the parameters that comes into consideration which deciding this? MyClass mc = new MyClass(); mc.myMethod(); //line1 mc=null; //line2 mc=new object(); //line3 mc.myMethod(); //line4 mc=null; //line5 In this case, when mc object is eligible for garbage collection?
tagged with: garbage-collection
linked to: http://stackoverflow.com/q/3299604
has comment: http://stackoverflow.com/comment/40968382
type: Question
score: 3
has comment: http://stackoverflow.com/comment/40968444
tagged with: java

http://stackoverflow.com/comment/101291799
score: 1
comment on: http://stackoverflow.com/a/26245584
has text: the .getClassLoader().getResource(".").getFile() version did the trick for me in Netbeans with compile on save active. No other way worked
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26053729
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26053286
has body: Maybe if you tell eclipse not to build automatically and build it by yourself in mvn and then run in eclipse.
has comment: http://stackoverflow.com/comment/40817266

http://stackoverflow.com/comment/40981727
comment on: http://stackoverflow.com/q/26139384
has text: Even after you updated the question the code is bogus. E.g. your pointcut is unclear. Provide a real example, please, optimally an [SSCCE](http://sscce.org/) including an application class the aspect is applied upon. Another mistake is that you cannot pass anything to `proceed()` which has not been bound to a parameter in the pointcut. If you provide a real example I can provide a real solution. Pseudo code without relevant information just does not work here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26125117
accepted answer: http://stackoverflow.com/a/26125193
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/38660713
tagged with: tomcat
tagged with: controller
score: 0
has body: I have a context parameter defined in tomcat server config xml for a given webapp. I want to use this value in a spring mvc controller. How do I achieve this? How do I make the context param visible to the spring controller?
answer count: 3
has answer: http://stackoverflow.com/a/26125193
tagged with: context-param
possible better answer: http://stackoverflow.com/a/26158994
has answer: http://stackoverflow.com/a/26158994
has title: Pass Servlet Context Parameter to a Spring MVC Controller
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/q/26077387
has body: I'm trying to draw an animated gif image on a JFrame. At the moment, this is how I'm doing it: public class JImageComponent extends JComponent { private static final long serialVersionUID = -6926323540532721196L; private final Image image; public JImageComponent(Image image) { this.image = image; } public JImageComponent(byte[] data) { this(Toolkit.getDefaultToolkit().createImage(data)); } @Override protected void paintComponent(Graphics graphics) { super.paintComponent(graphics); final int centerX = getWidth() / 2 - image.getWidth(this) / 2; final int centerY = getHeight() / 2 - image.getHeight(this) / 2; graphics.drawImage(image, centerX, centerY, this); } } This is fine, however, (because there's shading on the edge) if i have a background colour set, it shows a nasty white edge. I think i know what's causing this, it's because of the the Image class does not utilise an alpha channel. I don't know how to make the image use a 32-bit colour model using the 8 most significant bits as the alpha value. Any help is appreciated! Thanks. Edit: when I tried using a ImageIO and a BufferedImage, it didn't animate. Apparently this is because it doesn't update the ImageObserver Edit: This is what the image looks like when there's a background: http://puu.sh/bQ5sZ.png I don't want that white edge, it should look like this: http://puu.sh/bQ5Ya.png. Like i said previously, i know why it's happening; I need the Image class to use RGBA not RBG.
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/26077929
tagged with: http://stackoverflow.com/tag/gif
tagged with: java
tagged with: image
has title: JFrame drawing an animated gif image with an alpha channel
answer count: 1
has comment: http://stackoverflow.com/comment/40859462
linked to: http://stackoverflow.com/q/10861852
score: 0
has answer: http://stackoverflow.com/a/26077929
has comment: http://stackoverflow.com/comment/40859697
tagged with: animated-gif
type: AnsweredQuestion

http://stackoverflow.com/comment/40986800
has text: ummm, that's strange, but anyway thanks for the help:)
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26147001

http://stackoverflow.com/a/26061302
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40830178
has comment: http://stackoverflow.com/comment/40832476
type: Answer
has comment: http://stackoverflow.com/comment/40831909
has comment: http://stackoverflow.com/comment/40830767
has comment: http://stackoverflow.com/comment/40831102
accepted answer of: http://stackoverflow.com/q/26061217
answers question: http://stackoverflow.com/q/26061217
score: 4
has comment: http://stackoverflow.com/comment/40830951
has body: Run At Login (manually) Once you packaged your app, you can just put java -jar your-app.jar in a .bat file in the Windows startup menu. If you don't want to create a jar (e.g. because your app is simple enough) and always assuming you have your Java environment variables configured (JAVA_HOME, PATH....), you can just run directly your bytecode: startup.bat: cd your/app/bytecode/path java yourapp See here how to start an app at startup. Run at Startup (manually) If you need the application to run before the user login you can use the Windows Task Scheduler, and use the trigger at startup, wrapping your application as described in this OS answer: @echo off REM Eventually change directory to the program directory cd C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\ REM run the program "C:\Program Files\Java\jdk1.7.0\bin\java.exe" -jar "C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\Facebook.jar" Run at Startup (installer) In case you really don't want any user interaction the only easy (and IMHO ethic) solution I imagine is the Installer. You basically need a wizard installing your application for you (and for the user) configuring it to run at startup. There are many wizards, you can build your own or start your research having a look here. Run at Startup (standalone) Use the approach described here, writing something like this directly in your small application (original post here): static final String REG_ADD_CMD = "cmd /c reg add \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"{0}\" /d \"{1}\" /t REG_EXPAND_SZ"; private void exec(String[] args) throws Exception { if (args.length != 2) throw new IllegalArgumentException("\n\nUsage: java SetEnv {key} {value}\n\n"); String key = args[0]; String value = args[1]; String cmdLine = MessageFormat.format(REG_ADD_CMD, new Object[] { key, value }); Runtime.getRuntime().exec(cmdLine); } Key is your app name (not relevant), Value is your jar file or the .bat command that runs your …

http://stackoverflow.com/q/26114782
type: UnansweredQuestion
score: 2
downvote count: 0
has body: Sometimes you have to decide between using a Singleton object (a real singleton, or just a de facto singleton like an injected bean), or just using new every time. What you do really depends on the object. If an object takes a minute to create and 10MB of memory, you do not want to create more than one if it is not necessary. But if it takes only a millisecond and 20 bytes of memory, who cares if you create 10 of them in your whole application, and the additional complications of a singleton are not worth it in my opinion. But I would like to measure this. I found some options to see the memory usage using the Instrumentation package, but that seems to be quite difficult and cumbersome to use. So I wondered, is there some nice trick I can use, in a unit test for example, just to get some ball park figure about the memory and timing properties of an object? To clarify: With singleton in this context I mean: An object you create only one of. Not a real singleton where you enforce that there is only one. For example, we use resteasy to generate REST proxies. You can get the proxy with dependency injection: @Bean @Autowired public AccountRequestResource accountsServiceClient(JaxRsProxyClientBuilder builder) { return builder.createProxy(AccountRequestResource.class, accountsServiceBaseUrl); } @Autowired AccountRequestResource accountsServiceClient Or you can just construct a new one for every class where you need it: AccountRequestResource accountsServiceClient = builder.createProxy(AccountRequestResource.class, accountsServiceBaseUrl) I would like to measure these kind of problems in the general case (not just resteasy, but any type of injected object).
favorite count: 0
type: Question
tagged with: singleton
has comment: http://stackoverflow.com/comment/40927290
has answer: http://stackoverflow.com/a/26115213
upvote count: 2
has title: Singleton or not. How to measure?
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26115115

http://stackoverflow.com/q/26084436
has body: Can anyone suggest a tool to measure efficiency of Java code, that's able to give identical results across machines (for the same code, same JVM versions)? Idea is to compare code execution - but not to measure execution time as this will vary across different hardware. So perhaps to report "execution steps" or "units of work" or something similar.
has comment: http://stackoverflow.com/comment/40874789
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26084839
tagged with: java
has comment: http://stackoverflow.com/comment/40872805
has comment: http://stackoverflow.com/comment/40874940
type: Question
tagged with: benchmarking
tagged with: performance
has comment: http://stackoverflow.com/comment/40872367
has comment: http://stackoverflow.com/comment/40872663
downvote count: 6
has comment: http://stackoverflow.com/comment/40874854
answer count: 1
score: -6
favorite count: 0
has title: Java code - consistent measurements across hardware?
accepted answer: http://stackoverflow.com/a/26084839

http://stackoverflow.com/comment/41297054
comment on: http://stackoverflow.com/a/26115878
type: Comment
score: 0
has text: Thanks a lot. This almost resolved my query. Only a doubt. What s the format of calling the class here. If i write Result result = junit.run(myClassName); it says myClassName cannot be resolved to a variable.
type: AnswerComment

http://stackoverflow.com/comment/40858702
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26077072
has text: possible duplicate of [Printing Runtime exec() OutputStream to console](http://stackoverflow.com/questions/3936023/printing-runtime-exec-outputstream-to-console)

http://stackoverflow.com/comment/40919893
has text: Where did you find the signature for the superclass method?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26110475
type: AnswerComment

http://stackoverflow.com/comment/41035323
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/26173133
type: Comment
has text: Wow... September... StudentOverflow

http://stackoverflow.com/a/26511523
answers question: http://stackoverflow.com/q/26163990
has comment: http://stackoverflow.com/comment/43674981
upvote count: 6
has comment: http://stackoverflow.com/comment/41847881
type: Answer
score: 6
has body: I had the same problem after updating from BugSense to Splunk Mint and there was nothing wrong with my code. After I commented out Splunk.init(...) method invocation everything started to work again. Problem was occuring only on HTC devices and with Splunk Mint enabled - all calls of HttpClient#execute() method were throwing DelegationException. Not sure if this is your case but maybe my answer will help someone with the same problem as mine.
has comment: http://stackoverflow.com/comment/42687068
downvote count: 0

http://stackoverflow.com/q/26083655
has body: I'm using the JSON API Java library to upload objects to Google Cloud Storage. I've figured out how to add the entity allUsers with role READER to get public access, but any other entity/role entries I try to add to my list of ObjectAccessControl produce some generic errors like com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid Value", "reason" : "invalid" } ...for each ACL entry I have, except the allUsers READER one which seems to work I'm not sure what it's complaining about here. I'm trying to reproduce the default permissions I see in the Developers Console, i.e. when I don't specify any ACL on the metadata. owners-projectId owner, editors-projectId owner, viewers-projectId reader, and user Id owner (I am guessing this is the service account ID) I'm adding these to the ACL list the same way as the allUsers entity. I've searched for hours trying to find some documentation or similar issues to this, but only found the one regarding allUsers. I've tried escaping these ids, thinking the JSON library might not be doing so for me, but get the same errors. Here's my relevant Java code: // Set permissions and content type on StorageObject metadata StorageObject objectMetadata = new StorageObject(); // set access control List&lt;ObjectAccessControl&gt; acl = Lists.newArrayList(); acl.add(new ObjectAccessControl().setEntity("allUsers").setRole("READER")); // this one allows upload to work without error if it is the only access specified, // but prevents me from modifying publicly available status or editing permissions // via the developers console (I think this is to be expected) // attempt to replicating bucket defaults... // adding any of these will cause the error acl.add(new ObjectAccessControl().setEntity("owners-projectId").setRole("OWNER")); acl.add(new ObjectAccessControl().setEntityId("editors-projectId").setRole("OWNER")); acl.add(new ObjectAccessControl().s…
type: AnsweredQuestion
tagged with: acl
possible better answer: http://stackoverflow.com/a/30487407
has answer: http://stackoverflow.com/a/30487407
upvote count: 1
has comment: http://stackoverflow.com/comment/40906989
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: google-cloud-storage
linked to: http://stackoverflow.com/q/17914807
answer count: 2
downvote count: 0
score: 1
has title: Google Cloud Storage setting permissions gives bad request errors Java JSON API
favorite count: 0
has answer: http://stackoverflow.com/a/26271801
accepted answer: http://stackoverflow.com/a/26271801
tagged with: permissions

http://stackoverflow.com/a/26111387
has comment: http://stackoverflow.com/comment/40921330
has comment: http://stackoverflow.com/comment/40922200
type: Answer
answers question: http://stackoverflow.com/q/26111346
upvote count: 2
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26111346
has body: I think you might be getting an incorrect ans because of 4/3 in Integer Math give 1 and not 1.33 Try changing you code to what is give below. I tried and worked fine for me. radius = diameter / 2.0d; volume = (4.0d / 3.0d) * Math.PI * Math.pow(radius, 3);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40921650

http://stackoverflow.com/a/26104577
answers question: http://stackoverflow.com/q/26104084
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: Just add your JDK path in windows environment variable. or Open eclipse.ini file and Change the vmargs sizes to -vmargs -Xms40m -Xmx512m -XX:MaxPermSize=256m or In your eclipse.ini file Add -vm C:\Program Files\Java\jre7\bin\javaw at beginning of your eclipse.ini //make sure you have same directory structure And then remove 256m which is below the line --launcher.XXMaxPermSize. It will work.

http://stackoverflow.com/q/26092001
has title: Inserting item into a Max Heap
tagged with: java
type: Question
answer count: 2
score: 2
has answer: http://stackoverflow.com/a/64508698
downvote count: 0
has answer: http://stackoverflow.com/a/26094898
tagged with: heapsort
favorite count: 0
possible better answer: http://stackoverflow.com/a/64508698
tagged with: insert
has body: I am not sure on how to insert an item into my max heap and then trickle up so the max heap property holds. I have thrown an exception if the heapArray is full therefore not being able to insert an item. I am not using JCF classes or the priority Queue for this program. I have also thrown in my deleteMax method that deletes the max value of the heap and restores the heap so the max heap property holds. public class MaxIntHeap { //my global var's private int[] heapArray; // default size of 20 in constructor private int lastOne; //equal to size of the array(heap) private int size; private int k; public void heapInsert(int v) throws HeapException { if(lastOne == heapArray.length - 1 ){ throw new HeapException("The value " + v + " cannot be inserted because the heap is FULL!"); } else{ //This is where i am lost as to how i should insert lastOne++; //size of lastOne is increased. } This is my removeMax method. public int removeMax ()throws HeapException { if(size == 0){ throw new HeapException("The Heap is empty, therefore the Max value of the heap cannot be removed."); } else{ int max = heapArray[0]; heapArray[0] = heapArray[lastOne]; lastOne--; k = 0; while(k &gt; 0){ int j = k / 2; if(heapArray[k] &lt; heapArray[j]){ swap(heapArray[k], heapArray[j]); //swap method... k = j; } else break; } return max; } } Any help would be greatly appreciated. Thank you!
upvote count: 2
accepted answer: http://stackoverflow.com/a/26094898
tagged with: max-heap
type: AnsweredQuestion

http://stackoverflow.com/q/26054962
has answer: http://stackoverflow.com/a/26055261
answer count: 1
tagged with: jackson
accepted answer: http://stackoverflow.com/a/26055261
has body: i want parse [{'lng':116.298871, 'lat':39.991466},{'lng':116.298871, 'lat':39.990079},{'lng':116.295787, 'lat':39.990079},{'lng':116.295787, 'lat':39.991466}]] to region or coordinate object,but failed, i use objectMapper.readValue (str, Coordinate[].class); and objectMapper.readValue (str, Region.class); all not complete. in region public class Region implements Serializable{ private static final long serialVersionUID = 1233772272079216259L; private List&lt;Coordinate&gt; boudary; public List&lt;Coordinate&gt; getBoudary() { return boudary; } public void setBoudary(List&lt;Coordinate&gt; boudary) { this.boudary = boudary; } } and package com.compass.goverment.resource.bean.logic; public class Coordinate { private double lng; private double lat; public Coordinate (double lng, double lat) { super (); this.lng = lng; this.lat = lat; } public double getLng () { return lng; } public void setLng (double lng) { this.lng = lng; } public double getLat () { return lat; } public void setLat (double lat) { this.lat = lat; } } how can i use ObjectMapper to parse the string json to region object?
has title: use ObjectMapper parse string json to object
score: 0
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/40955216
has text: You should really learn about the basics of the language before asking this.
type: Comment
comment on: http://stackoverflow.com/q/26129736
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41419053
has text: (Elements in a JSON "array", however, are ordered.)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26034370

http://stackoverflow.com/a/26034729
has body: The initialization expression is executed once, as the loop begins, but you are not doing anything with i. Therefore just remove it from the loop like so: for (; i &gt;= 1; i--){ System.out.println(i); }
type: Answer
answers question: http://stackoverflow.com/q/26034603
has comment: http://stackoverflow.com/comment/40849014
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40892552
has comment: http://stackoverflow.com/comment/40781017
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26034603

http://stackoverflow.com/comment/40897317
comment on: http://stackoverflow.com/a/26097290
has text: https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/ie/NERServer.java
type: AnswerComment
score: 1
type: Comment

parsing
tags question: http://stackoverflow.com/q/26088634
tags question: http://stackoverflow.com/q/26052301
tags question: http://stackoverflow.com/q/26166767
tags question: http://stackoverflow.com/q/26172039
tag name: parsing
tags question: http://stackoverflow.com/q/26093020
tags question: http://stackoverflow.com/q/26048524
tags question: http://stackoverflow.com/q/26078735
tags question: http://stackoverflow.com/q/26173769
tags question: http://stackoverflow.com/q/26152419
tags question: http://stackoverflow.com/q/26047161
tags question: http://stackoverflow.com/q/26142835
tags question: http://stackoverflow.com/q/26150062
type: Tag
tags question: http://stackoverflow.com/q/26062730
tags question: http://stackoverflow.com/q/26144141
tags question: http://stackoverflow.com/q/26114702
tags question: http://stackoverflow.com/q/26137042
tags question: http://stackoverflow.com/q/26076595
tags question: http://stackoverflow.com/q/26103073
tags question: http://stackoverflow.com/q/26105426
tags question: http://stackoverflow.com/q/26052726
tags question: http://stackoverflow.com/q/26115927
tags question: http://stackoverflow.com/q/26127267

http://stackoverflow.com/comment/41031178
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26169763
has text: Well, welcome to programming, it is a nice field to be in. BUT, you potentially will still have the same issue of server side vs client side. Meaning, you will either need to make a second http request from your java script to get the auto complete values from the server in json format, or you will need to print that json object out to create javascript code. Javascript has no ability to talk to your server side java objects that are used to render a html page.
score: 0

http://stackoverflow.com/comment/41050637
score: 0
type: Comment
type: QuestionComment
has text: Thanks! I'm not so optimistic but the hope dies last :)
comment on: http://stackoverflow.com/q/26181484

http://stackoverflow.com/q/26135541
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26136688
tagged with: java
has body: I am working on an application which has REST endpoints and for a Get-By-ID service, I am populating a resource (basically a POJO) by collecting data from the persistent store. Now, before sending the response back, I have to populate the HREF in the POJO resource. I want to do it in a generic way so that various other REST services (search etc.) can use it. I want to do this HREF population at a common place for reusability purpose. In a nutshell, my resource POJO can go through various massaging layers to have different state changed and finally sent back to the consumer. Resource POJO --> Massager 1 --> Massager 2 --> Final Massaged POJO Could someone help me to figure out a design pattern that can fit my problem. I thought of Decorator pattern, but somehow it does not sail my ship. ~ NN
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/26135799
has comment: http://stackoverflow.com/comment/40965495
favorite count: 0
has title: What design pattern is appropriate here?
score: 2
accepted answer: http://stackoverflow.com/a/26135799
has answer: http://stackoverflow.com/a/26136688
downvote count: 2
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/40965437

http://stackoverflow.com/a/26182060
answers question: http://stackoverflow.com/q/26182008
upvote count: 1
type: Answer
has body: Unlike other programming languages like C, java does not recognizes 1 or 0 as true or false ( or boolean in short). So the return type of this method has to be boolean it self, you can not return 1 or 0 unless you change the method's return type. However, if you can change the method signature , you can change the return type to int and return 1 for true and 0 for false. example : public int openMode(){ return (Settings.System.getBoolean(contxt.getConentResolver(), Setting.System.START_METHOD, true))?1:0 ; }
downvote count: 0
score: 1

http://stackoverflow.com/q/26037366
has comment: http://stackoverflow.com/comment/40786738
type: Question
has comment: http://stackoverflow.com/comment/40787782
has body: I've been trying to call a method which displays frames in an EditorWindow, when pushing a button in the ExplorerWindow. There are 3 modules: AppEditorAPI which contains this interface package org.app.AppEditorAPI; public interface Displayer { public void Display(); } AppEditor which contains EditorTopComponent @ServiceProvider(service=Displayer.class) public final class EditorTopComponent extends TopComponent implements Displayer{ private JDesktopPane jdpDesktop=null; private int openFrameCount = 0; ... protected void createFrame() { MyInternalFrame frame = new MyInternalFrame(); frame.setVisible(true); jdpDesktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) { } } class MyInternalFrame extends JInternalFrame { int xPosition = 30, yPosition = 30; public MyInternalFrame() { super("IFrame #" + (++openFrameCount), true, // resizable true, // closable true, // maximizable true);// iconifiable setSize(300, 300); setLocation(xPosition / openFrameCount, yPosition / openFrameCount); // Add some content: add(new JLabel("hello IFrame #" + (openFrameCount))); } } public void Display(){ jdpDesktop = new JDesktopPane(); createFrame(); // Create first window createFrame(); // Create second window createFrame(); // Create third window //Add the JDesktop to the TopComponent add(jdpDesktop); } } And AppExplorer which contains ExplorerTopComponent public final class ExplorerTopComponent extends TopComponent { ... private void initComponents() { B_Display = new javax.swing.JButton(); .. } private void B_DisplayActionPerformed(java.awt.event.ActionEvent evt) { Displayer D = Lookup.getDefault().lookup(Displayer.class); D.Display(); } ... } Below, are links to the project zip file. http://dl.free.fr/k2Z6DRLrW http://www.fileswap.com/dl/lCeFPcUfbg/ After doing some tests. I found that I can't change (add, remove or edit) the variables or properties of the EditorTopComponent. Like in this case, these two lines; public void Display(){ jdpDesktop = …
has answer: http://stackoverflow.com/a/26074661
has title: How can I add a JDesktopPane to an EditorTopComponent, from an ExplorerTopComponent?
has comment: http://stackoverflow.com/comment/40792243
answer count: 1
downvote count: 0
tagged with: frame
accepted answer: http://stackoverflow.com/a/26074661
favorite count: 0
has comment: http://stackoverflow.com/comment/40786131
tagged with: netbeans-platform
has comment: http://stackoverflow.com/comment/40787106
tagged with: swing
has comment: http://stackoverflow.com/comment/40790433
has comment: http://stackoverflow.com/comment/40788597
has comment: http://stackoverflow.com/comment/40786763
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40785669
score: 2
has comment: http://stackoverflow.com/comment/40788743
tagged with: netbeans
has comment: http://stackoverflow.com/comment/40785633
upvote count: 2
tagged with: java

http://stackoverflow.com/a/26135686
score: 0
has body: Inserting: The entity is not read from EntityManager The ID is null (in case it's primitive, like int, it is 0) You call EntityManager.persist() You call EntityManager.flush() Updating: The entity is read from EntityManager (either by find or by executing query) You change some fields of it You call EntityManager.flush()
type: Answer
answers question: http://stackoverflow.com/q/26135321

http://stackoverflow.com/comment/41014056
type: Comment
type: QuestionComment
has text: @assylias: I see. Since 1.8u20 is the only one of my list having that problem, we have a duplicate of [this question](http://stackoverflow.com/q/25414867/2711488) (or maybe related to [that question](http://stackoverflow.com/q/25490581/2711488))?
score: 1
comment on: http://stackoverflow.com/q/26157543

http://stackoverflow.com/a/26108298
accepted answer of: http://stackoverflow.com/q/26108259
upvote count: 1
has body: You'll want to make that source variable protected so children can see it. Each instance of the children of your class will have their own parent data. Changing one will not affect any other in this case because String is immutable. However, if the parent reference was mutable, and you initialized each of the children with the same reference, then all three would see their private parent value change. If the class in question is mutable, you need to make defensive copies for each instance.
answers question: http://stackoverflow.com/q/26108259
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26180849
type: UnansweredQuestion
tagged with: android
has body: I'd like to create a personnel project with a Java-coded server, and one HTML/JS client (with a framework to determine) and one Android client. I'd like to be able to call Java method from those two clients with only one implementation. Which approach could I use? I have thought about Websocket, but It seems I can only send messages, and then the server side has to parse it and make a method call itself. That's doable, but I'd like to find a better solution. Using AJAX (that I never really used) seems to have the same issue. A http request is sent, but I will need a sort of parser to read the request and dispatch it. I know servlets can do the work, but I often head this is really old-school. I don't know why, though. I'm really open to any proposition to implement this client-server communication. EDIT: The ideal solution I'd like to find would be anything that would enable a direct method call on server from client side. A great solution would be, for example, being able to call webservices from Javascript, or finding a framework with which I can make a direct remote call to a Java method.
has comment: http://stackoverflow.com/comment/41049641
tagged with: java
type: Question
tagged with: javascript
has answer: http://stackoverflow.com/a/26183336
score: 0
answer count: 2
has title: How to call Java server side methods from HTML/JS and android?
has answer: http://stackoverflow.com/a/26181635

http://stackoverflow.com/a/61379169
downvote count: 0
answers question: http://stackoverflow.com/q/26110425
score: 4
type: Answer
upvote count: 4
has body: I was brought here by a Google search and while this won't help OP (since clearly their issue is solved in the accepted answer) I want to share what my problem was for potential future visitors. I was losing my mind - I was working with Jetty and had a method that just would not accept the Override annotation. I even COPIED AND PASTED it from the base class to ensure I hadn't mangled the method signature some how. And while many answers said ignore it, it's the entry point to a websocket and it wasn't firing - clearly, I can't ignore that! It ended up being the import - I was importing Session from the wrong package - from a Jetty package, so it sure looked legit, but I needed to have org.eclipse.jetty.websocket.api.Session while I had org.eclipse.jetty.server.session.Session in my imports. Future visitors are unlikely to have that pairing of mismatched package imports, but I suspect some are going to be in the boat I was just in.

http://stackoverflow.com/a/26134059
answers question: http://stackoverflow.com/q/26134013
type: Answer
has body: Greeter greeter = new Greeter(name); To do this you need a constructor which accept a String variable as input argument in Greeter class public class Greeter { String inputName; public Greeter(String inputName) { // matching constructor this.inputName = inputName; } public String greet() { return "Hello " + inputName; } }
score: 0

http://stackoverflow.com/a/26158287
has comment: http://stackoverflow.com/comment/114815024
type: Answer
has comment: http://stackoverflow.com/comment/41007295
accepted answer of: http://stackoverflow.com/q/26156323
score: 4
upvote count: 4
type: AcceptedAnswer
has body: If i remember well the object array contains all attribute values of given entity : the index of the associated property can be resolved using the property name array String[] propertyNames = event.getPersister().getEntityMetamodel.getPropertyNames(); this link may be usefull
downvote count: 0
answers question: http://stackoverflow.com/q/26156323

http://stackoverflow.com/comment/40897181
type: QuestionComment
has text: repaint() shouldnt be in paintComponent
comment on: http://stackoverflow.com/q/26096633
score: 0
type: Comment

http://stackoverflow.com/q/26142930
has comment: http://stackoverflow.com/comment/40979291
has title: Complex use of JTable, TableModel and others
tagged with: swing
tagged with: tablemodel
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40979713
accepted answer: http://stackoverflow.com/a/26234689
has body: I have some problems with the manage of two JTable, and relative data. I had make this GUI: I explain the use: In the first jTable I have a list of vehicles (trucks, cars...) and relative info. In the second jTable I have a list of vehicles that I want make "available" (i.e. a sw agent starts), with the press of the green arrow. So, is a sublist of the first list: the row selected in the first table are copied in the second. First problem: In the first column I have a explicative image of the kind of vehicle (you can see a truck in the example). In the third and fifth column I have different jComboBoxs. See the jComboBox of TIPO VEICOLO (i.e. Kind): if I choose a different vehicle the Image in the first column must change! (if I choose to change from Truck to Car, the relative Icon must change). Moreover, possibily, I don't want handle this icon in other places in the software. I explain: I want use Object[] vehicle = {"aaa", "kind1", "marca", "disponibile", "ptt" } and never Object[] vehicle = {"/image/truck.png" ,"aaa", "kind1", "marca", "disponibile", "ptt" } Second problem: In the future I want add other features in the jTable: dimensions, vehicle's color, licence... I know that the features for a truck are different from features for a car. I want a way for keep all features in the header, but in every row (according the kind of vehicle) to activate/disable some cells. Please note: The headers of jTables are not necessarily the same package it.transfersimulation; import it.transfersimulation.Vehicle.Stato; import it.transfersimulation.Vehicle.TipoVeicolo; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.ComponentOrientation; import javax.swing.DefaultCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; …
type: Question
has answer: http://stackoverflow.com/a/26144157
tagged with: defaulttablemodel
answer count: 2
possible better answer: http://stackoverflow.com/a/26144157
has answer: http://stackoverflow.com/a/26234689
tagged with: jtable
score: 0

http://stackoverflow.com/q/26150128
accepted answer: http://stackoverflow.com/a/26150627
favorite count: 0
score: 2
upvote count: 2
has body: I am working on a project using Java Servlet. I am using eclipse juno and tomcat 7.0 for my project. I have written following servlet for saving uploaded file at local server location. But till the time I have added this servlet to my project folder, tomcat server in not starting. package testPackage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; public class uploadFile extends HttpServlet { private static final long serialVersionUID = 1L; private static final String DATA_DIRECTORY = "data"; private static final int MAX_MEMORY_SIZE = 1024 * 1024 * 2; private static final int MAX_REQUEST_SIZE = 1024 * 1024; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart) { return; } DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(MAX_MEMORY_SIZE); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); String uploadFolder = getServletContext().getRealPath("") + File.separator + DATA_DIRECTORY; ServletFileUpload upload = new ServletFileUpload(factory); //###### ERROR ###### upload.setSizeMax(MAX_REQUEST_SIZE); try { List items = upload.parseRequest(request); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { String fileName = new File(item.getName()).getName(); String filePath = uploadFolde…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26150627
tagged with: java
has comment: http://stackoverflow.com/comment/40993094
tagged with: eclipse
tagged with: servlets
has title: Tomcat server not starting when adding a specific servlet
type: Question
has comment: http://stackoverflow.com/comment/40992452
linked to: http://stackoverflow.com/q/267953
answer count: 1
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/40825293
score: 0
type: Comment
type: QuestionComment
has text: The reason is basically that you copied "some random code on the internet", didn't get it to work, and now we're supposed to fix it.
comment on: http://stackoverflow.com/q/26058823

http://stackoverflow.com/q/26083423
answer count: 2
score: 0
downvote count: 2
has body: I'm trying to learn android development with Android Studio but I can't seem to figure out why my clicks are not registering. Is there something I'm missing here? I don't like the way Stack Overflow FORCES me to format things they way THEY want. Here is pastebin! :_ http://pastebin.com/hdzZpsud
tagged with: android
has answer: http://stackoverflow.com/a/26083454
has title: onClick not working in android studio
favorite count: 0
tagged with: android-studio
accepted answer: http://stackoverflow.com/a/26083453
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26083453
tagged with: java
possible better answer: http://stackoverflow.com/a/26083454
type: Question
upvote count: 2

http://stackoverflow.com/comment/40944156
comment on: http://stackoverflow.com/q/26124071
score: 0
type: QuestionComment
has text: You could use a linked hash map
type: Comment

http://stackoverflow.com/a/26202435
has body: you should not return the CamelContext - it is not serializable. separate the @Bean from the @ManagedOperation - the operation for stopping the route should have return type void
answers question: http://stackoverflow.com/q/26143924
type: Answer
score: 0

http://stackoverflow.com/comment/40963551
comment on: http://stackoverflow.com/q/26134348
score: 0
type: QuestionComment
type: Comment
has text: *"more than 60% of the time is consumed in spring jars"* That isn't really telling much. Which parts is it hanging on and is it really slow or is it just 60% of 2ms? You should really be more specific in which parts are slow and what you want to optimize.

http://stackoverflow.com/a/26065246
has comment: http://stackoverflow.com/comment/40854839
type: Answer
has comment: http://stackoverflow.com/comment/40851989
has comment: http://stackoverflow.com/comment/40858249
score: 0
has comment: http://stackoverflow.com/comment/40851929
answers question: http://stackoverflow.com/q/26063600
has body: As you mention, the problem here is one of the order in which things are called. You also may have to deal with the possibility that the index changes but the item doesn't (probably unlikely, but certainly possible). In that case your code won't get invoked at all. This is (kind of) an example of the more general principle that subclassing (TableCell in this case) breaks encapsulation, because you need to know details about the superclass' implementation (in this case, whether the index is updated before the item, or vice-versa). Update This is a bit harder than I first thought. The cell, of course, also needs to update when the value in one of the adjacent cells changes. Since the cells that are adjacent to the current cell may change (by filtering, sorting, or even just scrolling), the listener on those values needs to be moved to the correct item when that happens. So the approach I have taken here is to use a fairly minimal subclass of TableCell that registers a listener with its item and index properties. It also wraps the item properties of each of the adjacent cells in an object property, and updates those when the index changes. I think this does the job; I'm confident the approach is right but you may need to think it through and make sure you are covering all possibilities. I just used a css pseudoclass for the cell color, which is faster (I am told) than manipulating css classes and much faster than manipulating the inline style. The css file is just highlight-matching-cells.css: .table-cell:highlight { -fx-background-color: salmon ; } And the example is import java.util.Arrays; import java.util.Random; import java.util.function.Function; import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyIntegerWrapper; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty…

http://stackoverflow.com/q/26147835
type: Question
has comment: http://stackoverflow.com/comment/40987970
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/13102045
answer count: 1
tagged with: string
duplicate of: http://stackoverflow.com/q/7056749
type: UnansweredQuestion
has body: I wrote a program that has an arraylist of users so it should either create a new user and store the user's name in an arraylist or choose an existing user from an arraylist. The problem is, when I run the code I can choose an option but when I want to create a new user I cannot type anything. Why does that happen and how can I fix this? import java.util.ArrayList; import java.util.Iterator; import java.util.Scanner; public class Main { private ArrayList&lt;String&gt; users; public static void main(String[] args) { Main m = new Main(); m.menu(); } public void createNewUser(String name) { users.add(name); } public boolean search(String username) { if (users.contains(username)) return true; else return false; } public void displayUsers() { Iterator&lt;String&gt; itr = users.iterator(); while (itr.hasNext()) { String name = itr.next(); System.out.println(name); } } public void menu() { users = new ArrayList&lt;String&gt;(); int choice = 0; String name; Scanner input = new Scanner(System.in); System.out.println("Choose an option:"); System.out.println("1- Create new user"); System.out.println("2- Select current user"); choice = input.nextInt(); if (choice == 1) { System.out.println("Enter your name: "); name = input.nextLine(); createNewUser(name); displayUsers(); } else { do { displayUsers(); System.out.println("Enter your username: "); name = input.nextLine(); if (search(name)) { System.out.println("User found"); break; } else System.out.println("This username does not exist."); } while (!search(name)); } } }
has comment: http://stackoverflow.com/comment/40988052
tagged with: java
has answer: http://stackoverflow.com/a/26147883
linked to: http://stackoverflow.com/q/7056749
has title: Reading a string and adding it to an ArrayList

http://stackoverflow.com/a/26118280
answers question: http://stackoverflow.com/q/26115338
has body: With your input being XML, converting to JSON for the sake of speed looks like no good idea. I guess, with your other approach, you're losing time on the DOM creation and then even much more on xpath. The fastest solution is IMHO a SAX parser. It creates no objects and only calls you on events you're interested in.
type: Answer
score: 0

http://stackoverflow.com/comment/40891425
comment on: http://stackoverflow.com/q/26072554
score: 0
has text: SEVERE: Context initialization failed org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 29; The prefix "mvc" for element "mvc:annotation-driven" is not bound. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) and so on....
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26189324
downvote count: 0
has body: You are trying to return an integer, not the entire array. The integer is not even valid because you are trying to return the integer after the last integer in the array. I'm guessing you want to return the entire array to your main method, if so you need to change the method signature to return an array, and change the return statement, as such: public int[] randomIntegers() { //code.... return array; } On another note, you don't always fill your array with generated integers. A slot will, when the random number generated is &lt; 100 (so about every tenth time), not be filled and thus have a value of 0 in the slot of the int.
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/41065592
answers question: http://stackoverflow.com/q/26189257

http://stackoverflow.com/comment/40844194
has text: So could you please teach me the right way to run it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26068809

http://stackoverflow.com/q/26172555
has comment: http://stackoverflow.com/comment/41101041
tagged with: java-8
has comment: http://stackoverflow.com/comment/46573913
has comment: http://stackoverflow.com/comment/41062923
tagged with: java
has comment: http://stackoverflow.com/comment/41069271
type: Question
has body: I'm trying to emit 2 Observables using .zip() method but I would like to avoid the need to return anything due to the use of Func2. Is there something like that?? I can't find any other method that does that... Thank you! EDIT: Observable&lt;&gt; obs1 = ...; Observable&lt;&gt; obs2 = ...; Observable.zip(obs1, obs2, new Func2&lt;T1, T2, R&gt;() { R call(T1 t1, T2 t2) { .. } .. return ...; }); I would like a function like zip but one that doesn't require you to return anything - for example Action2 instead of Func2.
has title: How to emit 2 Observables and avoid returning anything
score: 0
has comment: http://stackoverflow.com/comment/41054444
tagged with: vert.x
answer count: 1
type: UnansweredQuestion
tagged with: rx-java
has answer: http://stackoverflow.com/a/41974058

http://stackoverflow.com/q/26112543
has body: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ hi all, I have succeeded apply this Android Sliding Menu in my project. however, how can i add some activity in diffferent page? In MainActivity, displayView function controls the fragment which i have selected.you can see it only use in "Fragment fragment = null;",so , the CESDemo class is extends Fragment.But i cannot add my activity in the CESDemo, such as onTouch and so on.If i change it to FragmentActivity, it does not allow me for "ragmentManager.beginTransaction().replace(R.id.frame_container,fragment).commit();" So, how can i apply some activity in different fragment,even i can design the layout but no any activity i can create. MainActivity.java private void displayView(int position) { // update the main content by replacing fragments //Fragment fragment = null; Fragment fragment =null; switch (position) { case 0: fragment = new CESHome(); break; case 1: fragment = new CESAll(); break; case 2: fragment = new CESPending(); break; case 3: fragment = new CESInProgress(); break; case 4: fragment = new CESCompleted(); break; case 5: fragment = new CESDemo(); break; default: break; } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); } else { // error in creating fragment Log.e("MainActivity", "Error in creating fragment"); } } CESDemo.java public class CESDemo extends Fragment { public CESDemo(){} public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_cesdemo, container, false); return rootView; }
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40923258
has title: How can I add the activity in Android Sliding Menu which is fragment
tagged with: android-activity
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40958866
has comment: http://stackoverflow.com/comment/40923317
tagged with: android-fragments
tagged with: java
type: Question

http://stackoverflow.com/comment/40985154
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26141039
has text: @Chris K **ArrayList<?> arr = new ArrayList<?>;** it doesn't compile without arrays brackests.
score: 0

http://stackoverflow.com/q/26152504
tagged with: inputmismatchexception
score: 3
downvote count: 0
tagged with: type-mismatch
favorite count: 0
type: Question
upvote count: 3
tagged with: java
has body: int EID, ESSN, EM, FSSN, FM; String EN, EEN, FN; Scanner Ein = new Scanner(employer); Scanner Fin = new Scanner(filers); Ein.useDelimiter(", *"); Fin.useDelimiter(", *"); ArrayList&lt;Employer&gt; EmployIn = new ArrayList&lt;Employer&gt;(); ArrayList&lt;Filer&gt; FilerIn = new ArrayList&lt;Filer&gt;(); while (Ein.hasNextLine()) { EN = Ein.next(); EID = Ein.nextInt(); EEN = Ein.next(); ESSN = Ein.nextInt(); EM = Ein.nextInt(); EmployIn.add(new Employer(EN, EID,EEN,ESSN,EM)); } Here is a snippet of code that I am working on. I keep getting java.util,InputMismatchException:null (in java.util.Scanner) In the employer file it is structured like: Google, 0, BOX CHARLES, 724113610, 50 Microsoft, 2, YOUNG THOM, 813068590, 50 Amazon, 4, MCGUIRE MARK, 309582302, 50 Facebook, 8, MOFFITT DON, 206516583, 50 I have no idea why I am getting the mismatch. If anyone could help, that would be amazing.
answer count: 1
type: UnansweredQuestion
has title: InputMismatchException:null
has answer: http://stackoverflow.com/a/26152627

http://stackoverflow.com/a/26155744
accepted answer of: http://stackoverflow.com/q/26153772
answers question: http://stackoverflow.com/q/26153772
has body: Found the issue: it was caused by relative paths for the static content. In case somebody else runs into this issue here is the explanation:The application used paths like &lt;img src="../assets/img/menu-toggler.png" alt="" /&gt; for all static content. This worked except if some static content url was wrong. In this case a 404 error was returned. The 404 error page also included static content with relative paths. Those paths were resolved relative to the content that original caused the 404. Since that lead to a wrong url it would trigger another 404 error, and a cascade of 404 errors would ensue. Example: &lt;img src="../assets/one/two/three/non_existent.png"/&gt; Absolute path is www.myserver.com/assets/one/two/three/non_existent.png Since the image is nonexistent a 404 error is returned. The 404 page has &lt;img src="../assets/error/404/404.png"/&gt; Path path is resolved relative to the first bad url www.myserver.com/assets/one/two/assets/error/404/404.png This leads to a cascade of erroneous paths, 404 errors, a production server that craps out, and headless chicken syndrome.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/41041402
comment on: http://stackoverflow.com/a/26176358
score: 0
type: Comment
has text: Thank you very much. Live and learn.
type: AnswerComment

http://stackoverflow.com/q/26139527
has comment: http://stackoverflow.com/comment/40972599
has title: Regular expression for comma separated string
type: Question
tagged with: regex
answer count: 1
has body: I am trying to create a pattern in Java that matches the following string; String message ="%%140911,A,140929100526,S0117.6262E03647.8107,000,067,F100,4F000100,108"; The pattern I have formed is not matching the string. What am I missing? Ihis is my pattern what I tried so far: private static final Pattern pattern = Pattern.compile( "(\\%\\%)"+"(\\d)," + // Id "([AL])," + // Validity a for valid and l for invalid "(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})," + // Date (YYMMDD)Time (HHMMSS) "([NS])" + "(\\d{2})(\\d{2}\\.\\d+)" + "([EW])" + "(\\d{3})(\\d{2}\\.\\d+)," + //loc "(\\d+)," + // Speed "(\\d+)," + // Direction "([FC])" + "(\\d{3})," + // temperature in Fahrenheit/celsius "(\\w{8})," + // status "(\\d+)"); // event
has answer: http://stackoverflow.com/a/26139579
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40972223
type: UnansweredQuestion

http://stackoverflow.com/comment/41132148
type: QuestionComment
type: Comment
has text: the first method change the data in my table and it should'nt because in the second method I am sending an integer parameter where it must be a string parameter. The second method fails but the first method save the data successfully (It doesn't make the rollback)
comment on: http://stackoverflow.com/q/26151636
score: 0

http://stackoverflow.com/q/26145665
has comment: http://stackoverflow.com/comment/40984224
tagged with: oracle-database
has title: SolrJ Parallel Indexing from Oracle --> Solr (Java Concurrency - Multi-threading)
answer count: 0
type: UnansweredQuestion
tagged with: solr
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/40983989
score: 1
has body: My Goal : Copy Data(1 001 000 Rows) from Oracle DB to Solr using SolrJ (everyday). Machine: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz(Virtual Machine - 8 Thread 16GB RAM) My question aims at the strategy - which way is better to index 1 001 000 documents everyday? 10 Thread - so on each run app has to index 100 000 documents. 1 Thread 100000 doc 2 Thread 50 000 doc I played around and here are the results: Single Thread 100 000 : 4 Minutes 2 Thread (50 000) : 2,45 minutes 4 thread (25 000) : 2,47 minutes 6 Thread (17 000) : 2:55 Minutes 8 Thread (12 500) : 3,06 Minutes 16 Thread (6250) : 8,14 Minutes 4 Thread (125 000 doc on each thread) : 7 Minutes and 47 Seconds took to Index 1 001 000 rows. Fact that 2 threaded process indexing is the fastest among others, but have no idea why... P.S. On production JAR will be loaded as a job into Cloudera Hadoop System, with 100+ threads. CODE : public class VehicleService { private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("Vehicles"); public static void main(String[] args) throws IOException, SolrServerException { EntityManager em = emf.createEntityManager(); Long numberOfResults = em.createQuery("SELECT COUNT (e.govNumber) FROM Vehicle e where e.active = 1", Long.class).getSingleResult(); CloudSolrServer server = new CloudSolrServer("***"); server.setDefaultCollection("vehicles"); em.close(); ExecutorService es = Executors.newFixedThreadPool(2); List&lt;Future&lt;Integer&gt;&gt; futures = new ArrayList&lt;Future&lt;Integer&gt;&gt;(1100000); for (int i=0; i&lt;numberOfResults; i += 125000) { try { Task task = new Task(i, server, emf); Future&lt;Integer&gt; future = es.submit(task); futures.add(future); } catch (Exception e) { e.printStackTrace(); } } if (futures.isEmpty()) { System.exit(0); } /*es.shutdown();*/ /* server.shutdown();*/ /*int done = 0; while (done != futures.size()) { for (Future f : futures) { if (f.isDone()) { done += 1; } } }*/ } } class Task implements Callable&lt;Integer&gt; { …
tagged with: java
type: Question
tagged with: cloudera
has comment: http://stackoverflow.com/comment/40983952
downvote count: 0
has comment: http://stackoverflow.com/comment/40984713
favorite count: 0

ipmitool
tag name: ipmitool
tags question: http://stackoverflow.com/q/26160165
type: Tag

http://stackoverflow.com/comment/97566273
type: AnswerComment
has text: Be aware that the ScrollPane's skin must be initialized before invoking this method. Otherwise you get a NPE. You may install a listener on the skinProperty to wait for the skin to become available.
type: Comment
comment on: http://stackoverflow.com/a/50486726
score: 1

http://stackoverflow.com/q/26159539
has title: How to start and stop the Windows Oracle service using a Jenkins job?
score: 0
has answer: http://stackoverflow.com/a/26159621
tagged with: windows
answer count: 1
tagged with: ruby
tagged with: jenkins
has body: I am using Oracle 11g. On a remote server (Windows server-12) I have three separate Oracle instances (SID). I want to stop and start their Oracle services from Jenkins. How can I do this with Jenkins?
accepted answer: http://stackoverflow.com/a/26159621
type: AnsweredQuestion
tagged with: java
tagged with: oracle11g
type: Question

http://stackoverflow.com/comment/41228716
comment on: http://stackoverflow.com/a/26137937
type: Comment
has text: I want to convert xml to json with respect to the schema, so that the data types and the JSON Objects and Arrays are consistent with the element definitions. Please help
score: 0
type: AnswerComment

http://stackoverflow.com/q/26124720
tagged with: java
has comment: http://stackoverflow.com/comment/40945475
has answer: http://stackoverflow.com/a/26124805
tagged with: loops
type: Question
has body: Hello I was doing a command system with Java. For an example: you type "date" and you see the time and date BUT then this problem came up and when I was trying to fix it, it was a never ending loop. Here's my code with a bit explanation: switch(string){ case "date": //Give date case "random": //The thing is when you type "random" it will wait on the next input from the user and store it in this variable. while(!string2.equals("BREAK")){ String string2 = (String) inputdata.readObject(); //It will process the users next information if the user NOT type "BREAK". } break; //The problem is that the variable "string2" must be outside the while loop BUT it NEEDS in the loop. I tried with do while loop but the same problem happend. } If I must solve this problem I must do loops in loops in loops in loops in loops.... Thanks for an answer. :D comment if you don't understand, I didnt understand my question either in the begining.
has comment: http://stackoverflow.com/comment/40945561
downvote count: 4
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40946258
accepted answer: http://stackoverflow.com/a/26124805
has comment: http://stackoverflow.com/comment/40945679
has title: Java Socket never ending loop
favorite count: 0
has comment: http://stackoverflow.com/comment/40945894
has comment: http://stackoverflow.com/comment/40946048
has comment: http://stackoverflow.com/comment/40945868
tagged with: sockets
score: -4
tagged with: process
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40946032

http://stackoverflow.com/comment/40894894
type: QuestionComment
has text: @TheLostMind If it were a proper, gui, graphics, bells and whistles game, sure, but the OP is clearly new, and I think that flinging a new programmer at debugging threaded applications is a little mean. :P
comment on: http://stackoverflow.com/q/26095954
score: 0
type: Comment

http://stackoverflow.com/q/26186267
has comment: http://stackoverflow.com/comment/41060432
has comment: http://stackoverflow.com/comment/41059829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41059806
tagged with: regex
has comment: http://stackoverflow.com/comment/41059791
tagged with: java
has answer: http://stackoverflow.com/a/26186362
has comment: http://stackoverflow.com/comment/41059787
has answer: http://stackoverflow.com/a/26186356
has comment: http://stackoverflow.com/comment/41059857
has comment: http://stackoverflow.com/comment/41059828
type: Question
has body: I'm trying to write a regular expression in Java to match strings that look like (1, 2, 3, 4, 5, 6) That is, a left parenthesis, followed by a nonzero amount of nonnegative integers (separated by a comma and then any amount of whitespace), and ending with a right parenthesis. I've tried ([0-9]+,\s+) Does anyone know how to write such a regular expression?
has comment: http://stackoverflow.com/comment/41059728
has comment: http://stackoverflow.com/comment/41060059
score: 0
answer count: 3
has title: Regular expression in Java for matching series of integers
has answer: http://stackoverflow.com/a/26186346

http://stackoverflow.com/comment/40795341
has text: I added this: double lat1 = lat1Deg * Math.PI / 180; double lng1 = lng1Deg * Math.PI / 180; double brng = brngDeg * Math.PI / 180; That should do it shouldn't it?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26037144

http://stackoverflow.com/comment/40864307
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26066318
has text: May be you can wrap `Command` with `CommandWrapper` class that uses a custom class for `data` having `when` property. Then you can convert `CommandWrapper` to Json instead.Another solution is to use Gson and make custom serializer for 'Command'.
score: 0

http://stackoverflow.com/comment/51922847
score: 0
type: Comment
has text: @KuKeC that's right: you can't get websocket working without public IP
type: AnswerComment
comment on: http://stackoverflow.com/a/26162969

http://stackoverflow.com/q/26193797
has title: Java inner classes & inheritance: Is there a duplicate outer this reference?
tagged with: java
has comment: http://stackoverflow.com/comment/41073076
has comment: http://stackoverflow.com/comment/41073068
has comment: http://stackoverflow.com/comment/41073052
has body: Consider this scenario with inner classes and inheritance: class X{ class A{ X foo(){ return X.this; // outer this reference to X returned } } } class Y extends X{ class B extends A { Y foo(){ return Y.this; // outer this reference to Y returned } } } How does the memory layout of class B look like? Does it have two outer this references which both point to the same object? Or does it have only one outer this reference. What is the type of this reference? The reason why I ask: I have a more or less deep hierarchy that uses nested classes like this. If the outer this reference was replicated for each level of inheritance, then I should maybe think over this design. In addition, I am just curious about this design detail of the Java programming language. I used javap to check the layout: The this pointer is really replicated class X$A { final X this$0; // &lt;-- first reference X$A(X); X foo(); } class Y$B extends X$A { final Y this$0; // &lt;-- second reference Y$B(Y); Y foo(); X foo(); }
has comment: http://stackoverflow.com/comment/41073215
has comment: http://stackoverflow.com/comment/41073248
has comment: http://stackoverflow.com/comment/41073209
type: Question
has comment: http://stackoverflow.com/comment/41073056
has comment: http://stackoverflow.com/comment/41072981
has comment: http://stackoverflow.com/comment/41073168
has answer: http://stackoverflow.com/a/26193939
has comment: http://stackoverflow.com/comment/41073023
has comment: http://stackoverflow.com/comment/41073173
has comment: http://stackoverflow.com/comment/41073171
tagged with: inheritance
has comment: http://stackoverflow.com/comment/41073118
has comment: http://stackoverflow.com/comment/41073092
has comment: http://stackoverflow.com/comment/41073314
has comment: http://stackoverflow.com/comment/41073134
tagged with: language-lawyer
has comment: http://stackoverflow.com/comment/41073086
has comment: http://stackoverflow.com/comment/41073197
answer count: 2
has comment: http://stackoverflow.com/comment/41073107
downvote count: 0
has comment: http://stackoverflow.com/comment/41073149
has answer: http://stackoverflow.com/a/30454593
has comment: http://stackoverflow.com/comment/41073021
favorite count: 0
accepted answer: http://stackoverflow.com/a/26193939
possible better answer: http://stackoverflow.com/a/30454593
has comment: http://stackoverflow.com/comment/41073252
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41072999
has comment: http://stackoverflow.com/comment/41073073
tagged with: inner-classes
has comment: http://stackoverflow.com/comment/41073180
upvote count: 3
has comment: http://stackoverflow.com/comment/41073104

http://stackoverflow.com/q/26132721
tagged with: desktop
answer count: 3
has body: I have a file called temperatures.txt saved to my Desktop, what code would I used to bring it up in Java..I am currently trying File file = new File("C:/Windows/system32>/Desktop/temperatures.txt"); When I pull up the command on my schools computer it says C:\Windows\system32> My slashes are backwards because when i compile it says "\" is an illegal character in BlueJ
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has title: How to call a file from Desktop in Java?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26132803
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/26132759
has answer: http://stackoverflow.com/a/26132807

http://stackoverflow.com/q/26164811
has title: Selenium Webdriver -dragAndDrop not working in Firefox 32
favorite count: 0
tagged with: drag-and-drop
has answer: http://stackoverflow.com/a/26176229
has body: I am trying to do a simple drag and drop operation.Doesnt know why its not happenening. I am using Selenium StandAlone Server 2.43.1 and firefox 32. Below is my code: @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://html5demos.com/drag"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); } @Test public void testdragAndDrop() throws Exception { driver.get(baseUrl); WebElement From=driver.findElement(By.xpath("/html/body/section/article/ul/li[3]/a")); System.out.println(From.isDisplayed()); WebElement To=driver.findElement(By.xpath("/html/body/section/article/div")); System.out.println(To.getTagName()); System.out.println(To.isEnabled()); Actions obj=new Actions(driver); Action dragAndDrop= obj.clickAndHold(From) .moveToElement(To) .release(To) .build(); dragAndDrop.perform(); Thread.sleep(5000); } I also tried running: obj.dragAndDrop(From, To).build().perform(); Still same results.. Can anyone kindly help.
upvote count: 2
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 2
tagged with: java
tagged with: selenium
type: Question
answer count: 2
tagged with: firefox
downvote count: 0
has answer: http://stackoverflow.com/a/26219019

http://stackoverflow.com/comment/40915653
type: Comment
score: 0
type: AnswerComment
has text: @user3847117 The only way for you to see the String class in the Outline tab is by openning the String class (press F3 when pointing to the String keyword).
comment on: http://stackoverflow.com/a/26107425

http://stackoverflow.com/a/37211949
has body: Take a look to JxMaps library. Using this library you can easily embed map viewer to any Swing container. After embedding of MapView to your application, library gives you access to Map object, that has methods for both map positioning and zooming. Map map = viewer.getMap(); map.setCenter(new LatLng(map, 10, 20); map.setZoom(8);
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26083904
answers question: http://stackoverflow.com/q/26083904
score: 3
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/133009441

http://stackoverflow.com/a/26099385
has comment: http://stackoverflow.com/comment/40925108
score: 1
has comment: http://stackoverflow.com/comment/40926555
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26096180
has body: When invoking a method, you need to pass the instance from which the method should be invoked as well as the parameters: public interface MethodInvoker { // the method + the instance from which the method should be called public void setMethod(Method method, Object instance); // invokes the method public void invoke(Object... params) throws Exception; } Here an implementation: public class MethodInvokerImpl implements MethodInvoker { private Method method; private Object instance; @Override public void setMethod(Method method, Object instance) { this.method = method; this.instance = instance; } @Override public void invoke(Object... params) throws Exception { // first param: instance, then the parameters method.invoke(instance, params); } } Then your Terminal: public class Terminal { public Map&lt;Character, MethodInvoker&gt; commands; public Terminal() { commands = new HashMap&lt;Character, MethodInvoker&gt;(); } // instance needed, since MethodInvoker#setMethod needs it public void addCommand(char letter, Method method, Object instance) { MethodInvoker invoker = new MethodInvokerImpl(); invoker.setMethod(method, instance); commands.put(letter, invoker); } public void executeCommand(char letter, Object... params) throws Exception { commands.get(letter).invoke(params); } } Finally in your main: public void test(String data) { System.out.println(data); } public void main() throws Exception { Terminal commandLine = new Terminal(); // #text() will be called from "this" instance commandLine.addCommand('h', getClass().getMethod("test", String.class), this); commandLine.executeCommand('h', "This is a test"); } Note that static methods don't need instances since they belong to the class, e.g.: public void main() throws Exception { Terminal commandLine = new Terminal(); // simply pass "null" as instance commandLine.addCommand('h', getClass().getMethod("test", String.class), null); commandLine.executeCommand('h', "This is a test"); } public static void test(String data) { Sy…
has comment: http://stackoverflow.com/comment/40927219
answers question: http://stackoverflow.com/q/26096180
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40926996
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26114581
has text: It sounds like your debugger tool is shortening the string for the purpose of printing. Have you tried using `System.out.println`? This should output the entire string to your console.
type: Comment

http://stackoverflow.com/comment/41049638
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26180919
type: QuestionComment
has text: Rounding or truncating?

http://stackoverflow.com/a/26097092
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40956183
type: Answer
has comment: http://stackoverflow.com/comment/40955993
answers question: http://stackoverflow.com/q/26094599
has comment: http://stackoverflow.com/comment/40973226
accepted answer of: http://stackoverflow.com/q/26094599
has body: When executing JSON result all properties of the root object are serialized to JSON. But you left root parameter empty. Even if validation of struts.xml fails the document is still parsed without error but it has a warning WARN (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:56) - no default parameter defined for result of type json When a default parameter root is empty then the object for serialization is peeked up from the value stack. In most cases it's an action bean. But in your case you should not serialize this bean, because it might contains properties that should be excluded from serialization such as data source property. To populate select box from JSON object you should only serialize a property that contains list values. You can do it if you use this property name as a root parameter value. If you are needed to serialize two lists for double select box then you can left root object as default and use includeProperties parameter of the JSON result, and put both list properties with the result. Including properties A comma-delimited list of regular expressions can be passed to the JSON Result to restrict which properties will be serialized. ONLY properties matching any of these regular expressions will be included in the serialized output. Note: Exclude property expressions take precedence over include property expressions. That is, if you use include and exclude property expressions on the same result, include property expressions will not be applied if an exclude exclude property expression matches a property first. ^entries\[\d+\]\.clientNumber, ^entries\[\d+\]\.scheduleNumber, ^entries\[\d+\]\.createUserId Also, it's not related, but if you override an action configuration with interceptors look which interceptors each stack contains and don't repeat the same interceptor twice without need. In you case either basic or default stack should be used.
score: 0

http://stackoverflow.com/q/26173289
has title: Integration testing framework for applications written in multiple languages
has comment: http://stackoverflow.com/comment/41037094
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26208457
has comment: http://stackoverflow.com/comment/41036808
linked to: http://stackoverflow.com/q/15499746
type: UnansweredQuestion
upvote count: 1
has body: Query already asked at link For an enterprise application with huge source code repository which is written in C/C++/Java/JavaScript, for performance reasons. Application also uses relational Database mysql &amp; key-value berkeley DB to store relevant data for the application. We could use unit testing frameworks like JUnit for java &amp; Check for C in such large applications. My question: But, I would like to understand, How would one think of designing Integration testing framework for such Enterprise applications?
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/41677245
score: 1
tagged with: java
tagged with: integration-testing
tagged with: database-testing

http://stackoverflow.com/a/26174892
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41038405
has comment: http://stackoverflow.com/comment/41038516
has body: The problem is you are changing the layout manager for the frame when you create your top and bottom panels... private void createTopPanel() { buttonPanel = new JPanel(); setLayout(new FlowLayout()); // &lt;--- This is call setLayout on the frame This is why it's dangerous to... Extend from something like JFrame directly... Dynamically build components It's all to easy to lose context and start effecting components you didn't actually want to...
has comment: http://stackoverflow.com/comment/41038462
type: Answer
accepted answer of: http://stackoverflow.com/q/26174832
answers question: http://stackoverflow.com/q/26174832
score: 1

http://stackoverflow.com/comment/49826289
has text: @ShajeelAfzal - You have to be in the right directory or provide the full path.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26070045
type: Comment

http://stackoverflow.com/comment/40864971
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26080344
has text: This not a volume calculation. You've gone from a vector between two points and popped it into a volume calculation of some kind. This isn't right.

http://stackoverflow.com/comment/41036304
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26173751
has text: the op stole my answer how can I report this?
type: Comment

http://stackoverflow.com/comment/41037135
comment on: http://stackoverflow.com/q/26144104
type: Comment
type: QuestionComment
has text: Hi Nicholas, this is not really what I'm looking for. It's seems a kind of a hack.
score: 0

http://stackoverflow.com/q/26090873
has comment: http://stackoverflow.com/comment/40887055
type: Question
has body: I'm working on a game in Java, and I'm trying to communicate between a client and server on the same computer over the internet, and eventually between multiple computers. I used to be able to, but now the server doesn't seem to be receiving any packets from the client. I'll try to post all the relevant code. This is on the server: private DatagramSocket m_Socket = new DatagramSocket( 8000 ); private DatagramPacket m_DatagramPacket = new DatagramPacket( new byte[ 1024 ], 1024 ); ... while( true ) { m_Socket.receive( m_DatagramPacket ); byte[] data = new byte[ 1024 ]; data = m_DatagramPacket.getData( ); System.out.println( "SERVER RECEIVING: " + data ); } This is on the client: private DatagramSocket m_Socket = new DatagramSocket( null ); private DatagramPacket m_DatagramPacket = new DatagramPacket( new byte[ 1024 ], 1024 ); ... m_DatagramPacket.setAddress( InetAddress.getByName( "72.49.50.49" ) ); m_DatagramPacket.setPort( 8000 ); m_DatagramPacket.setLength( length ); m_DatagramPacket.setData( data ); // "data" is the byte array, "length" is the length of the array m_Socket.send( m_DatagramPacket ); I'm seeing the packet in Wireshark so I know it's sending. EDIT: I may not understand how Wireshark works, is the screenshot below sending or receiving the packet? Wireshark: Firewall exception: Port forwarding: EDIT: I also ran this port tester program to test port 8000 and it says the port is open UPDATE: For some reason I guess our routers were just refusing connections from the source local IP to the external IP destination. I can connect to the server using the local IP from the same network and using the external IP from a different network
tagged with: datagram
tagged with: network-programming
answer count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40887737
has answer: http://stackoverflow.com/a/26092345
favorite count: 0
has answer: http://stackoverflow.com/a/75497070
has comment: http://stackoverflow.com/comment/40919824
has title: Java DatagramSocket sending but not receiving
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40887622
has answer: http://stackoverflow.com/a/26091627
has comment: http://stackoverflow.com/comment/40920709
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40887641
has comment: http://stackoverflow.com/comment/40887418

http://stackoverflow.com/comment/40863751
type: Comment
score: 1
type: QuestionComment
has text: Ah, messed around a bit and found that you need .equals("cat"), not ==.
comment on: http://stackoverflow.com/q/26079731

http://stackoverflow.com/a/32719804
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26091407
has body: This message can be produced if the struts2-core-[VERSION].jar is not marked as an Export Dependency. To correct this: Project Properties &gt; Java Build Path &gt; Order and Export Then mark struts2-core-[VERSION].jar as an Export Dependency (or, if included via Ivy, make sure the Ivy library is marked as an Export Dependency).

http://stackoverflow.com/q/26072976
has answer: http://stackoverflow.com/a/26073254
has title: Cancelling Alarm Manager in Android
downvote count: 0
has answer: http://stackoverflow.com/a/26073541
has comment: http://stackoverflow.com/comment/40851620
tagged with: alarmmanager
has comment: http://stackoverflow.com/comment/40851675
answer count: 2
has comment: http://stackoverflow.com/comment/40851385
tagged with: android
score: 1
has comment: http://stackoverflow.com/comment/40851341
has comment: http://stackoverflow.com/comment/40851667
favorite count: 0
has body: I am having some problem when trying to cancel AlarmManager in Android. I am calling this retrieveBudget() onCreate: public void retrieveBudget() { txtDisplayMonthlyExpenses = (TextView) findViewById(R.id.txtDisplayMonthlyExpense); txtDisplayBudget = (TextView) findViewById(R.id.txtDisplayBudget); cbDisplayReminderNotify = (CheckBox) findViewById(R.id.cbDisplayReminderNotify); cbDisplayReminderNotify.setEnabled(false); DatabaseAdapter mDbHelper = new DatabaseAdapter(this); mDbHelper.createDatabase(); mDbHelper.open(); TransactionRecController trc = new TransactionRecController( mDbHelper.open()); currentMonthExpense = trc.getThisMonthDebit(); txtDisplayMonthlyExpenses.setText("$ " + formatter.format(currentMonthExpense)); BudgetController bc = new BudgetController(mDbHelper.open()); BudgetModel bm = bc.getBudget(); if (bm.getBudgetAmount() != 0 &amp;&amp; bm.getReminderNotify() != null) { budget = bm.getBudgetAmount(); txtDisplayBudget.setText("$ " + formatter.format(budget)); if (bm.getReminderNotify().equals("Y")) { cbDisplayReminderNotify.setChecked(true); } else { cbDisplayReminderNotify.setChecked(false); } AlarmManager mgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); PendingIntent pi = null; if (bm.getReminderNotify().equals("Y") &amp;&amp; currentMonthExpense &gt; budget) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 1); notificationCount = notificationCount + 1; Intent notificationIntent = new Intent(context, BudgetAlarm.class); notificationIntent.putExtra("NotifyCount", notificationCount); pi = PendingIntent.getBroadcast(context, notificationCount, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 60000, pi); } else { mgr.cancel(pi); } } else { txtDisplayBudget.setText("No budget record yet"); } mDbHelper.close(); } And inside my bud…
accepted answer: http://stackoverflow.com/a/26073541
upvote count: 1
has comment: http://stackoverflow.com/comment/40851556
has comment: http://stackoverflow.com/comment/40851327
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26098284
tagged with: java
has comment: http://stackoverflow.com/comment/40851474
has comment: http://stackoverflow.com/comment/40851516
has comment: http://stackoverflow.com/comment/40851348
has comment: http://stackoverflow.com/comment/40851294
possible better answer: http://stackoverflow.com/a/26073254
has comment: http://stackoverflow.com/comment/40851450
type: Question

http://stackoverflow.com/q/26098894
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26099031
has comment: http://stackoverflow.com/comment/40898806
has title: Remove trailing digits for a constant - Java
type: Question
has comment: http://stackoverflow.com/comment/40898830
score: 0
tagged with: java
answer count: 1
has body: My fields are of constant length 4. So, I need the output of the format: Input Output 1 - 0001 10 - 0010 999 - 0999 1111 - 1111 12345 - 1234 I used String.format("%04d", inputValue); How to achieve the last one?
has comment: http://stackoverflow.com/comment/40898708
has answer: http://stackoverflow.com/a/26099031

http://stackoverflow.com/a/26169893
downvote count: 0
score: 7
upvote count: 7
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26168292
has body: It appears you are having this problem: tomcat7 - jdbc datasource - This is very likely to create a memory leak Specifically, you are including your jdbc driver as part of the war instead of the tomcat lib folder.
accepted answer of: http://stackoverflow.com/q/26168292

http://stackoverflow.com/comment/89812209
comment on: http://stackoverflow.com/a/26110941
score: 1
type: AnswerComment
has text: How about the other way around? First `lock.writeLock().lock()` then `lock.readLock().lock()` ? Is it possible to deadlock?
type: Comment

http://stackoverflow.com/a/28983873
score: 1
has body: Below code works for me. With hibernate = 4.3.5.Final spring=4.1.4.RELEASE
upvote count: 1
answers question: http://stackoverflow.com/q/26192256
type: Answer
downvote count: 0

http://stackoverflow.com/q/26046907
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26049001
type: AnsweredQuestion
tagged with: viewflipper
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/26049001
has body: sorry for my english. When the picture to fill the screen, I want to do that could be used to scroll. To do this, use ViewFlipper. but it does not work. is the class that displays images in full screen. What am I doing wrong? public class FullScreenImage extends Activity implements OnTouchListener{ private ViewFlipper flipper = null; private float fromPosition; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.full_screen); Intent intent = getIntent(); long imageId = intent.getExtras().getLong(FullScreenImage.class.getName()); LinearLayout mainLayout = (LinearLayout) findViewById(R.id.main_layout); flipper = (ViewFlipper) findViewById(R.id.fullImage); flipper.setOnTouchListener(this); ImageView imageView = (ImageView) findViewById(R.id.imageView1); imageView.setLayoutParams( new ViewFlipper.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT)); imageView.setImageResource((int) imageId); } public boolean onTouch(View view, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: fromPosition = event.getX(); break; case MotionEvent.ACTION_UP: float toPosition = event.getX(); if (fromPosition &gt; toPosition) flipper.showNext(); else if (fromPosition &lt; toPosition) flipper.showPrevious(); default: break; } return true; } } xml file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ViewFlipper android:id="@+id/fullImage" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/ViewFlipper&gt; &lt;/LinearLayout&gt;
has title: does not work ViewFlipper
upvote count: 1

http://stackoverflow.com/comment/41031947
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26171284
type: Comment
has text: @user2588666: And the reverse of this question is here: [Static method in a generic class?](http://stackoverflow.com/questions/936377/static-method-in-a-generic-class)

http://stackoverflow.com/q/26173688
score: -5
possible better answer: http://stackoverflow.com/a/26173740
tagged with: java
has answer: http://stackoverflow.com/a/26173740
has body: Class A{ public static void main(String args[]) List&lt;B&gt; list=new ArrayList&lt;B&gt;(); list.add("what type of value should we add here"); } Class B{ int a; boolean b; String c; }
type: Question
upvote count: 0
downvote count: 5
accepted answer: http://stackoverflow.com/a/26173789
has answer: http://stackoverflow.com/a/26173746
favorite count: 0
has title: What kind of values we can add to List type?
has comment: http://stackoverflow.com/comment/41036258
answer count: 3
tagged with: generics
has answer: http://stackoverflow.com/a/26173789
has comment: http://stackoverflow.com/comment/41036204
type: AnsweredQuestion

http://stackoverflow.com/a/26110475
has comment: http://stackoverflow.com/comment/55129281
type: Answer
has body: To override a method the signature needs to match that of the super class. Replace public String getArmorTexture(ItemStack stack, Entity entity, int slot, int type) { with public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
has comment: http://stackoverflow.com/comment/40919893
accepted answer of: http://stackoverflow.com/q/26110425
answers question: http://stackoverflow.com/q/26110425
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/55128912
has comment: http://stackoverflow.com/comment/116776047
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41070635
has text: @Walker If you're living in a democracy, no one is going to force you to implement anything :)
comment on: http://stackoverflow.com/a/26191898
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/26055570
answers question: http://stackoverflow.com/q/26054770
has body: My 2 cents. When people are talking about SaaS essentially it includes the following aspects. A service discovery and registration layer which takes care of service registry and discovery. A messaging layer which could route the message to relevant counterparties with or without knowing the physical address. A uniform data transform format so all services could understand it regardless which language they are written in. A threading / process model which enables the caller of the services to run across thread/process boundary. The close match of the above is Spring Framework; but I am a light user of such frameworks because it introduces 20% of the function you need with 80% of the useless stuff which pollute your workspace seriously. IMHO I think If you are after some general performance, try the combination of Spring + JMS + protobuf + JDK threading lib. If you are after some high performance, you need to implement the above features yourself. E.g. your discovery/registry model + Tibco RV + your messaging object pool or KYRO + your threading lib upon JDK lib. Hope that helps.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26054770
score: 2

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

http://stackoverflow.com/a/26106792
has comment: http://stackoverflow.com/comment/40913307
has comment: http://stackoverflow.com/comment/40913276
type: Answer
has body: You need to annotate your test with: @Test(expected = YourException.class) here's a good tutorial: http://www.mkyong.com/unittest/junit-4-tutorial-2-expected-exception-test/ also have a look at parametrized tests: https://github.com/junit-team/junit/wiki/Parameterized-tests
answers question: http://stackoverflow.com/q/26106719
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40913410
has comment: http://stackoverflow.com/comment/40913350
score: -1
has comment: http://stackoverflow.com/comment/40913408
has comment: http://stackoverflow.com/comment/40913336

http://stackoverflow.com/comment/41167647
score: 0
comment on: http://stackoverflow.com/q/26182009
type: QuestionComment
type: Comment
has text: Also, the use of concurrent map is to minimize and possible avoid costly synchronization. that's why i dont want to synchronize the method. The point of all of this is to increase throughput by minimizing syncs.

http://stackoverflow.com/a/26052768
has comment: http://stackoverflow.com/comment/40814723
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26052623
type: Answer
has body: Use the org.apache.log4j.varia.LevelRangeFilter filter. Your XML configuration file could be: <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <level value="warn" /> <appender-ref ref="warn-out" /> <appender-ref ref="console" /> </log4j:configuration> For more options go here. It looks like properties file configuration does not support filters. The following is taken from log4j's official wiki: Filter is not supported by PropertiesConfigurator. EDIT: Added console appender as well to the XML and turned off debug for log4j. Now it should go to both file and console.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40814614
answers question: http://stackoverflow.com/q/26052623
has comment: http://stackoverflow.com/comment/40814420
downvote count: 0

http://stackoverflow.com/q/26167435
upvote count: 0
has title: How to use only the last bit provided by this for loop?
has comment: http://stackoverflow.com/comment/41024614
has answer: http://stackoverflow.com/a/26167484
favorite count: 0
type: UnansweredQuestion
score: -4
has body: So, I'm trying to calculate a list of number to eventually sort, so I only want the final result of this for loop. for (int anno=startyear; TimePeriod&gt;=anno;anno++) { System.out.println(anno); } Where anno = 1995 and I am counting to the current day, I end up getting a result that slowly counts up, where it first counts at 1995, then it counts 1995 and then 1996, and so on. How do I only get the end result for use in my program? The result that would simply be 1995-2014. Not the repeats. edit: Forgot to mention I need every number in between 1995-2014 as well
has answer: http://stackoverflow.com/a/26167509
has comment: http://stackoverflow.com/comment/41024762
tagged with: java
tagged with: loops
type: Question
answer count: 2
downvote count: 4
tagged with: for-loop

http://stackoverflow.com/comment/40849809
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26072017
has text: Are you supposed to use __android:maxLength__ with __InputFilter.LengthFilter__ ?
score: 0

http://stackoverflow.com/comment/40871395
type: Comment
has text: i have declared Interger as 'Integer[]' ob only
type: AnswerComment
comment on: http://stackoverflow.com/a/26079213
score: 0

http://stackoverflow.com/a/26058340
answers question: http://stackoverflow.com/q/26058100
type: Answer
score: 6
has body: Spring uses Java proxies by default to wrap beans and implement annotated behavior. When doing calls within a service you bypass proxy and run method directly, so annotated behavior is not triggered. Possible solutions: Move all @Transactional code to separate service and always do calls to transactional methods from outside Use AspectJ and weaving to trigger annotated behavior even within a service
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26058100
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40842172
type: Comment
has text: Could you post that solution you found as an actual answer to your earlier question? That way, other people with a similar problem will more easily find it.
type: QuestionComment
comment on: http://stackoverflow.com/q/26065884
score: 1

http://stackoverflow.com/comment/40959198
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26132059
has text: The 6 is the number of rows of words in the grid, and the 8 is the number of columns in the grid. The second 8 is the number of words I need to find in the 6x8 grid.

http://stackoverflow.com/q/26140925
score: 0
has body: Hey i implement code to rotate AND flip image. Left, Right, Upsidedown rotation works. Fliping Horizontal, Vertical works. But they dont work together When i flip image and then i rotate, it disappears. BUT When i flip and flip image (so it is as it was before flip) i can rotate normally. I try to understand what is wrong and i think the problem is with transform or scale. Do you have any idea how to fix this code ? /** * Paint the icons of this compound icon at the specified location * * @param c * The component on which the icon is painted * @param g * the graphics context * @param x * the X coordinate of the icon's top-left corner * @param y * the Y coordinate of the icon's top-left corner */ @Override public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g.create(); AffineTransform af = g2.getTransform(); int cWidth = icon.getIconWidth() / 2; int cHeight = icon.getIconHeight() / 2; int xAdjustment = (icon.getIconWidth() % 2) == 0 ? 0 : -1; int yAdjustment = (icon.getIconHeight() % 2) == 0 ? 0 : -1; if (rotate == Rotate.DOWN) { g2.translate(x + cHeight, y + cWidth); g2.rotate(Math.toRadians(90)); icon.paintIcon(c, g2, -cWidth, yAdjustment - cHeight); } else if (rotate == Rotate.UP) { g2.translate(x + cHeight, y + cWidth); g2.rotate(Math.toRadians(-90)); icon.paintIcon(c, g2, xAdjustment - cWidth, -cHeight); } else if (rotate == Rotate.UPSIDE_DOWN) { g2.translate(x + cWidth, y + cHeight); g2.rotate(Math.toRadians(180)); icon.paintIcon(c, g2, xAdjustment - cWidth, yAdjustment - cHeight); } else if (rotate == Rotate.VERTICAL) { g2.translate(0, getIconHeight()); g2.scale(1, -1); icon.paintIcon(c, g2, x, y); vert = !vert; //boolean flag } else if (rotate == Rotate.HORIZONTAL) { g2.translate(getIconWidth(), 0); g2.scale(-1, 1); icon.paintIcon(c, g2, x, y); hor = !hor; //boolean flag } else if (rotate == Rotate.VERTICALLY_HORIZONTAL) { g2.translate(getIconWidth(), getIconHeight()); g2.scale(-1, -1); icon.paintIcon(c, g2, x, y); hor …
has comment: http://stackoverflow.com/comment/40975593
tagged with: flip
has comment: http://stackoverflow.com/comment/40993704
answer count: 1
has title: Flip and Rotate image. Affine Transform doesn't work correctly in java
tagged with: java-2d
accepted answer: http://stackoverflow.com/a/26141507
has comment: http://stackoverflow.com/comment/40994266
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40992558
has comment: http://stackoverflow.com/comment/40977566
has answer: http://stackoverflow.com/a/26141507
tagged with: affinetransform
has comment: http://stackoverflow.com/comment/40991380

guava
tags question: http://stackoverflow.com/q/26083251
tags question: http://stackoverflow.com/q/26104193
tags question: http://stackoverflow.com/q/26118090
tags question: http://stackoverflow.com/q/26124151
tags question: http://stackoverflow.com/q/26184322
tags question: http://stackoverflow.com/q/26073024
tags question: http://stackoverflow.com/q/26119232
tags question: http://stackoverflow.com/q/26128040
tag name: guava
tags question: http://stackoverflow.com/q/26150062
tags question: http://stackoverflow.com/q/26184714
type: Tag

http://stackoverflow.com/comment/41073209
score: 1
comment on: http://stackoverflow.com/q/26193797
has text: You don't need to measure here - you can use `javap` to see how many fields there are. I'm looking in the JLS to see what that says, but I'm finding it hard to find anything for this specific situation. It does feel like a *very* convoluted design to me.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26070832
has title: need to count and average the finalaverage output
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26070955
type: UnansweredQuestion
has body: I have been able to create a program to calculate the letter grade and average of each student entered but I am having trouble trying to create a counter for the finalaverages that records them all to give me a class average. This has been the most difficult part of my entire program. I do not understand how to implement the counter, I need help. import java.util.Scanner; public class gradebook { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub float discussionweight, hwweight, examweight, discussion, hw, exam, finalaverage; Scanner scan = new Scanner(System.in); System.out.print ("Enter the weight of the discussions as an integer: "); discussionweight = scan.nextFloat(); // Prompts for the weight of the homework grade in an integer System.out.print ("Enter the weight of the homework as an integer: "); hwweight = scan.nextFloat(); System.out.print("Enter the weight of the exam as an integer:"); examweight = scan.nextFloat(); int again=-1; while( again!=0){ System.out.print("Enter the students name: "); String student = scan.next(); // Prompts for the discussions grade System.out.print ("Enter the score of the discussion as an integer: "); discussion = scan.nextFloat(); // Prompts for hw grade System.out.print ("Enter the hw grade: "); hw = scan.nextFloat(); System.out.print("Enter the exam grade"); exam = scan.nextFloat(); finalaverage = (((discussionweight * discussion) + (hw * hwweight) + (exam * examweight)) / 100); if (finalaverage &gt;= 90) System.out.println(student +"'s " + "final grade is an A."); else if (finalaverage &gt;= 80) System.out.println(student +"'s " + "final grade is a B."); else if (finalaverage &gt;= 70) System.out.println(student +"'s " + "final grade is a C."); else if (finalaverage &gt;= 60) System.out.println(student +"'s " + "final grade is a D."); else if (finalaverage &gt;= 10) System.out.println(student +"'s " + "final grade is an F."); System.out.println ("The final average is "+ finalav…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26071244

http://stackoverflow.com/comment/41093787
comment on: http://stackoverflow.com/a/26132246
score: 0
type: Comment
has text: what do you suggest I do...... As you can see am still stuck! lol appreciate the help
type: AnswerComment

http://stackoverflow.com/a/26070259
answers question: http://stackoverflow.com/q/26070226
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: If you find the need to override a method in a subclass, perhaps the logic that method is responsible for is abstract enough to warrant a public or protected method. Consider the design of the Strategy Pattern. Basically, there shouldn't be a need to override a private method, because those methods should be reserved for things outside your interface and only specific to that particular concrete class. Something as integral and specific as build() to me sounds like it belongs as a protected method which your highest superclass may use at some point during construction but which shouldn't be called externally. Of course, if it's safe to call build() as many times as necessary (idempotent), like a render() method might be in a game character class, then it should be safe to make it public and document what your expectations are of its implementation.

http://stackoverflow.com/comment/40921338
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26111346
has text: Use this formula for the volume instead of yours `4 * Math.PI * Math.pow(radius, 3.0) / 3` (refer to @PM77-1 to see why it is necessary).

http://stackoverflow.com/a/26132534
has comment: http://stackoverflow.com/comment/40959953
answers question: http://stackoverflow.com/q/26107721
has body: Actually The Timeout Rule applies the same timeout to all test methods in a class. If you don't want to add it to every Test class, you can define it once in a Test base class. For something that doesn't require a change to all classes, you could implement a Junit custom suite runner ( See second code example ) Just for fun how about this hacky solution using the deprecated Thread.stop method? Before function starts a watcher thread for every test, which after a timeout kills the Junit test thread. If the test completes, cleanup kills the watcher thread. Works for this little demo, not sure if this would work on production scale. import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; // You could also make this a base class for test classes public class TimeoutTest { Thread watcherThread ; Thread junitTestThread; final static int testTimeout = 2000; @Before public void myInit() { junitTestThread = Thread.currentThread(); watcherThread = new Thread() { @Override public void run() { try { Thread.sleep(testTimeout); junitTestThread.stop(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; watcherThread.start(); } @After public void myCleanup() throws InterruptedException { watcherThread.stop(); } @Test public void testPassingFastTest() throws InterruptedException { Thread.sleep(1000); } @Test public void testFailingSlowTest() throws InterruptedException { Thread.sleep(3000); } } Or to do this for several test classes using a suite: import java.util.Arrays; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.junit.runners.model.InitializationError; import org.junit.runners.model.RunnerBuilder; @RunWith(AllTests.class) public class AllTests extends Suite{ Thread watcherTh…
type: Answer
score: 0

http://stackoverflow.com/a/26185895
score: 5
answers question: http://stackoverflow.com/q/26185863
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41084994
type: Answer
has comment: http://stackoverflow.com/comment/41084976
accepted answer of: http://stackoverflow.com/q/26185863
has body: null is not a value - it's the absence of a value. You cannot use the = operator on it, you need to use the is operator instead: DELETE FROM woe300websnt WHERE Arg1 IS NULL AND Rel IS NULL AND Arg2 IS NULL;

http://stackoverflow.com/comment/40892566
score: 0
type: AnswerComment
type: Comment
has text: Thanks, I will look into the options available.
comment on: http://stackoverflow.com/a/26056339

http://stackoverflow.com/a/26339659
accepted answer of: http://stackoverflow.com/q/26104410
score: 3
answers question: http://stackoverflow.com/q/26104410
downvote count: 0
has body: I finally found a solution. To publish post with a photo to the section with normal "text only" posts you need publish a photo to your wall (your user wall not the wall of the page), then get its link and finally create a feed to the page with the the picture link. here is the sample code: FacebookType photo = fc.publish(pageid + "/photos" , FacebookType.class, BinaryAttachment.with(photoName, photoInputStream)); Link photoLink = fc.fetchObject(photo.getId(), Link.class); FacebookType post = fc.publish(pageid + "/feed", FacebookType.class, Parameter.with("message", "your message"),Parameter.with("type", "photo"), Parameter.with("link", photoLink.getLink())); edit: I forgot about one thing. When you later delete the post, you do not delete to photo. To do that you have to do that manually.
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41050227
type: Comment
score: 0
has text: No that makes no sense you aren't actually passing the object you are passing the memory location of the object.
type: AnswerComment
comment on: http://stackoverflow.com/a/26181173

http://stackoverflow.com/comment/40919512
type: Comment
has text: Does Eclipse think there are any errors in `Heap.java`?
type: QuestionComment
comment on: http://stackoverflow.com/q/26110244
score: 0

http://stackoverflow.com/a/26132162
has comment: http://stackoverflow.com/comment/40959388
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40959431
has comment: http://stackoverflow.com/comment/40959412
has body: This question is looking to have the code read the data in a different way. The assumption is that the first two values are integers, and represent the height, and width of the text grid. // read the width and height int height = scan.nextInt(); int width = scan.nextInt(); // build the 2D array to store the char grid. char[][] chars = new char[height][]; for (int line = 0; line &lt; height; line++) { chars[line] = scan.next().toCharArray(); } Then you get the 8 to indicate there are 8 words, followed by the words: // get the number of words to expect int wordcount = scan.nextInt(); // make a place to store the words. String[] words = new String[wordcount]; for (int i = 0; i &lt; wordcount; i++) { words[i] = scan.next(); } This will give you the data in a 2d char array, and the words in a String array....
answers question: http://stackoverflow.com/q/26132059
accepted answer of: http://stackoverflow.com/q/26132059
has comment: http://stackoverflow.com/comment/40959456
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26146896
has title: How to retrieve JSON from HTTP POST request in Java?
has comment: http://stackoverflow.com/comment/40986346
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/3324717
has comment: http://stackoverflow.com/comment/40986638
tagged with: post
has comment: http://stackoverflow.com/comment/40986408
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26147295
has comment: http://stackoverflow.com/comment/40986499
tagged with: rest
has comment: http://stackoverflow.com/comment/40986403
has comment: http://stackoverflow.com/comment/40986301
tagged with: php
has body: So I've created a basic REST API in PHP that returns the following: $result = array( "var" =&gt; 'testvalue', ); sendResponse(200, json_encode($result)); How would I get this testvalue from the JSON using a HTTP POST request in Java? I'm using the recommended answer from here currently: Sending HTTP POST Request In Java But it dosn't show how to convert it from this stage: HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream instream = entity.getContent(); To a Java object. So pretty much how to convert from JSON to a Java object. Any ideas?
has answer: http://stackoverflow.com/a/26147295
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1688099
type: Question

http://stackoverflow.com/comment/40823370
comment on: http://stackoverflow.com/q/26057468
has text: Huh, this is actually an interesting question. It should be fun to see how they define quality of a web application :-D
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40806914
type: AnswerComment
type: Comment
has text: This is what I was trying to do. Thanks.
score: 0
comment on: http://stackoverflow.com/a/26047942

http://stackoverflow.com/q/26182227
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26182400
tagged with: web-applications
tagged with: http
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26182400
has title: How does HTTP frontend server communicate to Websphere
score: 0
tagged with: websphere
answer count: 1
has body: How does HTTP frontend server (remote) communicate to Websphere? I have read that WAS plugin installed in the HTTP frontend server will route the requests to Websphere based on plugin-cfg.xml settings. Will the routing be on HTTP protocol or some other binary protocol? What are the implications on Firewall settings in this case? What ports should be kept open on the application server machine?
tagged with: port

http://stackoverflow.com/q/26036354
has comment: http://stackoverflow.com/comment/40784091
answer count: 3
has title: add a bigger arrayList to a smaller arrayList in java
possible better answer: http://stackoverflow.com/a/26036458
has answer: http://stackoverflow.com/a/26036458
tagged with: collections
has comment: http://stackoverflow.com/comment/40783954
has answer: http://stackoverflow.com/a/26036498
type: AnsweredQuestion
has body: I have a problem and no idea how to start, please help. I got two ArrayList one is smaler and the other one is bigger, and now I have to add the values from the bigger to the smaller list but maintained all the values from both the lists For example, We have two arrayLists ArrayList1[1,2,3] ArrayList2[3,5,7,5] ArrayListResult[4,7,10,5]
tagged with: java
downvote count: 3
score: -3
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/26036498
has comment: http://stackoverflow.com/comment/40783981
favorite count: 0
has answer: http://stackoverflow.com/a/26036847

http://stackoverflow.com/comment/40874384
comment on: http://stackoverflow.com/q/26085302
score: 0
type: Comment
type: QuestionComment
has text: i know the algorithm to convert binary fraction into decimal fraction

http://stackoverflow.com/a/26126582
score: 1
has comment: http://stackoverflow.com/comment/41003629
has comment: http://stackoverflow.com/comment/41003816
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40949614
has body: As your object extends one of the classes for which a default serialization behavior exists, your extra fields are just ignored. Now, one thing which is unclear to me is what should be the expected result. If you are expecting a result such as: {"number":10,"word":"Working","values":["first","second","third"]} Then you should be able to do it thanks to a custom serializer such as the following: public class MySerializer extends JsonSerializer&lt;TryToSerialize&gt; { @Override public void serialize(TryToSerialize toSerialize, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeNumberField("number", toSerialize.getNumber()); jgen.writeStringField("word", toSerialize.getWord()); provider.defaultSerializeField("values", toSerialize.iterator(), jgen); jgen.writeEndObject(); } } If you are expecting a result such as: [10,"Working","first","second","third"] Then, serializer will look like the following: public class MySerializer extends JsonSerializer&lt;TryToSerialize&gt; { @Override public void serialize(TryToSerialize toSerialize, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeNumber(toSerialize.getNumber()); jgen.writeString(toSerialize.getWord()); for (Iterator&lt;String&gt; iterator = toSerialize.iterator(); iterator.hasNext();) { jgen.writeString((String) iterator.next()); } jgen.writeEndArray(); } } Then, in both cases annotate your class with: @JsonSerialize(using = MySerializer.class) There may be a smarter ways but this should work...
type: Answer
accepted answer of: http://stackoverflow.com/q/26121594
answers question: http://stackoverflow.com/q/26121594
downvote count: 0

http://stackoverflow.com/comment/40811801
has text: i removed it but it still won't compile keeps giving me the same error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26051236
score: 0

http://stackoverflow.com/comment/40796314
type: Comment
comment on: http://stackoverflow.com/a/26038594
has text: Moreover, generally speaking you may stop on reading of any byte including a header's one, including the second byte of your data size... And no one can say when the problem is resolved and the current instance of socket will works after that (but you can check). So, I'd suggest to close the socket in a timeout period if packet is still not read completely and prepare a new one and try to get data again. Just set it to a reasonable value (10s sec or so)
score: 1
type: AnswerComment

http://stackoverflow.com/q/26147205
type: Question
has comment: http://stackoverflow.com/comment/40986907
has body: My integration tests need to configure a database, but the libraries that I use to do this need newer versions of libraries that Gradle uses (similar to this issue). For my production code, this isn't a problem because I can declare the dependency on the newer version. However, my understanding is that it makes the most sense to put code that initializes and destroys the general test infrastructure in buildSrc so that it can be used in tasks. For this code, that doesn't work because it gets Gradle's versions of the dependencies (SLF4J in this case). What is the best workaround for this? Is there a way to create a Gradle task that can use its own version of the libraries, or is there a good way to do this kind of initialization outside of the Gradle tasks?
tagged with: java
tagged with: integration-testing
has comment: http://stackoverflow.com/comment/40986929
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40986788
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Gradle task code conflicts with gradle's dependencies
tagged with: gradle

http://stackoverflow.com/a/26103653
upvote count: 3
type: Answer
downvote count: 0
has body: You have to terminate every case statement with a break to continue execution after the end of the switch block. Otherwise you fall through into the next case statement.
score: 3
answers question: http://stackoverflow.com/q/26103613

set
tags question: http://stackoverflow.com/q/26071692
type: Tag
tag name: set
tags question: http://stackoverflow.com/q/26101540

http://stackoverflow.com/a/26100870
type: Answer
downvote count: 0
score: 1
has body: When you give a directory, it has to be a base directory from which all packages are a sub-directory like it does with classpath. e.g. if the JVM is looking for java./lang.Throwable, it will look for java/lang/Throwable.class under the directory you give. Try instead -Xbootclasspath/p:/home/skappler/Programming/**/target/classes/ BTW http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html states Do not deploy applications that use this option to override a class in rt.jar because this violates the Java Runtime Environment binary code license. An alternative is to provide an agent which instruments the Throwable class. e.g. replaces it with your own. Another option is to add a lib/endorsed directory with a jar of the classes you want. Whether these options also violate the license agreement or not, I cannot say.
has comment: http://stackoverflow.com/comment/40903011
accepted answer of: http://stackoverflow.com/q/26100743
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26100743

http://stackoverflow.com/comment/41022875
has text: thats ok, I found it through google ;)
score: 0
comment on: http://stackoverflow.com/q/26161447
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26126863
has comment: http://stackoverflow.com/comment/40949725
has comment: http://stackoverflow.com/comment/40955491
has comment: http://stackoverflow.com/comment/40955381
has comment: http://stackoverflow.com/comment/40952338
has comment: http://stackoverflow.com/comment/40953865
tagged with: string
has answer: http://stackoverflow.com/a/26134720
favorite count: 0
has body: I want to get JSONArray to String[]. In my code there is no error, but when I compile in logcat error refers to line: detail[i] = "NAMA SIM : "+jsonMain.optString("nama_pengendara").toString()+"\n"+ "IDENTITAS : "+jsonMain.optString("jenis_identitas").toString()+"\n"+ "NO.IDENTITAS : "+jsonMain.optString("no_identitas").toString()+"\n"+ "PELANGGARAN : "+jsonMain.optString("jenis_pelanggaran").toString()+"\n"+ "--------------------------------"; detail[] is String[], and info_p is JSONArray This is my full code contain error wile compile: public class InfoPelanggaranActivity extends Activity{ private static final String TAG = InfoPelanggaranActivity.class.getCanonicalName(); public static JSONArray info_p;//delegated isi response ListView _lv_detail; Button _btn_gotoAdd; String[] detail; int arrayLength; ArrayList&lt;String&gt; detailList; ArrayAdapter&lt;String&gt; listAdapter; public void onCreate(Bundle savedIntanceState){ super.onCreate(savedIntanceState); Log.v(TAG, "Start onCreate InfoPelanggaranActivity"); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_infopelanggaran); _lv_detail = (ListView) findViewById(R.id.lv_detail); _btn_gotoAdd = (Button) findViewById(R.id.btn_gotoAdd); _btn_gotoAdd.setOnClickListener(new ClickKeAdd()); setDetails(); } private String[] setDetails() { // TODO Auto-generated method stub arrayLength = info_p.length(); for(int i = 0; i&lt;arrayLength; i++){ Log.v(TAG, "Start setDetails(), for Index: "+i); JSONObject jsonMain = info_p.optJSONObject(i); detail[i] = new String[]{ "NAMA SIM : "+jsonMain.optString("nama_pengendara").toString()+"\n"+ "IDENTITAS : "+jsonMain.optString("jenis_identitas").toString()+"\n"+ "NO.IDENTITAS : "+jsonMain.optString("no_identitas").toString()+"\n"+ "PELANGGARAN : "+jsonMain.optString("jenis_pelanggaran").toString()+"\n"+ "--------------------------------"}; } Log.w(…
downvote count: 2
has comment: http://stackoverflow.com/comment/40949487
upvote count: 1
has comment: http://stackoverflow.com/comment/40954748
has comment: http://stackoverflow.com/comment/40952173
has comment: http://stackoverflow.com/comment/40952294
has comment: http://stackoverflow.com/comment/40954887
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/26134720
type: Question
has comment: http://stackoverflow.com/comment/40949664
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/40951987
has comment: http://stackoverflow.com/comment/40949705
score: -1
has comment: http://stackoverflow.com/comment/40955207
has title: parsing JSONArray to JSONObject and get String to String[]

http://stackoverflow.com/comment/41962977
type: QuestionComment
has text: Possibile duplicate? I'm speaking of properly of tomcat shutdown during Windows shutdown. Not how to run many instances!
comment on: http://stackoverflow.com/q/26072724
score: 0
type: Comment

http://stackoverflow.com/q/26116284
downvote count: 1
duplicate of: http://stackoverflow.com/q/40480
tagged with: java
score: -1
type: Question
has title: how to alter variable value in java? Why some work, some fail?
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26116319
favorite count: 0
has body: I'm trying to alter the variable value in java? The following code works, it changes x,y value from 0 to 100: public void tricky(Point arg1) { arg1.x = 100; arg1.y = 100; } public static void main(String [] args) { Point pnt1 = new Point(0,0); System.out.println("X: " + pnt1.x + " Y: " +pnt1.y); tricky(pnt1); System.out.println("X: " + pnt1.x + " Y:" + pnt1.y); } But why the following code doesn't work? public class Solution { public static void tricky(int arg1) { arg1 = 100; } public static void main(String [] args) { int pnt1 = 0; System.out.println(pnt1); tricky(pnt1); System.out.println(pnt1); } }
has answer: http://stackoverflow.com/a/26116460
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/40480

http://stackoverflow.com/q/26093161
score: 1
has comment: http://stackoverflow.com/comment/40888698
type: Question
has title: Cannot pass ArrayList<Impl> to method taking ArrayList<Interface>
tagged with: interface
accepted answer: http://stackoverflow.com/a/26093178
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/40888696
has answer: http://stackoverflow.com/a/26093186
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/26093178
has body: I have an interface and a class implementing it: public interface IFoo{ Integer bar(); } public class Foo implements IFoo{ @Override public Integer bar(){ return 42; } } Now in another class, I have a function which takes an ArrayList of the interface type. public class Something { public static void function(ArrayList&lt;IFoo&gt; foos){ //do something on foos } } I want to use this function on an array list of Foo: ArrayList&lt;Foo&gt; myFoos = new ArrayList&lt;Foo&gt;(); Something.function(myFoos);//can NOT do this What is the problem or what shall I do?
downvote count: 1
has comment: http://stackoverflow.com/comment/40888680
tagged with: java
has answer: http://stackoverflow.com/a/26093259
linked to: http://stackoverflow.com/q/2660827
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26093259

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

http://stackoverflow.com/q/26079072
answer count: 2
tagged with: sql
downvote count: 1
favorite count: 0
tagged with: sql-server
possible better answer: http://stackoverflow.com/a/26079197
has title: Best way to create a database in a billing program for a common user
has comment: http://stackoverflow.com/comment/40862560
linked to: http://stackoverflow.com/q/462923
type: AnsweredQuestion
upvote count: 0
has body: I am using java to make a billing program for a company. For my (poor) experience I think that the best way to keep a database active, which will be accessed and modified constantly, is using SQL. But my question arises when they have to use this program in their own PC. To use a SQL database is it necessary to the user PC install a SQL server in their PC? (bearing in mind that they want to use the program without the need of internet). Any PC with raw Windows/Ubuntu (or any similar OS) is compatible with SQL databases? If it is not compatible which method would you use to make this kind of database?
tagged with: java
tagged with: cross-platform
accepted answer: http://stackoverflow.com/a/26079205
type: Question
has comment: http://stackoverflow.com/comment/40862948
has answer: http://stackoverflow.com/a/26079197
tagged with: database
score: -1
has answer: http://stackoverflow.com/a/26079205

http://stackoverflow.com/a/26080720
has comment: http://stackoverflow.com/comment/40865715
has comment: http://stackoverflow.com/comment/40865656
has comment: http://stackoverflow.com/comment/40865744
has comment: http://stackoverflow.com/comment/40865768
has comment: http://stackoverflow.com/comment/40865703
downvote count: 1
has comment: http://stackoverflow.com/comment/40865681
answers question: http://stackoverflow.com/q/26080696
has comment: http://stackoverflow.com/comment/40865676
type: Answer
has comment: http://stackoverflow.com/comment/40865643
score: 2
has comment: http://stackoverflow.com/comment/40865808
has comment: http://stackoverflow.com/comment/40866189
has body: You can use a FlowLayout. From the tutorial How to Use FlowLayout: The FlowLayout class puts components in a row, sized at their preferred size. If the horizontal space in the container is too small to put all the components in one row, the FlowLayout class uses multiple rows. If the container is wider than necessary for a row of components, the row is, by default, centered horizontally within the container. EDIT If you want your layout to scroll vertically when there are too many rows, you can use a JScrollPane with horizontal scrolling disabled. You can do that with: js.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); (where js is the JScrollPane that contains your FlowLayout panel). EDIT 2 Well, the above isn't enough. You also need to set a viewport view on the JScrollPane that will track the JScrollPane width. Here's a class that does this (taken from here): static class MyPanel extends JPanel implements Scrollable{ @Override public Dimension getPreferredScrollableViewportSize() { return this.getPreferredSize(); } @Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 50; } @Override public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { return 80; } /* * (non-Javadoc) * @see javax.swing.Scrollable#getScrollableTracksViewportWidth() */ @Override public boolean getScrollableTracksViewportWidth() { return true; } @Override public boolean getScrollableTracksViewportHeight() { return false; } } You would use this by adding your current FlowLayout layout to an instance of MyPanel (instead of directly to the JScrollPane) and then calling js.setViewportView(myPanelInstance);
has comment: http://stackoverflow.com/comment/40865682
has comment: http://stackoverflow.com/comment/40865621
upvote count: 3

jfilechooser
tags question: http://stackoverflow.com/q/26076400
tags question: http://stackoverflow.com/q/26180704
tags question: http://stackoverflow.com/q/26056696
tags question: http://stackoverflow.com/q/26056922
tag name: jfilechooser
type: Tag

http://stackoverflow.com/comment/41012177
has text: Version 49 class files are generated by Java 5. That means that somewhere in your system, you have a version of Java older than Java 5. Find _that_, and upgrade it. Note, you can have multiple versions of Java installed on the same computer, so just because your default version is Java 6, does not mean that that's the version your Oracle is using.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26160973
type: Comment

http://stackoverflow.com/comment/41036366
has text: @KickButtowski The code you provide here is generally considered "open source", sure it would be nice if the OP had mentioned it, but it wouldn't be considered "stealing" - besides, the OP messed it up anyway ;)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26173751
score: 0

http://stackoverflow.com/comment/40800782
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26045085
has text: Got it thanks... And to write the 2D array back to file I just change it from BufferedReader to BufferedWriter?

http://stackoverflow.com/q/26087801
tagged with: import
has body: Usually I can read the contents of a text file if it's just a regular file on my local disk. However, how can I read a file which exists in the default package I imported into my project? It doesn't have a filepath in the conventional sense so this is a little confusing.
linked to: http://stackoverflow.com/q/26084134
has comment: http://stackoverflow.com/comment/40878543
has comment: http://stackoverflow.com/comment/40878560
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40878865
type: AnsweredQuestion
has title: How to read the contents of a text file in <default.package> [Java]
accepted answer: http://stackoverflow.com/a/26088181
tagged with: file
tagged with: libraries
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26088181
has comment: http://stackoverflow.com/comment/40878529

http://stackoverflow.com/comment/40806432
type: QuestionComment
comment on: http://stackoverflow.com/q/26048360
has text: @JonSkeet if you convert your comment to an answer, I shall upvote it. No other comment or answer is necessary for this question.
score: 0
type: Comment

http://stackoverflow.com/comment/40835056
comment on: http://stackoverflow.com/a/26041598
has text: "javax.swing.plaf.metal.WindowsLookAndFeel", "javax.swing.plaf.metal.MetalLookAndFeel", "com.sun.java.swing.plaf.motif.MotifLookAndFeel", "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel", "javax.swing.plaf.nimbus.NimbusLookAndFeel"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41053309
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26177177
has text: @UlukBiy for the record. I'm launching the same application twice on my PC (the app extends Application and I use the non-static launch(args) in main(args[])

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

http://stackoverflow.com/a/26135746
has comment: http://stackoverflow.com/comment/40965689
upvote count: 1
has body: No, you can't combine two constructors the way you suggest. Rectangle does have a 3 parameters constructor : public Rectangle(Point p, int w, int h) { origin = p; width = w; height = h; } The Rectangle class you referred to in your documentation link in not related to the one used in the tutorial. What you could do is call one constructor from another constructor. For example, a constructor with 3 parameters can first call a constructor that only has the first two parameters, and then initialize the 3rd parameter. For example, the Rectangle constructor can be re-written as : public Rectangle(Point p, int w, int h) { this (p); width = w; height = h; } or public Rectangle(Point p, int w, int h) { this (w,h); origin = p; }
has comment: http://stackoverflow.com/comment/40965634
has comment: http://stackoverflow.com/comment/40965615
score: 1
has comment: http://stackoverflow.com/comment/40965884
has comment: http://stackoverflow.com/comment/40965583
downvote count: 0
has comment: http://stackoverflow.com/comment/40965568
answers question: http://stackoverflow.com/q/26135703
type: Answer

http://stackoverflow.com/comment/40988648
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26145907
has text: Just a side note: Your p2 thread computes f(x-2). Your p1 thread will _also_ compute f(x-2) as an intermediate result while computing f(x-1). In fact there isn't anything that will happen in the p2 thread that did not also happen in the p1 thread. The _very best_ you can hope for from this program is that it won't take any longer than a single-threaded program that uses the same algorithm.

http://stackoverflow.com/q/26111357
has title: Decompressing PHP's gzcompress in Java
type: Question
tagged with: zlib
tagged with: gzip
has answer: http://stackoverflow.com/a/26368925
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26129500
type: UnansweredQuestion
tagged with: php
has body: I'm trying to decompress a json object in Java that was initially compressed in PHP. Here's how it gets compressed into PHP: function zip_json_encode(&amp;$arr) { $uncompressed = json_encode($arr); return pack('L', strlen($uncompressed)).gzcompress($uncompressed); } and decoded (again in PHP): function unzip_json_decode(&amp;$data) { $uncompressed = @gzuncompress(substr($data,4)); return json_decode($uncompressed, $array_instead_of_object); } That gets put into MySQL and now it must be pulled out of the db by Java. We pull it out from the ResultSet like this: String field = rs.getString("field"); I then pass that string to a method to decompress it. This is where it falls apart. private String decompressHistory(String historyString) throws SQLException { StringBuffer buffer = new StringBuffer(); try { byte[] historyBytes = historyString.substring(4).getBytes(); ByteArrayInputStream bin = new ByteArrayInputStream(historyBytes); InflaterInputStream in = new InflaterInputStream(bin, new Inflater(true)); int len; byte[] buf = new byte[1024]; while ((len = in.read(buf)) != -1) { // buf should be decoded, right? } } catch (IOException e) { e.getStackTrace(); } return buffer.toString(); } Not quite sure what's going wrong here, but any pointers would be appreciated!
tagged with: java
tagged with: compression
has answer: http://stackoverflow.com/a/26128562

http://stackoverflow.com/comment/40840679
type: AnswerComment
type: Comment
has text: This is just a map right? with potentially storage as <String,Integer>
comment on: http://stackoverflow.com/a/26066882
score: 0

http://stackoverflow.com/comment/40916841
comment on: http://stackoverflow.com/q/26108747
type: Comment
type: QuestionComment
has text: ...read the environment variable?
score: 2

http://stackoverflow.com/q/26104171
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/40908431
has answer: http://stackoverflow.com/a/26104229
has comment: http://stackoverflow.com/comment/40908318
upvote count: 4
accepted answer: http://stackoverflow.com/a/26104226
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/26104211
tagged with: java
has answer: http://stackoverflow.com/a/26104226
has body: In Java I have a method catching an exception 'ChildException' that extends 'NewException'. If that method calls another method that throws a 'NewException' and let's say something happens and throws it; will the caller method that catches a child class of the exception thrown catch it? public MethodCatchingChildException { try { //stuff callingMethodThrowingNewException(); //stuff } catch (ChildException e) { //stuff } } So will the exception from callingMethodThrowingNewException get caught in MethodCatchingChildException?
has title: Will catching an exception catch a parent class of that exception
type: Question
has comment: http://stackoverflow.com/comment/40908209
answer count: 3
has answer: http://stackoverflow.com/a/26104211
downvote count: 1

swing
tags question: http://stackoverflow.com/q/26080696
tags question: http://stackoverflow.com/q/26043762
tags question: http://stackoverflow.com/q/26150574
tags question: http://stackoverflow.com/q/26098105
tags question: http://stackoverflow.com/q/26142930
tags question: http://stackoverflow.com/q/26074225
tags question: http://stackoverflow.com/q/26168369
tags question: http://stackoverflow.com/q/26084759
tags question: http://stackoverflow.com/q/26132191
tags question: http://stackoverflow.com/q/26184274
tags question: http://stackoverflow.com/q/26052903
tags question: http://stackoverflow.com/q/26151811
tags question: http://stackoverflow.com/q/26073425
tags question: http://stackoverflow.com/q/26078983
tags question: http://stackoverflow.com/q/26172335
tags question: http://stackoverflow.com/q/26090194
tags question: http://stackoverflow.com/q/26154225
tags question: http://stackoverflow.com/q/26091915
tags question: http://stackoverflow.com/q/26131977
tags question: http://stackoverflow.com/q/26075067
tags question: http://stackoverflow.com/q/26038130
tags question: http://stackoverflow.com/q/26150066
tags question: http://stackoverflow.com/q/26156310
tags question: http://stackoverflow.com/q/26110931
tags question: http://stackoverflow.com/q/26062414
tags question: http://stackoverflow.com/q/26047190
tags question: http://stackoverflow.com/q/26130142
tags question: http://stackoverflow.com/q/26056922
tags question: http://stackoverflow.com/q/26049964
tags question: http://stackoverflow.com/q/26162178
tags question: http://stackoverflow.com/q/26139122
tags question: http://stackoverflow.com/q/26086683
tags question: http://stackoverflow.com/q/26190980
tags question: http://stackoverflow.com/q/26076760
tags question: http://stackoverflow.com/q/26167750
tags question: http://stackoverflow.com/q/26101996
tags question: http://stackoverflow.com/q/26184672
tags question: http://stackoverflow.com/q/26043783
tags question: http://stackoverflow.com/q/26047093
tags question: http://stackoverflow.com/q/26183024
tags question: http://stackoverflow.com/q/26146057
tags question: http://stackoverflow.com/q/26099825
tags question: http://stackoverflow.com/q/26083904
tags question: http://stackoverflow.com/q/26054610
tags question: http://stackoverflow.com/q/26068941
tags question: http://stackoverflow.com/q/26104015
type: Tag
tags question: http://stackoverflow.com/q/26076026
tags question: http://stackoverflow.com/q/26096633
tags question: http://stackoverflow.com/q/26163228
tags question: http://stackoverflow.com/q/26036738
tags question: http://stackoverflow.com/q/26108351
tags question: http://stackoverflow.com/q/26131405
tags question: http://stackoverflow.com/q/26158705
tags question: http://stackoverflow.com/q/26156423
tags question: http://stackoverflow.com/q/26099338
tags question: http://stackoverflow.com/q/26067024
tags question: http://stackoverflow.com/q/26037366
tags question: http://stackoverflow.com/q/26087536
tags question: http://stackoverflow.com/q/26052064
tags question: http://stackoverflow.com/q/26049932
tags question: http://stackoverflow.com/q/26120917
tags question: http://stackoverflow.com/q/26067125
tags question: http://stackoverflow.com/q/26093989
tags question: http://stackoverflow.com/q/26059145
tags question: http://stackoverflow.com/q/26170990
tags question: http://stackoverflow.com/q/26159481
tags question: http://stackoverflow.com/q/26065368
tags question: http://stackoverflow.com/q/26180434
tags question: http://stackoverflow.com/q/26170974
tags question: http://stackoverflow.com/q/26166639
tags question: http://stackoverflow.com/q/26160408
tags question: http://stackoverflow.com/q/26064109
tags question: http://stackoverflow.com/q/26142656
tags question: http://stackoverflow.com/q/26146139
tags question: http://stackoverflow.com/q/26082090
tags question: http://stackoverflow.com/q/26085124
tags question: http://stackoverflow.com/q/26045100
tags question: http://stackoverflow.com/q/26185675
tags question: http://stackoverflow.com/q/26176159

http://stackoverflow.com/comment/40956860
comment on: http://stackoverflow.com/q/26120311
score: 0
type: QuestionComment
type: Comment
has text: Agree with Russell. Try it with compiler optimizations disabled and see what happens.

http://stackoverflow.com/q/26125915
tagged with: stored-procedures
has answer: http://stackoverflow.com/a/26126064
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40947829
type: Question
accepted answer: http://stackoverflow.com/a/26126064
has body: I have a task to send Sales Transaction Data in one go connection. So I decided to use Oracle Stored Procedure with XMLtype data type as IN parameter. I wonder if it is bad practice? The Oracle Stored Procedure that I wrote have INSERT, UPDATE and DELETE with bunch of repetitions. I do that because the project sources is using Spring auto-commit and I can't change that configuration because of company reasons.
answer count: 1
has comment: http://stackoverflow.com/comment/40948463
has title: JDBC - Handle Oracle Complexity Stored Procedure
tagged with: oracle-database
type: AnsweredQuestion
tagged with: spring-jdbc

http://stackoverflow.com/comment/40995081
type: Comment
has text: ok can you add some code I can test please , just a little bit
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26131271

http://stackoverflow.com/a/26154604
downvote count: 0
has comment: http://stackoverflow.com/comment/41021488
has body: subMap() and headMap() are two methods in SortedMap those are not available in Map You can try following way Map&lt;String, Integer&gt; doubleCount= new HashMap&lt;String,Integer&gt;(); SortedMap&lt;String, Integer&gt; newMap= new TreeMap&lt;&gt;(doubleCount); Map&lt;String,Integer&gt; newDouble40 = newMap.subMap("0","40"); In your case Keys are String so you need to have String values in subMap("0","40"). 0 is the starting key and "40" is the ending key. Your newDouble40 has element which has a key in between 0 and 40. Here you can use headMap() as newMap.headMap("40"). now you will get elements which has a key less than 40. Eg: Map&lt;String, Integer&gt; doubleCount= new HashMap&lt;&gt;(); doubleCount.put("c",1); doubleCount.put("d",2); doubleCount.put("a",1); doubleCount.put("b",4); SortedMap&lt;String, Integer&gt; newMap= new TreeMap&lt;&gt;(doubleCount);//sorted now Map&lt;String,Integer&gt; map1 = newMap.subMap("a", "c"); Map&lt;String,Integer&gt; map2 = newMap.headMap("c"); System.out.println(map1); System.out.println(map2); Out put: {a=1, b=4} {a=1, b=4}
score: 4
answers question: http://stackoverflow.com/q/26154524
type: Answer
upvote count: 4

http://stackoverflow.com/comment/40897143
score: 0
has text: The loop do 2 things? 1 send email and 2 update in DB? can u add some dummy example of what you are doing in loop?
type: QuestionComment
comment on: http://stackoverflow.com/q/26037098
type: Comment

http://stackoverflow.com/comment/41061242
type: Comment
score: 0
has text: I kinda tested it. And people who ran the installers did not havae access to the java command
type: AnswerComment
comment on: http://stackoverflow.com/a/26160084

http://stackoverflow.com/comment/50531690
has text: You're welcome =) I thought, Qt's new version got a documentation-update, but it is still a bit fragmentary ;-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26650469
type: Comment

http://stackoverflow.com/comment/41061251
comment on: http://stackoverflow.com/a/26159925
score: 0
type: AnswerComment
type: Comment
has text: Sry. I am really new at C++

http://stackoverflow.com/q/26064951
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26068032
tagged with: java
has title: Spring inject my class only on my startup when I submit my form my variable is null why?
tagged with: code-injection
answer count: 2
accepted answer: http://stackoverflow.com/a/26068032
score: 0
has comment: http://stackoverflow.com/comment/40836977
possible better answer: http://stackoverflow.com/a/26065560
has body: Hello guys I am having a problem and I have spent some days already and so far I couldn't solve my problem. I am trying use spring injection and it works fine on my startup project but when I submit my form my class is null. follows my code: applicationContext I have this: <context:annotation-config /> <context:component-scan base-package="br.com.allinone"/> <tx:annotation-driven /> web.xml org.springframework.web.context.ContextLoaderListener and my class @Component @ManagedBean @URLMapping(id = "homeAdmin", pattern = "/Home", viewId = "/home.jsf") public class HomeBean { @Autowired UserService service; } @Service public class UserServiceImpl implements UserService follows more details: My bean is like this: package br.com.allinone.bean; @Component @ManagedBean @URLMapping(id = "homeAdmin", pattern = "/Home", viewId = "/home.jsf") public class HomeBean { @Autowired UserService service; @PostConstruct public void init(){ System.out.println( service.getTest() ); } get and set... } My service interface is like this package br.com.allinone.service; public interface UserService extends BaseService<TestEntity, Long>{ public String getTest(); } My implemented service class: package br.com.allinone.service.impl; @Service public class UserServiceImpl implements UserService { public String getTest(){ return "test"; } My web.xml Pretty Filter com.ocpsoft.pretty.PrettyFilter org.springframework.web.context.ContextLoaderListener com.ocpsoft.pretty.DEVELOPMENT true Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.jsf Faces Servlet *.xhtml Pretty Filter /* FORWARD REQUEST ERROR and my applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org…
has answer: http://stackoverflow.com/a/26065560
tagged with: spring
has comment: http://stackoverflow.com/comment/40836966

http://stackoverflow.com/q/26150557
has answer: http://stackoverflow.com/a/26150667
has answer: http://stackoverflow.com/a/26150644
tagged with: java
has answer: http://stackoverflow.com/a/26150594
tagged with: arraylist
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26150594
has body: I'm currently having problems with the following, using Java 8: I want to pass an ArrayList&lt;String&gt; as argument to another method. This method, among other things, removes an object from the ArrayList it was given: public static void calledMethod(String item, ArrayList&lt;String&gt; list) { list.remove(item); } Now I tried calling this method like this from main: ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("abc"); Iterator&lt;String&gt; itr = list.iterator(); while (itr.hasNext()) { String item = itr.next(); //&lt;- calledMethod(item, list); } In this case, the JVM returns a java.util.ConcurrentModificationException at the marked line in the code above (//&lt;-). As far as my knowledge goes, this means that the list was modified while it was iterated. But how can this happen? As far as I know, Java hands method arguments by value, not by reference. If I call calledMethod using the following code in my main method, no error occurs: ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("abc"); Iterator&lt;String&gt; itr = list.iterator(); while (itr.hasNext()) { String item = itr.next(); //&lt;- calledMethod(item, (ArrayList&lt;String&gt;) list.clone()); } So passing a cloned object to calledMethod works. What is wrong here? java -version: Java SE Runtime Environment (build 1.8.0_20-b26) I'm using Oracle Java on a Linux Mint 64bit.
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/26150667
has title: ArrayList gets manipulated by called method

http://stackoverflow.com/a/26163627
type: AcceptedAnswer
has body: to start simple: a 2-dimensional array is an array of arrays. arrays in Java are object. Only defining the first size thus creates an array of given size, which could store other arrays, but those are at this point still null. So before using it, you would need call something like array1[0] = new int[5], or you would get a NullPointerException. for more-dimensional arrays, this applies accordingly. Theoretically, all the "inner" arrays could have different length, actually. So you could write something like: array1[0] = new int[1]; array1[1] = new int[4];. about your last question: This is not valid, the Java compiler will say something like "Cannot specify an array dimension after an empty dimension". This is due to the fact that the second level was not specified, and are thus null-objects in the first-level array, and as such, no dimension can be specified on those null-arrays.
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26163466
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26163466
score: 5

http://stackoverflow.com/comment/41017052
type: Comment
has text: @radiance that's not possible if you enter a number that error not occurs
type: QuestionComment
comment on: http://stackoverflow.com/q/26163183
score: 0

http://stackoverflow.com/q/26163732
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: hippocms
tagged with: unit-testing
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26175464
has body: I'm writing unit tests for components of HippoCMS, however I am unable to solve how to fake a Repository object for mocking persistFormMap data. I followed the basic HST-2 forms suggestion to actually retrieve request data, (http://www.onehippo.org/library/concepts/component-development/hst-2-forms.html), however I haven't found an easy way to mock/fake the Repository section of getWritableSession (called from persistFormMap()) to put into a fake component manager. public static Session getWritableSession() throws RepositoryException { if (HstServices.isAvailable()) { Credentials defaultCredentials = HstServices.getComponentManager().getComponent(Credentials.class.getName() + ".writable"); Repository repository = HstServices.getComponentManager().getComponent(Repository.class.getName()); Session session = null; if (repository != null) { if (defaultCredentials != null) { session = repository.login(defaultCredentials); } else { session = repository.login(); } } return session; } Is there a way to get submitted data without persistFormMap()? Or a way of properly faking the repo (Hopefully not something that I've simply looked over in the documentation).
has title: Mock/Fake a Repository (or populate a FormMap without persistFormMap)

http://stackoverflow.com/q/26180405
tagged with: encryption
tagged with: android
has title: Sun JCE and BouncyCastle Android incompatible encryption?
has comment: http://stackoverflow.com/comment/41078120
has body: I'm porting a working application that does encryption to Android. The RSA encryption works within a single platform - the Android build can decrypt what was encrypted on the Android app. But data encrypted on the Java application cannot be decrypted on Android. Given the same inputs - same Private Key modulus and exponent, and same 256-byte input block, I'm getting different results using javax.crypto.Cipher as in... public java.security.PrivateKey m_privateKey; public byte[] Decrypt(byte[] input) { Cipher cipher; byte[] cipherData = null; cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, m_privateKey); cipherData = cipher.doFinal(input); return cipherData; } It looks to me like this is a provider issue; debuggers report Android's cipher provider is com.android.org.bouncycastle.jce.provider.BouncyCastleProvider, BC version 1.49, while the application cipher provider is SunJCE version 1.7. The keys also have a slightly different shape; their privateExponent and modulus match correctly, but on the application, m_privateKey is instantiated as a Sun RSA private key, 2048 bits. On Android, it is com.android.org.conscrypt.OpenSSLRSAPrivateKey despite the declaration above. I'm at a bit of a loss. The application code works on Linux, Mac and Windows boxes, in both client and server environments, so I don't have a lot of flexibility on switching it around. Any ideas on what to check to get Android's java/crypto to be compatible? Edit to provide what owlstead requested... For both, I used: byte[] encodedPublic = rsaencUserKeys.m_publicKey.getEncoded(); byte[] encodedPrivate = rsaencUserKeys.m_privateKey.getEncoded(); byte[] testDataIn = new byte[]{25, 99, 76, 84, 7, 104, 27, 47, 120, 86, 83, 9, 56, 77, 0}; byte[] cryptoTest = rsaencUserKeys.Encrypt(testDataIn); byte[] plainTest = rsaencUserKeys.Decrypt(cryptoTest); The Application (Java) values: Encoded Public Key: [48, -126, 1, 34, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -126, 1, 15, …
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41098389
upvote count: 1
has comment: http://stackoverflow.com/comment/41074383
type: Question
has comment: http://stackoverflow.com/comment/41173312
linked to: http://stackoverflow.com/q/22341745
has comment: http://stackoverflow.com/comment/41064636
has comment: http://stackoverflow.com/comment/41055947
has comment: http://stackoverflow.com/comment/41049790
downvote count: 0
tagged with: cryptography
has comment: http://stackoverflow.com/comment/41051486
has comment: http://stackoverflow.com/comment/41529407
has comment: http://stackoverflow.com/comment/41048917
favorite count: 0
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/41088725
type: UnansweredQuestion

http://stackoverflow.com/comment/41141857
score: 0
type: Comment
has text: Glad to hear it! No worries :)
comment on: http://stackoverflow.com/a/26141345
type: AnswerComment

http://stackoverflow.com/comment/40924901
has text: Does TGVertex implement equals() ?
score: 0
comment on: http://stackoverflow.com/q/26113186
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40878307
score: 0
has text: Yes! See my comment above.
type: AnswerComment
comment on: http://stackoverflow.com/a/26042424
type: Comment

http://stackoverflow.com/comment/65280882
comment on: http://stackoverflow.com/q/26113315
score: 0
type: QuestionComment
type: Comment
has text: What was the solution?

http://stackoverflow.com/q/26065390
has comment: http://stackoverflow.com/comment/40839070
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26066549
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: tokenize
tagged with: java
has title: Java Tokenization: Treat Anything Separated by an Underscore as One Word
tagged with: stringtokenizer
type: Question
accepted answer: http://stackoverflow.com/a/26066549
has body: I have a very simple tokenizer using StreamTokenizer, which will convert mathematical expressions into their individual components (below). The problem that I am having, is if there is a variable in the expression called T_1, it will split into [T,_,1], which I would like to return as [T_1]. I have attempted to use a variable to check if the last character was an underscore, and if so, append the underscore onto the list.Size-1, but it seems like a very clunky and inefficient solution. Is there a way to do this? Thanks! StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(s)); tokenizer.ordinaryChar('-'); // Don't parse minus as part of numbers. tokenizer.ordinaryChar('/'); // Don't parse slash as part of numbers. List&lt;String&gt; tokBuf = new ArrayList&lt;String&gt;(); while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) //While not the end of file { switch (tokenizer.ttype) //Switch based on the type of token { case StreamTokenizer.TT_NUMBER: //Number tokBuf.add(String.valueOf(tokenizer.nval)); break; case StreamTokenizer.TT_WORD: //Word tokBuf.add(tokenizer.sval); break; case '_': tokBuf.add(tokBuf.size()-1, tokenizer.sval); break; default: //Operator tokBuf.add(String.valueOf((char) tokenizer.ttype)); } } return tokBuf;
tagged with: split
tagged with: stringreader
has comment: http://stackoverflow.com/comment/40839394
possible better answer: http://stackoverflow.com/a/26066625
has comment: http://stackoverflow.com/comment/40838884
answer count: 2
has answer: http://stackoverflow.com/a/26066625
has comment: http://stackoverflow.com/comment/40839027
has comment: http://stackoverflow.com/comment/40839284

http://stackoverflow.com/comment/40847481
comment on: http://stackoverflow.com/q/26070660
has text: sorry, I put the code up.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40851002
type: Comment
type: QuestionComment
has text: @JBNizet can you please assist me, where exactly i could get servelet Context
comment on: http://stackoverflow.com/q/26072238
score: 0

http://stackoverflow.com/a/26159545
has body: Im terribly sorry. I just didn't google enough. Refer to: EditText, adjustPan, ScrollView issue in android It has the answer to this problem.
type: Answer
answers question: http://stackoverflow.com/q/26159483
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26159483
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40946158
type: QuestionComment
has text: this didn't work. i think i really need to use Threads, because i want the number of threads or worker configurable, and each thread or worker should keep the state (lastprocessedMsg). Has any one already tried this solution http://stackoverflow.com/questions/13932083/jboss-java-ee-container-and-an-executorservice ??
score: 0
comment on: http://stackoverflow.com/q/26054657
type: Comment

http://stackoverflow.com/comment/40913763
comment on: http://stackoverflow.com/q/26106829
score: 1
type: Comment
type: QuestionComment
has text: @PeterLawrey I am pretty sure it is homework :)

http://stackoverflow.com/comment/40867521
type: Comment
comment on: http://stackoverflow.com/q/26081622
has text: I want to be able to use the dict ArrayList in another class called FindWords. However, I am either unable to reference the dict or it prints as an empty list.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26127052
type: Question
has body: I am writing a JUnit test to verify following native method: public native String mkString(byte[] bytes); As part of native code, I invoke a function that returns const char * in third party shared library. I do a dlsym and get a function pointer to the third party function. mkStringFn = (const char *(*)(char*, int)) dlsym(handle, "mkString"); On debugging I found that the while on the return statement in third party function mkString, the return variable always has the correct value. But the I see that for the same input the return value that I get from invoking the function pointer is "" sometimes and other times it has the right value. This is how I call the function pointer madeString = (* mkStringFn)((char *)bufferPtr, len); //madeString is sometimes empty (not NULL) and sometimes has the right value I verified the bufferPtr and len parameter passed to function pointer is valid. Any ideas as why this works only sometimes?
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40950821
score: 0
has comment: http://stackoverflow.com/comment/40953157
has comment: http://stackoverflow.com/comment/40950344
type: UnansweredQuestion
has title: JNI: Inconsistent String behavior calling function in third party shared library
answer count: 0
tagged with: java

joptionpane
tags question: http://stackoverflow.com/q/26156423
tags question: http://stackoverflow.com/q/26051577
tags question: http://stackoverflow.com/q/26059145
tags question: http://stackoverflow.com/q/26110931
tags question: http://stackoverflow.com/q/26140367
tags question: http://stackoverflow.com/q/26148864
tags question: http://stackoverflow.com/q/26096978
type: Tag
tags question: http://stackoverflow.com/q/26058001
tags question: http://stackoverflow.com/q/26045261
tag name: joptionpane

http://stackoverflow.com/a/26176864
has body: The static means that for each new object created for that class, the String construction &amp; pooling only has to happen once, ever. This is a small saving in computation.
downvote count: 0
answers question: http://stackoverflow.com/q/26176802
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26085696
upvote count: 1
answers question: http://stackoverflow.com/q/26084781
has body: Maybe the best possible approach will be calling the setIntent() function on the received intent while executing onNewIntent() of an Activity and retreiving it back via getActivity().getIntent() during a fragment lifecycle. Upd: Also you can use the pattern Observer to dispatch intent receiving events immediately to the registered fragments. Then you can obtain required data from getActivity().getIntent().
score: 1
has comment: http://stackoverflow.com/comment/43164167
downvote count: 0
has comment: http://stackoverflow.com/comment/43143357
type: Answer
has comment: http://stackoverflow.com/comment/43161086

http://stackoverflow.com/q/26151105
tagged with: spring-security
has answer: http://stackoverflow.com/a/26155354
has title: Spring CSRF override "POST" logout behaviour in security XML config
answer count: 3
has comment: http://stackoverflow.com/comment/41001418
possible better answer: http://stackoverflow.com/a/26167774
favorite count: 0
has comment: http://stackoverflow.com/comment/41001678
upvote count: 5
has body: Currently we have a problem with Spring CSRF solution for our legacy App because CSRF implementation changes behavior of default Spring security Spring security configuration sis following: &lt;http pattern=""&gt; ... &lt;logout logout-url="/logout" delete-cookies="..." success-handler-ref="logoutSuccessHandler" /&gt; &lt;csrf/&gt; &lt;/http&gt; org.springframework.security.config.annotation.web.configurers.LogoutConfigurer Logout configurer. According to Spring documentation: Adding CSRF will update the LogoutFilter to only use HTTP POST. This ensures that log out requires a CSRF token and that a malicious user cannot forcibly log out your users. Code that makes this change is the following: private RequestMatcher getLogoutRequestMatcher(H http) { if(logoutRequestMatcher != null) { return logoutRequestMatcher; } if(http.getConfigurer(CsrfConfigurer.class) != null) { this.logoutRequestMatcher = new AntPathRequestMatcher(this.logoutUrl, "POST"); } else { this.logoutRequestMatcher = new AntPathRequestMatcher(this.logoutUrl); } return this.logoutRequestMatcher; } Generally for CSRF protection such behavior makes perfect sense. But as for me it's very strange that this implementation is not flexible (why hardcode real implementations and not autowire dependencies?). The problem is that our application is built in such way that before regular Spring logout it's performed additional clean up in Spring Controllers. Mainly it was implemented Switch Userfeature but in a custom way. So, changing logout link to perform POST is not an option because mainly clean up is performed on custom Controller. It seems in order to use specified approach there is only one possible solution: @RequestMapping(value = "/logout", method = RequestMethod.GET) //or it can be a post public String logout() { // 1. Perform Clean up // 2. Decide whether to logout or redirect to other page // 3. Perform redirect based on decision } //If it's decided to logout this will go to this Controller method: @Re…
tagged with: spring
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/59120990
tagged with: java
accepted answer: http://stackoverflow.com/a/26155354
type: Question
score: 5
has comment: http://stackoverflow.com/comment/41001402
tagged with: csrf
has answer: http://stackoverflow.com/a/48185368
has answer: http://stackoverflow.com/a/26167774

http://stackoverflow.com/comment/40963507
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26134529
has text: @user1933888 What's wrong with it?

http://stackoverflow.com/a/26111066
has comment: http://stackoverflow.com/comment/40921486
type: AcceptedAnswer
downvote count: 0
has body: Consider ChronicleMap (https://github.com/OpenHFT/Chronicle-Map) in a non-replicated mode. It is an off-heap Java Map implementation, or, from another point of view, a superlightweight NoSQL key-value store. What it does useful for your task out of the box: Persistance to disk via memory mapped files (see comment by Michał Kosmulski) Lazy load (disk pages are loaded only on demand) -> fast startup If your data volume is larger than available memory, operating system will unmap rarely used pages automatically. Several JVMs can use the same map, because off-heap memory is shared on OS level. Useful if you does the processing within a map-reduce-like framework, e. g. Hadoop. Strings are stored in UTF-8 form, -> ~50% memory savings if strings are mostly ASCII (as maaartinus noted) int or long values takes just 4(8) bytes, like if you have primitive-specialized map implementation. Very little per-entry memory overhead, much less than in standard HashMap and ConcurrentHashMap Good configurable concurrency via lock striping, if you already need, or are going to parallelize text processing in future.
score: 4
accepted answer of: http://stackoverflow.com/q/26108035
has comment: http://stackoverflow.com/comment/40929322
has comment: http://stackoverflow.com/comment/40920905
answers question: http://stackoverflow.com/q/26108035
has comment: http://stackoverflow.com/comment/40921379
has comment: http://stackoverflow.com/comment/40939805
type: Answer
has comment: http://stackoverflow.com/comment/40922330
has comment: http://stackoverflow.com/comment/40926472
has comment: http://stackoverflow.com/comment/40926764
has comment: http://stackoverflow.com/comment/40921096
has comment: http://stackoverflow.com/comment/40938593
has comment: http://stackoverflow.com/comment/40927289
has comment: http://stackoverflow.com/comment/40926528
has comment: http://stackoverflow.com/comment/40921198
upvote count: 4

http://stackoverflow.com/q/26092221
favorite count: 0
has comment: http://stackoverflow.com/comment/40886976
has answer: http://stackoverflow.com/a/26092427
has body: Why is it when I call System.out.println(classroom.toStringLong()) I get: classroom: a large lecture hall with a null that goes null to null? The correct output is supposed to be: classroom: a large lecture hall with a door that goes outside to sidewalk public class Main { public static void main(String[] args) { Space classroom = new Space(); classroom.setName("classroom"); classroom.setDescription("a large lecture hall"); Space sidewalk = new Space(); sidewalk.setName("sidewalk"); sidewalk.setDescription("a plain concrete sidewalk with weeds growing through the cracks"); Portal door = new Portal(); door.setName("door"); door.setDirection("outside"); door.setDestination(sidewalk); classroom.setPortal(door); System.out.println(classroom.toStringLong()); } } public class Space { private String _name; private String _description; private Portal _portal; public static void main(String[] args) { // TODO Auto-generated method stub } 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; } public Portal getPortal() { return _portal; } public void setPortal(Portal _portal){ this._portal=_portal; } public String toString(){ return _name; } public String toStringLong(){ if (_portal!= null){ Portal p= new Portal(); p.toStringLong(); String Longcombined=_name + ": " + _description+" with a "+p.toStringLong(); return Longcombined; } else{ String Long=_name + ": " + _description; return Long; } } } public class Portal { private String _name; private String _direction; private Space _destination; public String getName() { return _name; } public void setName(String _name){ this._name=_name; } public String getDirection(){ return _direction; } public void setDirection(String _direction){ this._direction=_direction; } public Space getDestination(){ return _destination; } public void setDestination(Space _de…
has title: Why am I getting a null?
has answer: http://stackoverflow.com/a/26092252
possible better answer: http://stackoverflow.com/a/26092427
type: AnsweredQuestion
tagged with: java
downvote count: 3
score: -3
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26092252
upvote count: 0

http://stackoverflow.com/comment/40944911
has text: and your daymonth is wrong Apr,Jun,Sep,Nov=30, not alternates.
type: Comment
comment on: http://stackoverflow.com/a/26124414
score: 1
type: AnswerComment

http://stackoverflow.com/q/26054920
has body: Lets assume we have the entities below: @Entity @DiscriminatorColumn(name="Type") @Inheritance(strategy=InheritanceType.Joined) public abstract class Employee extends Persistable&lt;Long&gt; { private String firstName; private String lastName; //getters, setters } @Entity @DiscriminatorValue("S") public class SalariedEmployee extends Employee { //various fields } @Entity @DiscriminatorValue("C") public class ContractEmployee extends Employee { //various fields } @Entity @DiscriminatorValue("H") public class HourlyEmployee extends Employee { //various fields } And a Repository public interface EmployeeRepository implements PagingAndSortingRepository&lt;Employee, Long&gt; { } How can I search do a query lets say "Bring me all the Employees that are not HourlyEmployees". Obviously I would require these to be Paged/Sorted so I probably cant do findAll(); and just remove the entries from the Page collection if I'm not mistaken.
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Spring Data - Inheritance Search by Type
tagged with: java
tagged with: spring-data
type: Question
has comment: http://stackoverflow.com/comment/40838441
tagged with: jpa
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/26062650
accepted answer: http://stackoverflow.com/a/26062650
upvote count: 1
answer count: 1
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/40790452
type: Comment
comment on: http://stackoverflow.com/a/26038677
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61909/discussion-between-vinayveluri-and-lkrnac).
type: AnswerComment
score: 0

http://stackoverflow.com/q/26085295
type: Question
has title: Group and count duplicate values in arraylist java
has answer: http://stackoverflow.com/a/26085405
tagged with: arraylist
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26085405
has body: I have used ArrayLists in my application, so I do not want to move to HashMaps as I have seen a few answers using this but did not work in my case. I am creating my final high school project which is a study time table scheduler. I have managed to sort the ArrayList by date of the exam, but now I am trying to analyze the time table to rate it and compare the ratings with other generated timetables to give the user the best timetable (with the highest value). I have gotten the timetable to output what they will be doing on each day ie: Afrikaans, IT, LO, Maths, Afrikaans, Afrikaans, etc. But it seems that it duplicates on the last one for a long time even if the two last exams are within 2 days or very close together, the last one will be more dominant in the entire list. Like this: Exam Dates: LO = 2 Sep Maths = 5 Sep IT = 9 Sep Afrikaans = 10 Sep Results: LO IT Afrikaans Maths IT Afrikaans Afrikaans Afrikaans Afrikaans As you can see, the result is much more weighted towards the last given subject. Now I am trying to compare and group the data so I can see how many days were allocated to each subject, so using the above example I need it to look like this: LO = 1 Maths = 1 IT = 2 Afrikaans = 5 So far I have this: ArrayList&lt;Day&gt; days = new ArrayList&lt;Day&gt;(); For(int i = 0; i &lt; timeTable.size(); i++) { // need to group the days here if(days.contains(timeTable.get(i))) { days.get(i).incrementNumberOfDays(); } else { days.add(timeTable.get(i)); } } But that is not grouping the data and counting the duplicates. Please help, my project is due in a week and I have spent two months on it. I am almost finished and am stuck here. Thanks in advance!
has answer: http://stackoverflow.com/a/26085642
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26085642
tagged with: java
has comment: http://stackoverflow.com/comment/40878962

http://stackoverflow.com/comment/41019151
score: 1
has text: after 2-3 hours of researching and trying many ways of overriding/ editing the object after it persists ive come to the conclusion its impossible and the easiest way is to make a new dummy JPA ID column then inserting what i want in the read ID column. thanks guys
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26162971

http://stackoverflow.com/q/26172994
tagged with: database
score: 0
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/26173129
accepted answer: http://stackoverflow.com/a/26173129
tagged with: android
type: AnsweredQuestion
has body: I am creating an app that has imageButton buildings that the user can purchase. When they are purchased they are put onto the users layout and are then drag and drop. When the user moves the building the coordinates are automatically saved when it is dropped. My issue is that after adding in the functions to load the coordinates back up, I get the error that I posted in my logcat. I have seen this question many times and have tried all that I have seen with no luck. Please help guys. Thanks. Here are my column names: public static final String KEY_ROWID = "_id"; public static final String KEY_ROCK = "amount_of_rock"; public static final String KEY_METEORROCK = "amount_of_meteor_rock"; public static final String KEY_WATER = "amount_of_water"; public static final String KEY_SHOVEL = "shovel_level"; public static final String KEY_SHOVELEXP = "shovel_experience"; public static final String KEY_BUCKET = "bucket_level"; public static final String KEY_BUCKETEXP = "bucket_experience"; public static final String KEY_PICKAXE = "pickaxe_level"; public static final String KEY_PICKAXEEXP = "pickaxe_experience"; public static final String KEY_POPULATION = "population"; public static final String KEY_MAINHUTLEVEL = "main_hut_level"; public static final String KEY_MAINHUTHEALTH = "main_hut_health"; public static final String KEY_MAINHUTX = "main_hut_x_coord"; public static final String KEY_MAINHUTY = "main_hut_y_ coord"; private static final String DATABASE_NAME = "2023db"; private static final String DATABASE_TABLE = "maintable"; private static final int DATABASE_VERSION = 1; Here is my code for getting the saved coordinates of the mainHut (the line that the error occurs on has a comment next to it in the getMainHutY function): public float getMainHutX() { float mainHutX = 0; int iMainHutX = 0; String[] columns = new String[] {KEY_ROWID, KEY_ROCK, KEY_METEORROCK, KEY_WATER, KEY_POPULATION, KEY_SHOVEL, KEY_BUCKET, KEY_PICKAXE, KEY_SHOVELEXP, KEY_BUCKETEXP, KEY_PICKAXEEXP, KEY_MAINH…
tagged with: coordinates
type: Question
has title: Couldn't read row 0, col -1 from CursorWindow error after adding code to load coordinates from sqlite database
tagged with: java

http://stackoverflow.com/q/26154457
type: AnsweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41000261
accepted answer: http://stackoverflow.com/a/26154473
possible better answer: http://stackoverflow.com/a/26154467
has comment: http://stackoverflow.com/comment/41000264
type: Question
has answer: http://stackoverflow.com/a/26154510
has answer: http://stackoverflow.com/a/26154467
has answer: http://stackoverflow.com/a/26154473
has body: i have 2 arraylist ArrayList&lt;List&lt;Integer&gt;&gt; main = new ArrayList&lt;&gt;(); ArrayList&lt;Integer&gt; sub=new ArrayList&lt;&gt;(); sub.add(1); sub.add(2); main.add(sub); sub.clear(); sub.add(5); sub.add(6); sub.add(7); main.add(sub); now i expect main to be what i expect main--&gt;[[1,2],[5,6,7]] ; but really main--&gt;[[567],[567]]; i think sub array share reference ..so how can i make main as [[1,2],[5,6,7] i can't create sub1 ,sub2,...because actually i do this inside huge loop
has title: arraylist not work as expected
tagged with: arraylist
upvote count: 4
has answer: http://stackoverflow.com/a/26154606
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26154514
has comment: http://stackoverflow.com/comment/41000376
score: 2

http://stackoverflow.com/q/26186567
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/41072292
score: 0
has title: How to Deal with Java JNI Inconsistent Behavior
has body: I am facing inconsistent behavior on Java JNI functions. The same code behaviors differently in different environment. I need your help. I used Java JNI and C++ created a one function DLL file. That function takes a string as the only parameter and read that string out. I created a test program to test the DLL. In the test program there is a JNI class, CppWrapper, to load the DLL and call the native function inside the DLL. The test was successful. Below is the JNI class public class CppWrapper { static{ String jvmBits = System.getProperty("os.arch"); if(jvmBits.equals("x86")){ System.loadLibrary("voice32"); System.out.println(“CppWrapper voice32 loaded”); }else{ System.loadLibrary("voice64"); System.out.println(“CppWrapper voice64 loaded”); } } native public static int speak(String str); } Calling the native method in the JNI class: String line = toSpeakTextArea.getText(); CppWrapper.speak(line); I copied the whole JNI class to the application I am working on and the exact code caused “java.lang.UnsatisfiedLinkError”. The DLL file is loaded but the function inside the DLL cannot be found. Changing name of the JNI class in the test program caused the same error. Taking the original test program to other PC fails the same way. I made the test program into a jar file and use it as dependency for my application and it worked. Now the situation is that the exactly JNI related code can only work on a particular PC under particular class name. Otherwise it will fail. How you can fix this problem? I use Netbeans 8.01, JDK1.7.0-67, and JRE1.7.0-67. All projects are Maven projects. Below Error Message is from running the original test program on a different PC. Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: com.mycompany.speechuserxp.CppWrapper.speak(Ljava/lang/String;)I at com.mycompany.speechuserxp.CppWrapper.speak(Native Method) at com.mycompany.speechuserxp.SpeechUserXP.speakButtonActionPerformed(SpeechUserXP.java:143) at com.mycompany.speechuserx…
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41063242
type: Question
tagged with: dll

http://stackoverflow.com/q/26140994
has body: I wonder how to send data to USB port without have any device connected to it. The problem I'm facing, is sending a simple "logical one" to the chosen USB port, so next I could check the D+ output of the USB cable on the osciloscope. It is needed for the further conversion of the USB signal to the analog output ended with BNC plug. Currently I play arround a little with http://usb4java.org/index.html and checked its examples https://github.com/usb4java/usb4java-javax-examples/tree/master/src/main/java/org/usb4java/javax/examples. I know the idVendor and idProduct values of my port/cable, but I don't know how could I simply send data "to USB port" without connected any device to it.
downvote count: 0
tagged with: connection
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Send data to USB port
type: Question
score: 1
tagged with: java
tagged with: usb

http://stackoverflow.com/comment/40852368
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26072017
type: Comment
has text: @Elgert no i tried it it doenst work with the xml alone too.

http://stackoverflow.com/comment/40963988
type: QuestionComment
type: Comment
has text: Can't you configure your FTP server to roll the log files?
comment on: http://stackoverflow.com/q/26057777
score: 0

http://stackoverflow.com/q/26140595
has comment: http://stackoverflow.com/comment/40974916
linked to: http://stackoverflow.com/q/2753514
score: 0
has title: Repaint() FontMetrics
answer count: 1
tagged with: paintcomponent
tagged with: fontmetrics
has comment: http://stackoverflow.com/comment/40974368
has answer: http://stackoverflow.com/a/26142165
has comment: http://stackoverflow.com/comment/40974431
has body: I have something I need to draw on the screen, but that requires font metrics to draw correctly. I also need to use repaint() or something else to draw to the screen right then and there. If I have a paintComponent(Graphics) method, I can retrieve the font metrics correctly via g.getFontMetrics(g.getFont()). The problem is, I cannot tell it to paint it's self. It only does it when something happens such as the component being resized. Then if I use just normal paint(Graphics), I may use repaint() to draw when I want it to, but calling g.getFontMetrics(g.getFont()) does not return correct values. Any ideas? repaint();//I need to call repaint() or something similar to draw to the screen when I want it to public void paint(Graphics g){ FontMetrics metrics = g.getFontMetrics(g.getFont());//Returns different metrics than that of paintComponent(Graphics) } public void paintComponent(Graphics g){ FontMetrics metrics = g.getFontMetrics(g.getFont());//Returns different metrics than that of paint(Graphics) }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40974316
tagged with: fonts
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/q/26091407
linked to: http://stackoverflow.com/q/19380836
tagged with: struts
tagged with: struts2
upvote count: 2
answer count: 2
has body: I am following the steps given in http://www.tutorialspoint.com/struts_2/struts_quick_guide.htm for a sample struts 2 application but I am getting following error message : Can not find the tag library descriptor for "/struts-tags I followed several helps : Error - Can not find the tag library descriptor for "/struts-tags" Cannot find the tag library descriptor for /WEB-INF/struts-html.tld in Struts still the error persists.. what shall I do? Thanks
linked to: http://stackoverflow.com/q/4050712
has comment: http://stackoverflow.com/comment/40887942
favorite count: 0
has comment: http://stackoverflow.com/comment/53282107
linked to: http://stackoverflow.com/q/14374311
has title: eclipse : Can not find the tag library descriptor for "/struts-tags"
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33559777
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40893515
tagged with: java
tagged with: eclipse
type: Question
tagged with: taglib
has answer: http://stackoverflow.com/a/32719804

pipeline
type: Tag
tags question: http://stackoverflow.com/q/26084761
tag name: pipeline

http://stackoverflow.com/q/26105553
downvote count: 1
possible better answer: http://stackoverflow.com/a/26105720
has title: Why would this simple java code not compile?
has comment: http://stackoverflow.com/comment/40912513
has answer: http://stackoverflow.com/a/26105589
has comment: http://stackoverflow.com/comment/40912008
has answer: http://stackoverflow.com/a/26105720
tagged with: java
has comment: http://stackoverflow.com/comment/40910860
linked to: http://stackoverflow.com/q/9854166
upvote count: 4
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/26105571
type: Question
score: 3
has comment: http://stackoverflow.com/comment/40910807
tagged with: syntax
has body: I had this question on a software development quiz and I'm not sure the reasoning behind the answer. unsigned int x = 1; while(x > 10) { System.out.print(x); x++; } My answer was "The code compiles, but there is no output." The correct answer is that "The code does not compile." Would the compiler not try to run since there are no clear syntax errors?
answer count: 3
accepted answer: http://stackoverflow.com/a/26105571

http://stackoverflow.com/comment/41003981
score: 1
comment on: http://stackoverflow.com/q/26156360
has text: 3 Mio. lines? For how much MB would that make? 100? That's not terribly big. Btw, having "only 1 class" has no implication on the number of objects you actually create.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40796724
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26042547
type: Comment
has text: I edited my OP to what it looks like when i get rid of the other months. This gives the result of "error20" When you type in 2014, when it should produce "April 20"

http://stackoverflow.com/a/26068557
downvote count: 0
type: Answer
score: 2
has body: ArrayBuffer is basically an array that implements all the convenient methods of a Buffer. It works the way you describe: if you remove an element, all the remaining elements are shifted to "fill the gap" and as stated in the doc, it might take some time especially if you remove the first element: Append, update and random access take constant time (amortized time). Prepends and removes are linear in the buffer size. Therefore I would not recommend using an ArrayBuffer as a queue. Actually, best option is your question: simply use a Queue. It is designed to be, well... a queue!
answers question: http://stackoverflow.com/q/26068412
upvote count: 2

http://stackoverflow.com/comment/41046482
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26179372
has text: Thanks, I was hoping there will be a way to add attribute to configuration parameters. I was hoping somethig like from maven-antrun-plugin `<copy file="${ver.template.dir}/${ver.template.file}" tofile="${ver.template.dir}/${ver.class.name}.java" />`

http://stackoverflow.com/a/26096135
score: 0
answers question: http://stackoverflow.com/q/26095918
type: Answer
has body: The idea is not to read the entire file contents at one time using the buffered input stream. You use the buffered input stream to read as many bytes as the bytes[] array size. You consume the bytes read and then move on to reading more bytes from the file. Hence you don't need know the file size in order to read it. This post will be more helpful as it explains why you should wrap a fileinputstream with a buffered input stream Why is using BufferedInputStream to read a file byte by byte faster than using FileInputStream?

http://stackoverflow.com/a/26045903
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26045839
answers question: http://stackoverflow.com/q/26045839
has body: you should use following code in this case.char operator has to be initialized before use System.out.println("choose operator"); operator c = scan.next().charAt(0);
score: 1

http://stackoverflow.com/q/26068837
has comment: http://stackoverflow.com/comment/40844229
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26068950
tagged with: java
type: Question
has body: When developing for the android. Are we bound to using xml layout files? (In res\layout ) Or can we skip them entirely and programmatically create and implement our layouts for UI?
has title: Skipping Android Layouts xml resource
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/45572673
score: 0
type: AnswerComment
has text: Just so you know, I mis-clicked last semester. That's why I accidently downvoted. As soon as I get 15 reputation, I'll be voting that up.
type: Comment
comment on: http://stackoverflow.com/a/26084746

http://stackoverflow.com/a/26070527
type: AcceptedAnswer
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26068987
accepted answer of: http://stackoverflow.com/q/26068987
has body: Because you're setting your value as Arial for all three radio buttons. So no matter what radio button you choose it will always return you arial. This how your html page would look like: &lt;input type="radio" name="FTNAME" value="Arial" checked="checked"&gt; &lt;input type="radio" name="FTNAME" value="Arial"&gt; &lt;input type="radio" name="FTNAME" value="Arial"&gt; And you servlet request.getParameter("FTNAME") would alway return you the value "Arial". You need to change to something like this buf.println("&lt;input type=\"radio\" name=\"FTNAME\" value=\"Arial\"" + (FTNAME.equals("Arial") ? "checked=\"checked\"" : "") + "&gt;Arial &amp;nbsp &amp;nbsp &amp;nbsp"); buf.println("&lt;input type=\"radio\" name=\"FTNAME\" value=\"Serif\""+ (FTNAME.equals("Serif") ? "checked=\"checked\"" : "") + "&gt;Serif &amp;nbsp &amp;nbsp &amp;nbsp"); buf.println("&lt;input type=\"radio\" name=\"FTNAME\" value=\"SansSerif\""+ (FTNAME.equals("SansSerif") ? "checked=\"checked\"" : "") + "&gt;SansSerif &lt;br&gt;&lt;br&gt;");

http://stackoverflow.com/q/26076340
score: 0
answer count: 2
tagged with: real-time
accepted answer: http://stackoverflow.com/a/26076429
type: AnsweredQuestion
tagged with: raytracing
tagged with: rendering
has title: Java Raytracer: Multithreaded CPU rendering of different parts of the screen per thread
tagged with: java
has answer: http://stackoverflow.com/a/26076429
type: Question
possible better answer: http://stackoverflow.com/a/26076471
has answer: http://stackoverflow.com/a/26076471
has body: So I've been working on a simple real-time raytracer using purely Java and now that I have most stuff working correctly from diffuse lighting and specular highlights to ray reflections and refractions I started wondering if I could make a minimalistic adventure game using this fresh engine of mine. Only thing preventing me from doing that is the poor performance in higher than 512x512 resolutions. So I decided to read up a bit about multithreading in Java because I've never before needed more than one thread for my projects so I had no previous experience about that subject. So after that I tried various ways of implementing multithreaded rendering and finally got to a point where 4 threads render their given portion of the screen individually and pass it to the buffered image's pixel data which represents the screen. And I'm quite okay with that, the only real problem now is syncing the rendering with updating the whole image and I've tried numerous ways to do that but can't come up with anything good, it's always flickering or has some noise or is blocky because stuff is being rendered all the time even when refreshing the screen. Here's my project's source code in github, the rendering is done in Engine.java: https://github.com/Harha/JRay I've tried to look for answers regarding this via google and from stackoverflow directly with no luck, noone seems to really have done something like this publicly in the past or then I'm just bad at searching for things. Anyways, I'm out of ideas and wondered if someone here could come up with some sensible answer which could be used to sync all the rendering threads with the main thread that's updating the bitmap. Thanks in advance, I by no means want to be spoonfed but as I said, I really am out of ideas for this... Edit: Here's my fixed run loop. /* * Main run method. * Handles the update and render methods. */ public void run() { for (int i = 0; i &lt; THREAD_COUNT; i++) { updateDelta(i); lastFPS[i] = getTime(); } requestFo…

http://stackoverflow.com/a/26159074
downvote count: 0
score: 1
has body: Try this (warning not tested): public static long getRowCount(Class&lt;?&gt; rootClass) { CriteriaBuilder cb = EM.getCriteriaBuilder(); CriteriaQuery&lt;Long&gt; query = cb.createQuery(Long.class); Expression&lt;?&gt; root = query.from(rootClass); query.select(cb.count(root)); return EM.createQuery(query).getSingleResult(); } /*****/ DbTools.getRowCount(PlacesEntity.class); Good luck!
has comment: http://stackoverflow.com/comment/41011812
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41010739
accepted answer of: http://stackoverflow.com/q/26148571
type: Answer
answers question: http://stackoverflow.com/q/26148571

http://stackoverflow.com/q/26081983
has body: I have a text file that says.... This is Apache pig, works like a charm. So I want to count each time every character is repeating. This should print... T = Count of T H = Count of H A = Count of A B = ......... Can anyone tell me how do I break my words into characters into Pig. Any help would be greatly appreciated.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26086409
has title: Map Reduce Framework
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26086409
upvote count: 1
type: Question

http://stackoverflow.com/comment/41002883
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26155718
score: 1
has text: You need to nest the prop element inside a props element.

http://stackoverflow.com/q/26051580
favorite count: 0
accepted answer: http://stackoverflow.com/a/26051625
tagged with: design-patterns
type: AnsweredQuestion
score: 2
tagged with: builder
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26051625
has body: Is there a difference between declaring an instance of your parent class in your builder and initializing each Field using that variable and declaring each variable separately again inside the builder then declaring the builder as part of your constructor to initialize each Field? public class Foo { public int i; public String s; private Foo(Builder builder) { i = builder.i; s = builder.s; } public static class Builder { private int i; private String s; public Builder i(int i) { this.i = i; return this; } public Builder s(String s) { this.s = s; return this; } public Foo build() { return new Foo(this); } } } public class Foo { public int i; public String s; public static class Builder { private final Foo mFoo = new Foo(); public Builder i(int i) { mFoo.i = i; return this; } public Builder s(String s) { mFoo.s = s; return this; } public Foo build() { return mFoo; } } }
answer count: 1
has title: What is the difference, if any, between these builder patterns?
downvote count: 0

http://stackoverflow.com/comment/41034522
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26172653
has text: Can't import jars into what man? Netbeans? IntelliJ? Space?

http://stackoverflow.com/a/26113084
has comment: http://stackoverflow.com/comment/40924594
has comment: http://stackoverflow.com/comment/40925127
has comment: http://stackoverflow.com/comment/40925976
has body: The problem was that you were not following the proper hierarchy of the fragment and activity. You can always access the views and methods of fragments after you load the fragment. In your case you were indirectly passing the value from MainActivity to FragmentA and from FragmentA you were opening AnotherActivity which contains your FragmentB. In your case your were trying to pass value through intent from one fragment to another using an Intent, which not a valid way. You can always pass values between fragments through Bundle and get it from Bundle. Check out my changes below ,its working now. and do relevant changes according to your need. Just do the following changes in your all the classes. MainActivity.java public class MainActivity extends Activity { FragmentA f1; FragmentB f2; FragmentManager manager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); manager = getFragmentManager(); f1 = (FragmentA) manager.findFragmentById(R.id.fragment1); Log.d("this", "setCommunicator"); } /* @Override public void respone(int index) { // TODO Auto-generated method stub f2 = (FragmentB) manager.findFragmentById(R.id.fragment2); Log.d("this", "f2 referenced from Main"); if (f2 != null &amp;&amp; f2.isVisible())// landscape { f2.changeText(index); } else // portrait { Intent i = new Intent(this, AnotherActivity.class); i.putExtra("index", index); startActivity(i); } }*/ } FragmentA.java public class FragmentA extends Fragment implements OnItemClickListener { ListView list; Communicator comm; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub return inflater.inflate(R.layout.fragment_layout_a, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); list = (ListView) getActivity().find…
has comment: http://stackoverflow.com/comment/40929368
has comment: http://stackoverflow.com/comment/40929352
has comment: http://stackoverflow.com/comment/40924520
score: 0
has comment: http://stackoverflow.com/comment/40924720
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40925355
accepted answer of: http://stackoverflow.com/q/26112812
has comment: http://stackoverflow.com/comment/40928856
has comment: http://stackoverflow.com/comment/40925241
answers question: http://stackoverflow.com/q/26112812
type: Answer
has comment: http://stackoverflow.com/comment/40925566
has comment: http://stackoverflow.com/comment/40926394

http://stackoverflow.com/a/26039260
downvote count: 0
answers question: http://stackoverflow.com/q/26039056
accepted answer of: http://stackoverflow.com/q/26039056
has body: Looks like you are either adding products or displaying them. Instead of maintaing 4 different ArrayLists, use a class Product and maintain 1 list. class Product { Integer prodNum; String prodName; Integer prodPay; Integer prodPrice; } List&lt;Product&gt; listOfProducts = new ArrayList&lt;Product&gt;(); Also the 4 if blocks for 'code' can be replaced by a switch statement.
has comment: http://stackoverflow.com/comment/40812191
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26192967
type: Question
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/41097967
has answer: http://stackoverflow.com/a/26224040
accepted answer: http://stackoverflow.com/a/26224040
score: 0
tagged with: validation
answer count: 1
has comment: http://stackoverflow.com/comment/41109224
tagged with: xsd
has body: I've spent a long time trying to figure out how to validate a XML file, and I've got it working with a pre-generated XSD schema. However, I wish to dynamically generate a schema without creating a file, based on the annotation class I have specified, I've tried to not specify any parameters to SchemaFactory, but then it seems to just create an empty schema (see comments below). Here are the two classes I use for my JAXB reading and writing of a XML file. This is the code for the class XMLTranslationWrapper: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(namespace = "my.package.namespace") public class XMLTranslationWrapper { @XmlElementWrapper(name = "TRANSLATIONS") @XmlElement(name = "TRANSL") public ArrayList<XMLTranslationNode> translations; public XMLTranslationWrapper(){ translations = new ArrayList<XMLTranslationNode>(); } public void setTranslations(ArrayList<XMLTranslationNode> translations){ this.translations = translations; } public XMLTranslationNode getTranslation(String code){ for(XMLTranslationNode transl : translations){ if(transl.getCode().equals(code)) return transl; } return null; } public void addTranslation(XMLTranslationNode translation){ this.translations.add(translation); } } This is the code for the class XMLTranslationNode: @XmlAccessorType(XmlAccessType.PROPERTY) @XmlRootElement(name = "TRANSL") @XmlType(propOrder = { "severity", "translation" }) public class XMLTranslationNode { private String severity; private String code; private String translation; @XmlElement(name="SEVERITY") public String getSeverity(){ return this.severity; } public void setSeverity(String severity){ this.severity = severity; } @XmlAttribute(name="CODE") public String getCode(){ return this.code; } public void setCode(String code){ this.code = code; } @XmlElement(name="TRANSLATION") public String getTranslation(){ return this.translation; } public void setTranslation(String translation){ this.translation = translation; } } This is the code I used to generate t…
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41107991
has title: JAXB how to dynamically generate a schema to use it for validation immediately?

http://stackoverflow.com/comment/41038159
has text: If you want to do it by coding in java, i recomend to use libraries: gson[link](https://code.google.com/p/google-gson/) and JAXB. gson helps you to convert java obejcts to json. JAXB will help you to change XML to java obecjts (unmarshall).
type: Comment
comment on: http://stackoverflow.com/a/26137937
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40850649
type: Comment
score: 1
has text: You're taking a Student into the dark side of the force :). Even @Jon Skeet can't do financial calculations using float or double.
type: AnswerComment
comment on: http://stackoverflow.com/a/26068135

http://stackoverflow.com/q/26102473
has comment: http://stackoverflow.com/comment/40905271
answer count: 3
has comment: http://stackoverflow.com/comment/40905425
has answer: http://stackoverflow.com/a/26102595
downvote count: 0
score: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40905338
accepted answer: http://stackoverflow.com/a/26102595
tagged with: java
upvote count: 1
has title: Guess-Who? Best Algorithm
has body: I'm making a program that imitates the guess-who game where questions are asked in order to determine who the secret person is. I'm just kind of stuck on how to categorize my questions in a way that it will be the most efficient, the characters have 6 different attributes, Shirt, Hair, Eye, Smiling, Hair, Glasses. I already wrote a program to this but my decision tree was so inefficient that it asked around 10-30 questions. My aim is to find an algorithm thats between 6-10 questions. If it helps I'll provide the my old tree to show you what I'm talking about but I'm gonna make a new one based on what you guys think. if (g.hairIsColor(Color.BROWN) &amp;&amp; g.eyeIsColor(Color.HAZEL) &amp;&amp; g.isSmiling() &amp;&amp; g.shirtIsColor(Color.GREEN) &amp;&amp; g.isWearingGlasses()) a = "Emily"; if (g.hairIsColor(Color.BROWN) &amp;&amp; g.shirtIsColor(Color.GREEN)) { if (g.eyeIsColor(Color.BLUE)) a = "Alice"; else if (g.eyeIsColor(Color.GREEN)) a = "Frank"; else if (g.eyeIsColor(Color.BROWN) &amp;&amp; g.isWearingGlasses()) a = "Bob"; else if (g.eyeIsColor(Color.BROWN)) a = "Dave"; // this might be an error for other brown hair else a = "Isabelle"; } // NULL IT WAS EMILY FALSE else if (g.hairIsColor(Color.BROWN) &amp;&amp; g.shirtIsColor(Color.RED)) { if (g.eyeIsColor(Color.GREEN)) a = "Philip"; else if (g.eyeIsColor(Color.BLUE) &amp;&amp; !g.isSmiling()) a = "Wendy"; else if (g.eyeIsColor(Color.BLUE) &amp;&amp; g.isWearingGlasses()) a = "Mallie"; else if (g.eyeIsColor(Color.BLUE)) a = "Nick"; else if (g.eyeIsColor(Color.BROWN) &amp;&amp; g.isWearingHat()) a = "Robert"; else if (g.eyeIsColor(Color.BROWN) &amp;&amp; g.isSmiling()) a = "Quinn"; } else if (g.hairIsColor(Color.BLACK) &amp;&amp; g.shirtIsColor(Color.BLUE)) { if (!g.isSmiling()) a = "Carol"; else if (g.isWearingHat()) a = "Gertrude"; else a = "Olivia"; } else if (g.hairIsColor(Color.BROWN) &amp;&amp; g.eyeIsColor(Color.BLUE)) a = "Tucker"; else if (g.hairIsColor(Color.BROWN) &amp;&amp; g.eyeIsColor(Color.BROWN…
has answer: http://stackoverflow.com/a/26102933
type: Question
possible better answer: http://stackoverflow.com/a/26102721
tagged with: algorithm
has answer: http://stackoverflow.com/a/26102721
has comment: http://stackoverflow.com/comment/40905354
has comment: http://stackoverflow.com/comment/40905302

http://stackoverflow.com/comment/45455933
has text: Is this related to the issue of not being able to convert PDF to PNG?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26190046
type: Comment

http://stackoverflow.com/a/26108274
score: 0
type: Answer
has body: No, it's not static. Each instance you create gets its own copy of the value.
answers question: http://stackoverflow.com/q/26108259

http://stackoverflow.com/comment/40866524
type: Comment
has text: @bobHarding I am glad that it worked for you. If you are no longer looking for an improved answer to your question, consider accepting the answer by clicking the grey check mark next to it. This would let other site visitors know that the problem is solved, and earn you a new badge on Stack Overflow.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26079805

http://stackoverflow.com/comment/40909259
type: AnswerComment
has text: Firstly,I try with Computer com = new Computer(Integer.parseInt(cid), cname, uquan, uprice, func); but there is error with code line when compile
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26104755

http://stackoverflow.com/comment/40914144
score: 0
comment on: http://stackoverflow.com/q/26107192
type: Comment
type: QuestionComment
has text: Your method doesn't care if the objects are Integers, Strings, Circles, Bananas or Fishes. The only thing that matters is that they're all instances of Comparable, so they can always be compared to each other. BTW, any reason why you're reimplementing `Collections.max()` (http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#max%28java.util.Collection%29)? Why dos a method returning the max element of an array modifies this array?

http://stackoverflow.com/q/26056171
has title: Java Cannot find file?
has body: Hi I am trying to set up a scanner to print out contents of a text file. Here is my code: import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ScannerReadFile { public static void main(String[] args) { // Location of file to read File file = new File("CardNative.java.txt"); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); System.out.println(line); } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } } I have created a source folder in the project and put the text file in there. However I keep getting this error: java.io.FileNotFoundException: CardNative.java.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120) at java.util.Scanner.&lt;init&gt;(Scanner.java:636) at ScannerReadFile.main(ScannerReadFile.java:14)
score: 1
possible better answer: http://stackoverflow.com/a/26056587
has answer: http://stackoverflow.com/a/26056239
favorite count: 0
has answer: http://stackoverflow.com/a/26056338
has answer: http://stackoverflow.com/a/26056587
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/40820205
has comment: http://stackoverflow.com/comment/40820109
answer count: 5
has comment: http://stackoverflow.com/comment/40820183
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40820093
accepted answer: http://stackoverflow.com/a/26056239
upvote count: 1
has answer: http://stackoverflow.com/a/26056437
tagged with: resources
type: Question
has answer: http://stackoverflow.com/a/26056279
has comment: http://stackoverflow.com/comment/40820740
downvote count: 0
has comment: http://stackoverflow.com/comment/40820134

http://stackoverflow.com/a/26141538
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40976596
score: 2
accepted answer of: http://stackoverflow.com/q/26141488
answers question: http://stackoverflow.com/q/26141488
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40976246
downvote count: 0
has comment: http://stackoverflow.com/comment/40976144
has body: You have two String literal Objects, namely "A" and "B". Then you explicitly instantiate a new instance of "A" with new String("A");. Finally, the fourth instance is created when you perform the String concatenation s+"B"

http://stackoverflow.com/q/26049191
answer count: 1
has comment: http://stackoverflow.com/comment/40808137
type: UnansweredQuestion
has body: I am trying to write a program that asks the user to enter two points. Each point is entered one at a time. Then I need the x coordinate to me less than or equal to 5 and greater than or equal to -5. I need to follow the same logic but with 2.5 and -2.5. For some reason it's not returning the string statement after the check. I don't have any syntax errors, so I am not sure what the issue is. import java.util.Scanner; public class coordinates { public static void main(String[] args) { Scanner input = new Scanner(System.in); //prompt user to enter coordinates System.out.println("Enter a X coordinate: "); double x = input.nextDouble(); System.out.println("Enter a Y coordinate: "); double y = input.nextDouble(); //check x coordinate to see if it is less or equal to 5 and greater than or equal to -5 if (x &lt;= 5 &amp;&amp; x &gt;= -5){ if (y &lt;= 2.5 &amp;&amp; y &gt;= -2.5) System.out.println("Yes"); }else System.out.println("no"); } }
tagged with: java
has answer: http://stackoverflow.com/a/26049218
type: Question
has comment: http://stackoverflow.com/comment/40807975
tagged with: if-statement
has title: Why my program is not returning the correct string value
score: 0

http://stackoverflow.com/comment/44521204
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28069357
has text: Yes, that's correct. However, javdoc of JDK 7 will fail with this option, that means you have to detect support for the new option. In the end, I ended up fixing the html.
score: 1

http://stackoverflow.com/comment/40793722
comment on: http://stackoverflow.com/a/26041490
score: 0
type: AnswerComment
type: Comment
has text: So you dont know "AbstractSomething" but you have a Class instance... can't you just do classInstance.getField("myAttribute") then?

http://stackoverflow.com/comment/40945044
has text: Do I remove the edit no. 2? How does it work?
comment on: http://stackoverflow.com/q/26123040
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26091603
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40885838
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has body: Is there a way I can specify to only count up to the end of the line?
tagged with: count
tagged with: line
has answer: http://stackoverflow.com/a/26091647
has comment: http://stackoverflow.com/comment/40885948
tagged with: java
type: Question
has title: Is there a functionality in java where I can count the amount of tokens on each line from an input file?
score: -1
tagged with: token

http://stackoverflow.com/a/73048713
score: 0
type: Answer
has body: For me I got this error when I had a window open running the script in interactive mode (code.interact(local=locals())), forgot about this, and tried running the script again in a separate command window.
answers question: http://stackoverflow.com/q/26084212

http://stackoverflow.com/a/26095366
score: 3
answers question: http://stackoverflow.com/q/26095234
downvote count: 0
type: Answer
upvote count: 3
has body: You mention "generic" in your question and use the identifier T for your type, so I'm going to assume you are talking about creating an array of a generic type parameter. You can't do that in Java. Arrays and generics don't mix very well. You can do it with reflection (see this question) but you might have an easier time doing this with a collection class instead. It would be a List of Lists, to get a 2D ragged container.

http://stackoverflow.com/a/26165457
type: Answer
accepted answer of: http://stackoverflow.com/q/26165386
score: 2
answers question: http://stackoverflow.com/q/26165386
downvote count: 0
has body: try to give like this in for loop to create multiple file FileWriter f = new FileWriter("textfile_"+i+".txt");
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/26143915
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26142984
has body: For the people rejecting my edits i will post it right here (as i cannot comment because i have not enough points to) To add on Opiatefuchs, when you are using Eclipse you don't need to register the newly created activity's because Eclipse does this for you. This comes straight from the android dev site: All activities must be declared in your manifest file, AndroidManifest.xml, using an &lt;activity&gt; element. When you use the Eclipse tools to create the activity, it creates a default entry. If you're using a different IDE, you need to add the manifest entry yourself.

http://stackoverflow.com/comment/41054713
comment on: http://stackoverflow.com/a/26167817
type: AnswerComment
score: 0
type: Comment
has text: It refers to using the task manager to stop the program. Is it ok to just rely on the task manager? My gut tells me no, but that was the first thing people answered above. I dont want to overly complicate things if it is not necessary.

http://stackoverflow.com/comment/40800272
has text: http://stackoverflow.com/questions/6939526/java-regex-repeating-capturing-groups and pointers therein
comment on: http://stackoverflow.com/q/26045068
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26095918
possible better answer: http://stackoverflow.com/a/26096149
answer count: 5
has answer: http://stackoverflow.com/a/26096136
accepted answer: http://stackoverflow.com/a/26096136
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40893722
linked to: http://stackoverflow.com/q/8748960
tagged with: inputstream
has title: How do I decide how many bytes to read from an inputstream?
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26096149
linked to: http://stackoverflow.com/q/18600331
has answer: http://stackoverflow.com/a/26096135
downvote count: 0
score: 4
has body: I am trying to read from an InputStream. I wrote below code byte[] bytes = new byte[1024 * 32]; while (bufferedInStream.read(bytes) != -1) { bufferedOutStream.write(bytes); } What I don't understand is how many bytes I should read in an iteration? The stream contains a file saved on the disk. I read here but I did not understand the post really.
has comment: http://stackoverflow.com/comment/40902495
has answer: http://stackoverflow.com/a/26096133
has answer: http://stackoverflow.com/a/57312408
favorite count: 0

http://stackoverflow.com/q/26180501
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/10534126
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/26180571
has body: for those who tried the JAXB library, is there a way to create the file properly formatted? The output is a 1 line file, and it gives me big problems. >,&lt; //xml creation JAXBContext ctx = null; try { ctx= JAXBContext.newInstance("Pojo"); Marshaller marshaller = ctx.createMarshaller(); marshaller.marshal(train, new File(xml_output_file_path)); } catch (Exception e) { e.printStackTrace(); }
has title: JABX xml written on a single line. How do i format
has answer: http://stackoverflow.com/a/26180571
tagged with: java
tagged with: jaxb
duplicate of: http://stackoverflow.com/q/10534126
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26180563
type: Question
accepted answer: http://stackoverflow.com/a/26180563
favorite count: 0

http://stackoverflow.com/q/26061623
possible better answer: http://stackoverflow.com/a/26061774
has answer: http://stackoverflow.com/a/26061774
tagged with: java
accepted answer: http://stackoverflow.com/a/26061742
score: 0
answer count: 2
tagged with: oracle-database
tagged with: memory-leaks
type: AnsweredQuestion
has title: JFrame.remove(Component comp) "destroys" my component?
has body: I want to know if the usage of JFrame's remove(Component comp) method releases the component from memory and destroys it or is it kept to future use? I'm worried about memory leak and I couldn't find a clue at oracle's documentation
tagged with: swing
has answer: http://stackoverflow.com/a/26061742
type: Question

http://stackoverflow.com/q/26041805
has comment: http://stackoverflow.com/comment/40794083
duplicate of: http://stackoverflow.com/q/2149785
has comment: http://stackoverflow.com/comment/40794182
downvote count: 0
has body: File f=new File("D://java"); long totalInBytes=f.getTotalSpace(); long freeInBytes=f.getFreeSpace(); long totalInGB=totalInBytes/(1024*1024*1024); long freeInGB=freeInBytes/(1024*1024*1024); long used=totalInGB-freeInGB; System.out.println(used); I have tried above code but it is giving size of D: drive but not java folder.
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has title: How to know size of folder using java program?
linked to: http://stackoverflow.com/q/2149785
type: Question
has comment: http://stackoverflow.com/comment/40794784

http://stackoverflow.com/q/26101842
favorite count: 0
has comment: http://stackoverflow.com/comment/40906261
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40912186
has comment: http://stackoverflow.com/comment/40904199
tagged with: android
score: 6
tagged with: android-intent
upvote count: 6
has answer: http://stackoverflow.com/a/27443349
tagged with: android-fragments
tagged with: java
has body: I am working with linked in and Facebook sdk in my android app. I am getting the linked in and Facebook login details for login in my app. While the webview load the authorization page, there is a cancel button. I want, when user click on that button the webview should close or redirect to some other webpage. Same thing in Facebook Sdk also. I need help.
type: Question
has title: How to make the cancel button work in linked sdk call in android web view?
answer count: 1
downvote count: 0
tagged with: android-activity

http://stackoverflow.com/a/26052571
score: 3
answers question: http://stackoverflow.com/q/26052064
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Since the code, basically, works, I have to assume the problem is with some other part of the application which I cannot replicate, like the database management for example... However... Your resource management is non-existent...A database Statement has context and has a direct relationship to the query that made it, once you have completed working with it you should make sure you close it, for example... public static Connection createDatabaseConnection() throws SQLException, ClassNotFoundException { //... System.out.println("Database Connected..."); try (Statement statement = c.createStatement()) { count = statement.executeUpdate("CREATE TABLE VAULT (Expenses VARCHAR(5000), ExpensesType VARCHAR(5000), PaymentType VARCHAR(5000), Amount VARCHAR(10), Date VARCHAR(5000))"); System.out.println("Table Created..."); } try (Statement statement = c.createStatement()) { ResultSet res = statement.executeQuery("SELECT * FROM VAULT"); while (res.next()) { String[] row = {res.getString("Expenses"), res.getString("ExpensesType"), res.getString("PaymentType"), res.getString("Amount"), res.getString("Date")}; System.out.print(res.getString("Expenses")); System.out.print(res.getString("ExpensesType")); System.out.print(res.getString("PaymentType")); System.out.print(res.getString("Amount")); System.out.print(res.getString("Date")); GUI.tableModel.addRow(row); } } and... String updateStatement = "INSERT INTO VAULT" + " (Expenses, ExpensesType, PaymentType, Amount, Date)" + " VALUES (\'" + expenses + "\',\'" + expensesType + "\',\'" + paymentType + "\',\'" + amount + "\',\'" + date + "\')"; try (Statement statement = c.createStatement()) { System.out.print(updateStatement); int c = statement.executeUpdate(updateStatement); count = count + c; System.out.println("Data Inserted in to Database..."); } catch (Exception ex) { ex.printStackTrace(); } This will ensure that once you leave the try section, the resource will automatically be closed. You should also consider making use of Prepa…
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26052064

http://stackoverflow.com/comment/40838812
score: 0
type: AnswerComment
has text: It should work,As long as you are getting bean from context.I suspect this could be the issue now...(br.com.allinone.bean)<context:component-scan base-package="br.com.allinone.bean, br.com.allinone.service,br.com.allinone.service.impl"/>
type: Comment
comment on: http://stackoverflow.com/a/26065560

http://stackoverflow.com/comment/40900532
type: Comment
comment on: http://stackoverflow.com/a/26099692
has text: Thank you! This brought me in the right direction. I also found out that I needed to add panel2 to panel. Without doing this, panel wouldn´t display. Is this the case always when using multiple JPanels? Do I have to use one JPanel as a container for the rest?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26063145
type: Question
possible better answer: http://stackoverflow.com/a/26063240
has comment: http://stackoverflow.com/comment/40833382
answer count: 2
tagged with: annotations
has answer: http://stackoverflow.com/a/26063240
tagged with: java
has answer: http://stackoverflow.com/a/26148954
upvote count: 1
has body: I am wondering if the @JsonProperty annotation works recursively? For example: public class AirTravelerType { @JsonProperty protected ProfileRef profileRef; @JsonProperty protected PersonNameType personName; @JsonProperty protected List&lt;Telephone&gt; telephone; I couldn't find any answers about this. Can somebody clarify this for me? Do I have to go to ProfileRef and others to mark its fields with annotations too? Or let it as I mentioned at code snippet and this will be enough?
tagged with: jackson
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26148954
downvote count: 0
score: 1
favorite count: 0
has title: Jackson @JsonProperty annotation works recursivly?

http://stackoverflow.com/q/26159955
has body: I have a GlassFish server with a lot of "java.io.IOException: Bad HTTP request, less data is received than expected" errors in an application instance log. Anyone knows what could be the possible causes of this error? It sounds like the http request sent from the client is malformed, isn't it?
has title: What could be the possible causes of a "java.io.IOException: Bad HTTP request, less data is received than expected" error?
type: UnansweredQuestion
tagged with: http
has comment: http://stackoverflow.com/comment/41010163
has answer: http://stackoverflow.com/a/26160089
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/q/26079616
has answer: http://stackoverflow.com/a/26079632
score: -1
has comment: http://stackoverflow.com/comment/40868828
answer count: 3
has comment: http://stackoverflow.com/comment/40881381
has answer: http://stackoverflow.com/a/29788096
favorite count: 0
downvote count: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/29788096
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26079632
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/44046103
has body: How to object name paramerters in java hibernate? String supplierHql = "from Supplier where name='Kamil'"; Query supplierQuery = session.createQuery(supplierHql); Supplier supplierr = (Supplier) supplierQuery.list().get(0); // ilk değerini aldık String hql = "from Product as product where product.supplier=:supplierr"; Query query = session.createQuery(hql); List resulList = query.list();
has title: How to object name paramerters in java hibernate

http://stackoverflow.com/comment/41038329
comment on: http://stackoverflow.com/a/26174068
score: 0
type: Comment
has text: Yup i can use dialogs.But If its a dialog it'd completely take control over focus.We can't minimize it,we can't open another instance of it.right?So why i am choosing JinternalFrame.
type: AnswerComment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/26189173
tags question: http://stackoverflow.com/q/26185484
tags question: http://stackoverflow.com/q/26081594
tags question: http://stackoverflow.com/q/26060083
tags question: http://stackoverflow.com/q/26134331
tags question: http://stackoverflow.com/q/26175290
tags question: http://stackoverflow.com/q/26193024
tags question: http://stackoverflow.com/q/26126863
tags question: http://stackoverflow.com/q/26094507
tags question: http://stackoverflow.com/q/26126814
tags question: http://stackoverflow.com/q/26189274
tags question: http://stackoverflow.com/q/26120783
tags question: http://stackoverflow.com/q/26168798
tags question: http://stackoverflow.com/q/26126607
tags question: http://stackoverflow.com/q/26148001
tags question: http://stackoverflow.com/q/26047168
tags question: http://stackoverflow.com/q/26110107
tags question: http://stackoverflow.com/q/26057243
tags question: http://stackoverflow.com/q/26047134
tags question: http://stackoverflow.com/q/26105426
tags question: http://stackoverflow.com/q/26074351
tags question: http://stackoverflow.com/q/26187865
tags question: http://stackoverflow.com/q/26135739
tags question: http://stackoverflow.com/q/26170872
tags question: http://stackoverflow.com/q/26052726
tags question: http://stackoverflow.com/q/26083655
tags question: http://stackoverflow.com/q/26183948
tags question: http://stackoverflow.com/q/26069978
tags question: http://stackoverflow.com/q/26068668
tags question: http://stackoverflow.com/q/26110375
tags question: http://stackoverflow.com/q/26124993
tags question: http://stackoverflow.com/q/26113512
tags question: http://stackoverflow.com/q/26147658
tags question: http://stackoverflow.com/q/26066318
tags question: http://stackoverflow.com/q/26151425
tags question: http://stackoverflow.com/q/26191455
tags question: http://stackoverflow.com/q/26127551
tags question: http://stackoverflow.com/q/26093211
tags question: http://stackoverflow.com/q/26034874
tags question: http://stackoverflow.com/q/26107781
tags question: http://stackoverflow.com/q/26044881
tags question: http://stackoverflow.com/q/26123223
tags question: http://stackoverflow.com/q/26178887
type: Tag
tags question: http://stackoverflow.com/q/26072639
tags question: http://stackoverflow.com/q/26145459
tags question: http://stackoverflow.com/q/26063268
tags question: http://stackoverflow.com/q/26093661
tags question: http://stackoverflow.com/q/26121594
tags question: http://stackoverflow.com/q/26115338
tags question: http://stackoverflow.com/q/26140179
tags question: http://stackoverflow.com/q/26084866
tags question: http://stackoverflow.com/q/26148637
tags question: http://stackoverflow.com/q/26083465
tags question: http://stackoverflow.com/q/26193297
tags question: http://stackoverflow.com/q/26118067
tags question: http://stackoverflow.com/q/26153696
tags question: http://stackoverflow.com/q/26038376
tags question: http://stackoverflow.com/q/26034202
tags question: http://stackoverflow.com/q/26167607
tags question: http://stackoverflow.com/q/26112884
tags question: http://stackoverflow.com/q/26045782
tags question: http://stackoverflow.com/q/26125454
tags question: http://stackoverflow.com/q/26108156
tags question: http://stackoverflow.com/q/26140297
tags question: http://stackoverflow.com/q/26111034
tags question: http://stackoverflow.com/q/26071530
tags question: http://stackoverflow.com/q/26091613
tags question: http://stackoverflow.com/q/26117364
tags question: http://stackoverflow.com/q/26041792
tags question: http://stackoverflow.com/q/26095001
tags question: http://stackoverflow.com/q/26157551
tags question: http://stackoverflow.com/q/26038056
tags question: http://stackoverflow.com/q/26039819
tags question: http://stackoverflow.com/q/26166767
tags question: http://stackoverflow.com/q/26171312
tags question: http://stackoverflow.com/q/26108857
tags question: http://stackoverflow.com/q/26118748
tags question: http://stackoverflow.com/q/26118471
tags question: http://stackoverflow.com/q/26070023

http://stackoverflow.com/q/26162855
answer count: 1
has comment: http://stackoverflow.com/comment/41016513
has comment: http://stackoverflow.com/comment/41019169
score: 0
has answer: http://stackoverflow.com/a/26164611
has body: I am trying to debug a Java / Maven project with a lot of depencies on various libraries. When I run it on a Linux server the program starts up fine, but when I try to run it in Eclipse it throws the following exception: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.camel.model.RouteDefinition.getErrorHandlerBuilder()Lorg/apache/camel/ErrorHandlerFactory; at org.apache.camel.spring.spi.SpringTransactionPolicy.wrap(SpringTransactionPolicy.java:69) at org.apache.camel.model.PolicyDefinition.createProcessor(PolicyDefinition.java:133) at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:437) at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:183) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:817) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165) at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:697) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1654) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1441) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316) Now, I can see that the RouteDefinition class is in the camel-core-2.9.3,jar and I can see that this library is imported. So how come it doesn't see that method? How do I go about debugging this? Could I get info from the process running on the Linux server? For example can I get the list of Jars that are imported and the order in which they are imported? Many thanks!
has comment: http://stackoverflow.com/comment/41019067
has comment: http://stackoverflow.com/comment/41015950
tagged with: maven
tagged with: nosuchmethoderror
accepted answer: http://stackoverflow.com/a/26164611
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41016724
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/41017118
has title: NoSuchMethodError with Camel RouteDefinition class
tagged with: eclipse
type: Question

http://stackoverflow.com/q/26175736
tagged with: multithreading
type: Question
tagged with: java
tagged with: eclipse
score: 0
tagged with: shutdown
has comment: http://stackoverflow.com/comment/41040046
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41040212
type: UnansweredQuestion
has title: Eclipse doesn't run embedded Tomcat shutdown sequence when pressing stop button
has body: Usually, when I hit the stop button from within Eclipse on the embedded Tomcat instance, the current console is swapped with a new, empty, console window. The former console window is still available though, and if I switch back to it I can see the Tomcat shutdown sequence (with all the messages, warning and such). But it happens to me, at times, that when I hit the stop button, the server is in fact stopped, but the shutdown process isn't visible &mdash; i.e. nothing gets written to the console. The console stays on the last application message. The Tomcat instance is actually stopped almost instantaneously. Why is this happening? Am I doing something wrong that can happen in production too, or is this just a quirk in the Eclipse Tomcat plugin? I never saw such behaviour until a couple of days ago, when I started hunting down never ending threads. I'm putting togheter a simple cleaning strategy &mdash; I basically trace the creation of each component that makes use of threads in a singleton, and I call any interrupt(), shutdown() or cleanup() method those components expose in a ServletContextListener. I just discovered that when the shutdown process is correctly called, on the debug pane it says: &lt;terminated, exit value: 0&gt;\path\to\java_home\bin\javaw.exe when, instead, the server is suddenly halted, I see: &lt;terminated, exit value: 1&gt;\path\to\java_home\bin\javaw.exe
answer count: 0
has comment: http://stackoverflow.com/comment/41040120

http://stackoverflow.com/a/26105101
has comment: http://stackoverflow.com/comment/40915154
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40910065
has comment: http://stackoverflow.com/comment/40915310
type: Answer
answers question: http://stackoverflow.com/q/26104767
accepted answer of: http://stackoverflow.com/q/26104767
upvote count: 3
has body: Oddly I couldn't really find much on sorting outside of arrays and lists so I will assist you. Code: int temp; for (int count = 0; count &lt; 4; count++) { if ( number2 &lt; number1) { temp = number1; number1 = number2; number2 = temp; } if ( number3 &lt; number2) { temp = number2; number2 = number3; number3 = temp; } if ( number4 &lt; number3) { temp = number3; number3 = number4; number4 = temp; } if ( number5 &lt; number4) { temp = number4; number4 = number5; number5 = temp; } } System.out.println( number1 + " " + number2 + " " + number3 + " " + number4 + " " + number5); System.out.println( number5 + " " + number4 + " " + number3 + " " + number2 + " " + number1); Sorting will get easier as you learn some of the algorithms and how they work. Until then, I hope this helps. The basic idea is to check each pair and swap the values. You will need to do this multiple times in order to get the last value to the beginning of your list of values.
has comment: http://stackoverflow.com/comment/40910445

http://stackoverflow.com/comment/40908018
comment on: http://stackoverflow.com/q/26089408
type: Comment
type: QuestionComment
has text: Just curious: where did you get the example 4.35 from? It seems to be a popular one used on SO (and one I've used on my blog, which I got from a Udacity Java class).
score: 0

http://stackoverflow.com/a/26085149
has comment: http://stackoverflow.com/comment/40893262
type: Answer
accepted answer of: http://stackoverflow.com/q/26084866
answers question: http://stackoverflow.com/q/26084866
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40893905
has comment: http://stackoverflow.com/comment/40873991
has body: You can encode it (i.e. base64) before you send it and decode it on server or you can use JSON as request param. Using JSON, for example; @POST @Path("/update") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public void update(PathContext ctx) { updateURI(ctx.getPath(),ctx.getContent()); } @XmlRootElement public class PathContext { private String path; private String content; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } } Your JSON will look like; {"path": somePath, "content": someContent} Hope it helps.
has comment: http://stackoverflow.com/comment/40892933
has comment: http://stackoverflow.com/comment/40924535
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40873850

http://stackoverflow.com/comment/41071165
type: QuestionComment
has text: No sir I don't know. My instructor just taught us how to add small texts and buttons. There were no visible errors on the MainJava only when I try to run it on Eclipse's android emulator
score: 0
comment on: http://stackoverflow.com/q/26192636
type: Comment

http://stackoverflow.com/comment/40921544
type: AnswerComment
has text: `result = s_classLoggers.putIfAbsent(klass, new ClientLogger(klass));` This will return null for the first time call. Right? And then NPE exception will be thrown in my code.
type: Comment
comment on: http://stackoverflow.com/a/26111067
score: 0

http://stackoverflow.com/a/26074020
score: 5
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26073723
has body: It is displaying the text, you just don't see it. The top of the TextArea is just too high to be displayed. You have to change this line: ta.setBounds(10, 10, 400, 400); to this: ta.setBounds(10, 30, 400, 400); Changing the Y position will solve the problem.

http://stackoverflow.com/q/26081528
has body: When I tried to pass a String extra over to the next activity, It works fine. When I try to pass a int like the following codes, it crashs and throws Resources$NotFoundException. I've been playing around it for few hours so I thought I can get some guidance with this. This is the code from the activity that is passing the values with putExtra() public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Intent cP = new Intent("com.example.loldb.championscreen"); int x = arg2 + 1; System.out.println(x); cP.putExtra("champNo", x); startActivity(cP); } and here's the code of the receiving activity trying to getIntExtra() the data protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_champion_screen); Intent intent = getIntent(); TextView cName = (TextView) findViewById(R.id.cname); int temp = intent.getIntExtra("champNo", 0); //int champNo = Integer.parseInt(temp); cName.setText(temp); } If possible I would like to get an explanation on this matter, so I can understand it a little more. Thanks in advance.
answer count: 1
has answer: http://stackoverflow.com/a/26081534
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: getStringExtra() works but getIntExtra() returns null
accepted answer: http://stackoverflow.com/a/26081534
type: Question
score: 0

http://stackoverflow.com/comment/40803381
has text: I never said there's a reference to 'sorting'. Please read what I wrote again. I guessed that because he wanted to compare a list of objects he might be interested in sorting them. I think there was not anything in my post to downvote it.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26046524

http://stackoverflow.com/q/26147653
accepted answer: http://stackoverflow.com/a/26147699
has comment: http://stackoverflow.com/comment/40987676
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/26147705
possible better answer: http://stackoverflow.com/a/26147679
has comment: http://stackoverflow.com/comment/40987627
tagged with: parameters
has answer: http://stackoverflow.com/a/26147679
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: methods
type: Question
has body: Newbie here working a program where many methods repeat in somewhat the same manner, and I wonder if I can just make a method for this pattern with the different methods as parameter? So basically for simplicity, let's say some methods need to repeat X times I need something like this, except this doesn't work: public static void repeatThis(void method, int times){ for (int i = 0, i &lt; times, i++){ method; } } Which'd be a method to repeat the input method exactly times amount of times. But this doesn't work for good reasons. So how can I do something like this, whereas a parameter refers to a method which the first method should handle?
has comment: http://stackoverflow.com/comment/40987698
has comment: http://stackoverflow.com/comment/40987612
favorite count: 0
has answer: http://stackoverflow.com/a/26147728
has answer: http://stackoverflow.com/a/26147699
has comment: http://stackoverflow.com/comment/40987650
has title: How can I make a java method which repeats a parameter method in a certain way?
answer count: 4

http://stackoverflow.com/q/26161976
has answer: http://stackoverflow.com/a/26162041
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26162095
upvote count: 0
score: -2
has title: getText() method of EditText
has comment: http://stackoverflow.com/comment/41014513
answer count: 2
linked to: http://stackoverflow.com/q/513832
tagged with: android
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
type: UnansweredQuestion
downvote count: 2
has body: I have a problem with getText() method. When I run this app and enter any number, also 9 it displays vcx. Is my if statement invalid or what? public class Quadratic extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_quadratic, container, false); // layout Button calc = (Button)rootView.findViewById(R.id.calcbtn); //main button final EditText etfx2 = (EditText)rootView.findViewById(R.id.etfx2); // x^2 etf final TextView tbefs = (TextView)rootView.findViewById(R.id.tbefs); calc.setOnClickListener(new View.OnClickListener() { public void onClick (View v){ String a= etfx2.getText().toString(); if(a=="9") { tbefs.setText("asd");} else { tbefs.setText("vcx"); } } }); return rootView; }}
has comment: http://stackoverflow.com/comment/41014161

http://stackoverflow.com/comment/40944215
has text: not intentional, thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26124007
score: 0

http://stackoverflow.com/comment/40794068
has text: as far as i understood, i need to do this : List<String>[] lists = new List<String>[]{list0, list1, list2, list3}; but then i get the error : Cannot create a generic array of List<String>
comment on: http://stackoverflow.com/a/26040419
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26150862
answers question: http://stackoverflow.com/q/26150710
has body: obj.height does not exist it is not defined as a field in the class
type: Answer
score: 0

http://stackoverflow.com/comment/41011386
has text: Yes , I meant how many instances of Object class will be present or created.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26159365
type: Comment

http://stackoverflow.com/comment/41036493
score: 0
type: Comment
has text: Thanks. That should work. Yes, I don't realistically see us changing our JPA implementation.
comment on: http://stackoverflow.com/a/26119051
type: AnswerComment

http://stackoverflow.com/q/26052075
has title: Java implementation-How to improve the speed of hash table
answer count: 1
tagged with: key
type: UnansweredQuestion
tagged with: hashtable
has body: I am implementing a hash table (as per requirements). It works ok with a small input but unfortunately it's way too slow when dealing with a large number of input. I tried BufferedInputStream but it doesn't make any differences. Basically I implemented it following the logic below. Any ideas how I can improve the speed? Is there a specific function that causes the bad performance? Or we might need to close the Scanner? int [] table = new int [30000];// creat an array as the table Scanner scan = new Scanner (System.in); //use scanner to read the input file. while (scan.hasNextLine()) { //read one line at a time, and a sequence of int into an array list called keys // functions used here is string.split(" "); } hashFuction{ //use middle-squaring on each elements to the array list keys. // Math.pow() and % 30000, which is the table size, to generate the hash value // assign table [hashvalue]= value }
has comment: http://stackoverflow.com/comment/40813647
type: Question
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/40813283
has comment: http://stackoverflow.com/comment/40813753
score: 0
has answer: http://stackoverflow.com/a/26052366

http://stackoverflow.com/comment/40947757
comment on: http://stackoverflow.com/a/26125812
has text: thank you so much for your input. You and rgettman have made it clear to me and I really appreciate that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40908838
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26104015
score: 0
has text: @Joiner can you post an [MCVE](http://stackoverflow.com/help/mcve) please? I mean a Complete program that we can copy-paste, compile and see the same error as you so we can help you in a better way.

http://stackoverflow.com/comment/41017914
score: 0
type: Comment
type: QuestionComment
has text: I had opened it up with other file editors and pasted it to word as well. Still a blank line! I am using windows and my laptop shut off suddenly which might have corrupted it?
comment on: http://stackoverflow.com/q/26163693

http://stackoverflow.com/q/26184281
has comment: http://stackoverflow.com/comment/41056727
favorite count: 0
has comment: http://stackoverflow.com/comment/41056952
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/41056803
has comment: http://stackoverflow.com/comment/41056165
has comment: http://stackoverflow.com/comment/41056959
tagged with: java
has comment: http://stackoverflow.com/comment/41057432
tagged with: mysql
has comment: http://stackoverflow.com/comment/41056339
downvote count: 1
has comment: http://stackoverflow.com/comment/41056278
type: Question
answer count: 2
upvote count: 0
tagged with: backslash
score: -1
has title: Java Mysql Escape Backslashes for Select
has comment: http://stackoverflow.com/comment/41057154
has body: There are a lot of questions already regarding escaping backslashes in java. Depending on what i use i can replace either the char sequence or by regex. however this works fine for escaping one or two backslashes. in my case i need to replace each occurence of one \ with 4 . EDIT: on the below i left out the second slash intentionally to make clear to get from 1 to 4. String s = "X:\Test\test\test"; //to String s = "X:\\\\Test\\\\test\\\\test"; so one would think of: s.replace("\\","\\\\\\\\"); or by regex: s.replaceAll("\\\\","\\\\\\\\\\\\\\\\"); but whatever i do, the resulting String always contains a maximum of 2 decending backslashes \. I do not get 4 \\ or even more. Seems like replace function always repeat until only 2 backslashes are left. Do i really need to concatenate to a new String in order to get 4 backslashes? No way to solve this by replace? alternatively is there an escape possibility to search for filepaths in mysql? my db stores "X:\test\test", to be able to find it i must escape with 4 backslashes: select * from f where filepath like 'X:\\\\test%' anyone ideas? EDIT: My eclipse did somehow break it, after i restarted it, it prints 4 backslashes as it should. Sorry for the inconveniences.
has answer: http://stackoverflow.com/a/26184898
has comment: http://stackoverflow.com/comment/41056225
has answer: http://stackoverflow.com/a/26184777

http://stackoverflow.com/comment/41013090
has text: but how can do that? can you tell me with java code? please... really confuse
comment on: http://stackoverflow.com/a/26155914
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40863083
has text: What is your POM hierarchy? Based on this - http://stackoverflow.com/questions/3695394/inheriting-maven-profiles - it should work.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26079112

http://stackoverflow.com/a/26097576
upvote count: 4
downvote count: 0
has body: You use Comparator.comparing(Function&lt;? super T,? extends U&gt; keyExtractor). As follows: private boolean validateStates(List&lt;ConcessionState&gt; concessionStateList) { long startRange,endRange = 0; Collections.sort(concessionStateList, Comparator.comparing(ConcessionState::getRangeStart)); ....... } If you want it in descending order, you do Comparator.comparing(ConcessionState::getRangeStart) .reversed()
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/26097538
answers question: http://stackoverflow.com/q/26097538
type: Answer

http://stackoverflow.com/q/26044707
has body: My java code to run the report DBConnector class public class DBConnector { private static final String url = "jdbc:postgresql://localhost:5432/DB"; private static final String user = "postgres"; private static final String password = "123"; private Connection connection; private static DBConnector dBConnector = null; public DBConnector() throws SQLException, ClassNotFoundException { connection = null; Class.forName("org.postgresql.Driver"); connection = DriverManager.getConnection(url, user, password); if (connection == null) { System.out.println("Failed to make connection!"); } } private static DBConnector getDBConnector() throws SQLException, ClassNotFoundException { if (dBConnector == null) { dBConnector = new DBConnector(); } return dBConnector; } public static Connection getConnectionToDB() throws SQLException, ClassNotFoundException { return getDBConnector().connection; } Master report parameters in Master report, this hotelid and custid are the parameters i want to sent to subreport Both parameters are integers parameter properties subreport properties in Master report 2 properties defined Sub report parameters in sub report hotelid properties Query in my subreport select firstname,lastname from customers where custid=$P{custid} and hotelid=$P{hotelid} i get a NullPointerException when running the master report. i can't find why its coming. when i preview the report report is generating perfectly. can some one please help me??? Here's the error i get Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:185) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) at j…
upvote count: 1
type: Question
tagged with: jasper-reports
has title: java.lang.NullPointerException comes when running Master ireport when theres a sub report inside Master report
has comment: http://stackoverflow.com/comment/40818233
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40965813
tagged with: subreport
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40880369

http://stackoverflow.com/comment/40907162
score: 0
type: AnswerComment
has text: Thanks for the reply and code example! Question about JNDI vs Spring Datasource, is there any trade offs or draw backs to using JNDI over Non JNDI?
comment on: http://stackoverflow.com/a/26097445
type: Comment

http://stackoverflow.com/a/26165134
has body: I ran your test case and it runs with no problem. What is the exact error message that you are seeing? A few notes: Your test class extends TestCase, but there's no need for that in JUnit 4. Just add annotations to your test methods In your test() method, you call setup(), but because you added @Before to setup(), JUnit calls it before calling each method that has @Test
answers question: http://stackoverflow.com/q/26123399
type: Answer
has comment: http://stackoverflow.com/comment/41022377
has comment: http://stackoverflow.com/comment/41022274
score: 0

http://stackoverflow.com/comment/43488616
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27446066
has text: Thanks @robert-vojta! That worked for me as well. For those of you who have the same problem, you can do the replacement on my answer. I don't want to take credit for his solution!
type: AnswerComment

http://stackoverflow.com/comment/40855236
type: QuestionComment
comment on: http://stackoverflow.com/q/26075247
has text: You have all the info you need in https://developer.android.com/training/basics/actionbar/adding-buttons.html
score: 0
type: Comment

http://stackoverflow.com/q/26067125
has body: I'm using a renderer to make a JTable in Java NetBeans with multiple rows in a cell (Line Wrapping). What I need to do, is that the user be able do some format to the cell, like Tab's and Enter's in the Text, when you use a Text Area without render, it does it like the way I want, it doesn't move between other controllers with this key events, the problem is when it gets rendered, if you press Enter, its like an accept event, and tab moves between controls. I think that there's still some properties that should be configured at the renderer for the text area component. Here's the code I'm using for the rendering: public class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer{ @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { this.setText((String)value); this.setWrapStyleWord(true); this.setLineWrap(true); this.setRows(10); //set the JTextArea to the width of the table column setSize(table.getColumnModel().getColumn(column).getWidth(),getPreferredSize().height); if (table.getRowHeight(row) != getPreferredSize().height) { //set the height of the table row to the calculated height of the JTextArea table.setRowHeight(row, getPreferredSize().height); } return this; } } And here's how I use it: table1.getColumnModel().getColumn(0).setCellRenderer( new FAgregarArticulos.TableCellLongTextRenderer ());
linked to: http://stackoverflow.com/q/3590897
has comment: http://stackoverflow.com/comment/40842282
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
has title: Changing enter and tab key events from a TextArea rendered in a Table at Java Netbeans
linked to: http://stackoverflow.com/q/18164323
has comment: http://stackoverflow.com/comment/40842807
score: 0

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/26097168
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/26052990
tags question: http://stackoverflow.com/q/26110016
tags question: http://stackoverflow.com/q/26162763
tags question: http://stackoverflow.com/q/26085720
tags question: http://stackoverflow.com/q/26116765
tags question: http://stackoverflow.com/q/26102247

http://stackoverflow.com/q/26163228
favorite count: 0
accepted answer: http://stackoverflow.com/a/26164585
tagged with: cells
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: swing
tagged with: tablecellrenderer
has body: I want to create a JTable and color its cells permanently by the click of a button (pretty like excel in coloring cells).So far, every cell I select, it gets in an ArrayList&lt;Cell&gt;. First of all, I want for every cell in the list to be colored permanently when I click the button (this is the difference from code I found). Shoud I have to use a statememnt like this table.getColumnModel().getColumn(column).setCellRenderer(this); ? It is a compilable code and if you debug it, you will see that when the button is clicked, I cannot access getTableCellRendererComponent() method. Why is that happening? I would appreciate if you could tell me your opinions. (Note: it's a reproduce of a huge program, so it's a little big messy and hard-coded in some places. Couldn't make it smaller for what I want to solve). Class ColorSelectedTableCells.java public class ColorSelectedTableCells extends JPanel { private JButton btn = new JButton("color cells"); private MyCellRenderer myCellRenderer = new MyCellRenderer(); public static final Object[][] DATA = new Object[3][3]; public static final String[] COLS = {"A", "B", "C"}; private static final int PREF_WIDTH = 400; private static final int PREF_HEIGHT = 300; private static CellSelectionSet cellSelectionSet = new CellSelectionSet(); private JTable table = new JTable(DATA,COLS){ @Override public boolean isCellEditable(int row, int column) {return false;} @Override public boolean isCellSelected(int row, int column) { if (cellSelectionSet.containsOneOrLess()) { return super.isCellSelected(row, column); } return cellSelectionSet.contains(row, column); } @Override public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { super.changeSelection(rowIndex, columnIndex, toggle, extend); if (toggle) { cellSelectionSet.add(rowIndex, columnIndex); } else { if (extend) { cellSelectionSet.add(rowIndex, columnIndex); } else { cellSelectionSet.clear(); cellSelectionSet.add(rowIndex, columnIndex); } } } }; public C…
type: Question
has answer: http://stackoverflow.com/a/26164585
tagged with: jtable
score: 2
has title: JTable color cells permanently when I click button
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26189296
has body: The java code is below,It's about to connect to the server and get some information, you can run the java code and get {"carrier":{"CFeeC":1,"COrderC":1,"CTaskC":1,"flag":1},"driver":{"DTaskC":1,"DTraceR":1,"flag":1},"userinfo":{"czBizOrgId":"30500002049","czWebOrgId":545587,"hzBizOrgId":"30500000857","hzWebOrgId":545593,"userEmail":"all@1.com","userId":545566,"userName":"all all all"},"return_code":"00","customer":{"flag":1,"hFeeC":1,"hOrderA":1,"hOrderC":1,"hOrderS":1,"hPlanM":1,"hPlanS":1}}null but when i run iOS code blew the java code,answer is {"exception":"Authenticated access required"} it seems that tha parameter that i send ,the server didn't get?why? public static void main(String[] args) { System.out.println(test()); } private static String test() { String username = "all@1.com"; String password = "1"; String path = new String("http://61.174.31.28:9091/api/jsonws/UnicomWL-portlet.tcdcolligate/user-login/password/1/email/all%401.com"); // ƴ�����URL��ַ //path = path.replace("+","%20"); try { String authString =username + ":" +password; String authStringEnc = new String(Base64.encode(authString.getBytes())); URL url = new URL(path); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Authorization", "Basic " + authStringEnc); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( connection.getOutputStream()); bufferedOutputStream.flush(); bufferedOutputStream.close(); if (connection.getResponseCode() != 200) { throw new RuntimeException("ResponseCode != 200"); } BufferedInputStream bufferedInputStream = new BufferedInputStream( connection.getInputStream()); int bytesRead = 0; byte[] buffer = new byte[1024]; while ((bytesRead = bufferedInputStream.read(buffer)) != -1) { String chunk = new String(buffer, 0, bytesRead); System.out.print(chunk); } connection.disconnect(); } catch (Exception e) { } return null; but when i tried u…
has answer: http://stackoverflow.com/a/26189436
type: AnsweredQuestion
score: 0
tagged with: java
has title: What's wrong when i transfer the java code to iOS code about connecting to the server and get result?
tagged with: request
type: Question
tagged with: ios
accepted answer: http://stackoverflow.com/a/26189436
tagged with: post
answer count: 1
tagged with: nsmutableurlrequest

http://stackoverflow.com/a/26091251
has body: What that quote is trying to say is that the size of an array is part of the object, ie. it is not part of the reference or the variable type. In i = c; you are assigning a copy of the value of the reference held in c to i. That is, i will reference the same instance as c. Is size of array of interface new I[2]; getting modified during assignment i=c;? No, that's the whole point. i and c are just variables. Variable assignment has no side effects.
has comment: http://stackoverflow.com/comment/40885378
has comment: http://stackoverflow.com/comment/40885353
has comment: http://stackoverflow.com/comment/40885450
has comment: http://stackoverflow.com/comment/40920687
score: 4
has comment: http://stackoverflow.com/comment/40885265
upvote count: 4
has comment: http://stackoverflow.com/comment/40885203
has comment: http://stackoverflow.com/comment/40885241
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40885405
has comment: http://stackoverflow.com/comment/40920553
accepted answer of: http://stackoverflow.com/q/26091233
answers question: http://stackoverflow.com/q/26091233
type: Answer

http://stackoverflow.com/a/26085751
downvote count: 0
type: Answer
has body: Use String.split(delimiter) which will return you an array containing all String delimited by the specified delimiter. See the doc about String for more informations: Note that the first and last splitted String will contains text that you don't want so you may want to remove the part which is not formatted as VALUE,VALUE,VALUE before using the split method. If you really want to use regex, you can do it this way (once again after removing the extra data): String regex = "[\\n|^|,]*(.*?)[,|$|\\n]"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher("RECEIVERID,RECEIVERSITE,SENDERID,EMAIL_TO\n" + "1000003884,PEPSICO LTD.,1005,ZZZ@company.com\n" + "1000003884,PEPSICO LTD.,1010,ABC@company.com"); while (matcher.find()) System.out.println(matcher.group(1));
upvote count: 1
has comment: http://stackoverflow.com/comment/40875566
score: 1
answers question: http://stackoverflow.com/q/26085720

http://stackoverflow.com/q/26139522
has body: I try to create a template object of task using existing task object. When i use a special constructor I get the error: incompatible types: Task cannot be converted to TaskTemplate Here is the code I'm using the create the TaskTemplate: TaskTemplate bean = new TaskTemplate(newTask); Here is the constructor I'm calling: public TaskTemplate(Task task) { this.setTitle(task.getTitle()); this.setDate(task.getDate()); } But when I set all properties in the place where object is created everything is ok. TaskTemplate bean = new TaskTemplate(); bean.setTitle(newTask.getTitle()); bean.setDate(newTask.getDate()); Why does it happen? How can I create a constructor which will get a task and create a template?
has comment: http://stackoverflow.com/comment/40972595
type: UnansweredQuestion
tagged with: java
has title: Create a constructor which use another class
type: Question
has comment: http://stackoverflow.com/comment/40972300
has comment: http://stackoverflow.com/comment/40972746
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26151902
has comment: http://stackoverflow.com/comment/40973803

http://stackoverflow.com/q/26065368
has answer: http://stackoverflow.com/a/26105244
has comment: http://stackoverflow.com/comment/40837737
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40837800
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/40837745
type: Question
linked to: http://stackoverflow.com/q/7229226
accepted answer: http://stackoverflow.com/a/26105244
has answer: http://stackoverflow.com/a/26066033
has body: I have got this piece of code: frame.setTitle("SideScroller"); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); Dimension dim = new Dimension(1000, 500); frame.setContentPane(gamePanel); //gamePanel is an extended JPanel gamePanel.setPreferredSize(dim); frame.pack(); After I run this code and fill the gamePanel with parts of 50x50p, which should fill the gamePanel and thus the frame completely, there are some empty rows of pixels at the right and bottom of the screen. frame.getSize(); //gives us: 1016 x 539 frame.getInsets(); //gives: Top: 31 | Left: 8 | Bottom: 8 | Right: 8 An image of the result: As you can see, there is still some empty room in the JFrame. The code to fill the gamePanel: //Fill the panel with landscape //One part : 50x50 px //Panel : 1000x500 px //Width : 20 prts //Height : 10 prts @Override public void paint(Graphics g){ super.paint(g); for(int i = 0; i &lt; 20; i++){ for(int j = 0; j &lt; 10; j++){ //Decide which landscape-img should be used switch(levelOne[j][i]){ case 0:g.drawImage(new ImageIcon("resources\\landscape-img\\air.png") .getImage(), 50 * i, 50 * j, null); break; case 1:g.drawImage(new ImageIcon("resources\\landscape-img\\ground.png") .getImage(), 50 * i, 50 * j, null); break; } } } g.dispose(); } I do not see why the frame isn't filled fully. Hope someone can help me!
has comment: http://stackoverflow.com/comment/40838054
has comment: http://stackoverflow.com/comment/40837706
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40837965
possible better answer: http://stackoverflow.com/a/26066033
linked to: http://stackoverflow.com/q/14595897
has comment: http://stackoverflow.com/comment/40837679
linked to: http://stackoverflow.com/q/10336899
has comment: http://stackoverflow.com/comment/40846776
has title: Size of JFrame odd after pack()
tagged with: jframe
has comment: http://stackoverflow.com/comment/40837940

http://stackoverflow.com/a/26060067
type: Answer
has body: if (currentString.toLowerCase().startsWith(searchString )) { your code } android provides methods with strings like toLowerCase(),toUpperCase() etc
answers question: http://stackoverflow.com/q/26059493
score: 0

http://stackoverflow.com/a/26087474
has comment: http://stackoverflow.com/comment/40886185
upvote count: 9
has comment: http://stackoverflow.com/comment/95320912
answers question: http://stackoverflow.com/q/26086742
score: 9
type: AcceptedAnswer
downvote count: 0
has body: You can use GridData#heightHint and GridData#minimumHeight to set your heights. But keep in mind, that enforcing a certain size might not work well on all screen resolutions, because the required size may exceed the available screen size. However, here is a simple example that should help you: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, false)); Group first = new Group(shell, SWT.NONE); first.setText("Group 1"); first.setLayout(new GridLayout(1, false)); GridData firstData = new GridData(SWT.FILL, SWT.FILL, true, false); firstData.heightHint = 400; first.setLayoutData(firstData); ScrolledComposite firstScroll = new ScrolledComposite(first, SWT.V_SCROLL); firstScroll.setLayout(new GridLayout(1, false)); firstScroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite firstContent = new Composite(firstScroll, SWT.NONE); firstContent.setLayout(new GridLayout(1, false)); firstContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); for (int i = 0; i &lt; 20; i++) { Text text = new Text(firstContent, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); } firstScroll.setContent(firstContent); firstScroll.setExpandHorizontal(true); firstScroll.setExpandVertical(true); firstScroll.setMinSize(firstContent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Group second = new Group(shell, SWT.NONE); second.setText("Group 2"); second.setLayout(new GridLayout(1, false)); GridData secondData = new GridData(SWT.FILL, SWT.FILL, true, true); secondData.minimumHeight = 100; second.setLayoutData(secondData); Text text = new Text(second, SWT.BORDER | SWT.MULTI); text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); shell.pack(); shell.setSize(400, shell.getSize().y); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } Looks like this:
type: Answer
accepted answer of: http://stackoverflow.com/q/26086742

http://stackoverflow.com/comment/40818221
score: 0
type: Comment
has text: I need to read certain data from a log file, this I think cant be done with the URI class.
type: QuestionComment
comment on: http://stackoverflow.com/q/26054876

http://stackoverflow.com/a/26120022
has comment: http://stackoverflow.com/comment/40938561
has comment: http://stackoverflow.com/comment/40939381
upvote count: 7
downvote count: 0
has body: The generated parse tree visitor extends AbstractParseTreeVisitor, which has two methods which would be helpful to override to get the result you are looking for. Firstly, AbstractParseTreeVisitor#defaultResult() returns the default result for every node in the parse tree you visit. By default, it returns null. Second, AbstractParseTreeVisitor#aggregateResult(T,T) aggregates the last node's visited result with the total result so far. You have not overridden either of these methods, so aggregateResult(T,T) is returning the default result of the last parse tree node visited, which is giving you a null result. So, if you want to fix this, I would override defaultResult to look something like this: @Override public String aggregateResult(String aggregate, String nextResult) { if (aggregate == null) { return nextResult; } if (nextResult == null) { return aggregrate; } StringBuilder sb = new StringBuilder(aggregate); sb.append(" "); sb.append(nextResult); return sb.toString(); } If you don't want to do the null checks in your aggregateResult override, you could override defaultResult to return the empty String and then have aggregateResult append every result to the aggregate, but I personally prefer the first solution.
has comment: http://stackoverflow.com/comment/112162626
type: Answer
has comment: http://stackoverflow.com/comment/40936439
has comment: http://stackoverflow.com/comment/40939235
answers question: http://stackoverflow.com/q/26116826
has comment: http://stackoverflow.com/comment/40936505
has comment: http://stackoverflow.com/comment/40937607
score: 7

http://stackoverflow.com/comment/40864960
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26079844
type: AnswerComment
has text: @Jack - It works with the "obvious" fix that you have made ... but it still isn't incremental. And unless the solution is incremental then it is better to copy the original HashMap's entry set to an array and sort it.

http://stackoverflow.com/q/26168254
type: Question
has body: How could I configure from Java (or Scala) code amount of executors having SparkConfig and SparkContext? I see constantly 2 executors. Looks like spark.default.parallelism does not work and is about something different. I just need to set amount of executors to be equal to cluster size but there are always only 2 of them. I know my cluster size. I run on YARN if this matters.
has title: How to set amount of Spark executors?
has answer: http://stackoverflow.com/a/58194146
tagged with: apache-spark
has answer: http://stackoverflow.com/a/38479360
possible better answer: http://stackoverflow.com/a/56720485
has answer: http://stackoverflow.com/a/26168520
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/56720485
tagged with: scala
tagged with: hadoop-yarn
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26168520
score: 48
upvote count: 49
tagged with: cluster-computing
downvote count: 1

http://stackoverflow.com/q/26141003
type: Question
has title: Error while importing class in JSP
tagged with: jsp
score: 0
has body: I am getting the error on importing a class located in a subpackage in JSP. Effective code of index.jsp: &lt;%@ page import="a.b.TestDetails" contentType="text/html" pageEncoding="UTF-8" errorPage="Error/error-page.jsp"%&gt; Error i am recieving: HTTP Status 404 - Not Found type Status report messageNot Found descriptionThe requested resource is not available. GlassFish Server Open Source Edition 4.0 When i remove the import page loads correctly but when i use it to import class, it gives me above error.
answer count: 1
has comment: http://stackoverflow.com/comment/40975124
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40980237
has answer: http://stackoverflow.com/a/26143913
tagged with: java
has comment: http://stackoverflow.com/comment/40975189
tagged with: error-handling
tagged with: import

http://stackoverflow.com/comment/40878063
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26086934
has text: @jboxxpradhana That's quite weird. Does `merge()` work?
type: AnswerComment

http://stackoverflow.com/q/26140993
tagged with: classnotfoundexception
possible better answer: http://stackoverflow.com/a/26142055
has body: I am using spring-integration in my project. When I deploy my app in the jetty container, I am getting the following exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'integrationRequestMappingHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundhttpJobRequestGateway': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/converter/json/MappingJackson2HttpMessageConverter at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at com.dsths.spring.web.DsthsContextLoaderListener.configureAndRefreshWebApplicationContext(DsthsCo…
favorite count: 0
tagged with: spring
upvote count: 4
answer count: 4
type: AnsweredQuestion
has title: java.lang.ClassNotFoundException: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
tagged with: spring-integration
downvote count: 0
has answer: http://stackoverflow.com/a/75469725
tagged with: java
has answer: http://stackoverflow.com/a/26142055
has answer: http://stackoverflow.com/a/28750973
has answer: http://stackoverflow.com/a/26141103
type: Question
accepted answer: http://stackoverflow.com/a/26141103
tagged with: jackson
score: 4

http://stackoverflow.com/comment/40813957
has text: 1)If you google "how to keep track of objects in java" you will see plenty of discussions on this issue. 2) Yes you can use `List <Car>` inside of the class `Car` there is no problem with that. You should have probably rephrased your question as : hey this is how I did it and it works, how else can this be done and what are cons and pros of your method. That would be a better question.
comment on: http://stackoverflow.com/a/26051549
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26119794
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/40972513
possible better answer: http://stackoverflow.com/a/26139279
upvote count: 6
has answer: http://stackoverflow.com/a/26139279
accepted answer: http://stackoverflow.com/a/26123591
score: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40968429
has comment: http://stackoverflow.com/comment/40947819
has comment: http://stackoverflow.com/comment/40971857
tagged with: java
has title: Apache PDFBox rotate PDImageXObject
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/40965016
has body: I'm playing around with the 2.0.0-SNAPSHOT, and I want to set the page to landscape and also rotate my picture. So I've done page.setRotation(90); There seems to be a bug with using PDFBox and AffineTransform This code doesn't do anything like I'd expect: AffineTransform at = new AffineTransform(w, 0, 0, h, 20, 20); at.translate(0.5, 1); at.rotate(Math.toRadians(90)); Width and Height have to be tiny to keep the image on the page, rotate by itself squishes the image, and translate before rotate seems to scale the image huge. Is this a bug, or am I just not understanding PDFBox?
type: Question
answer count: 2
tagged with: transformation
has answer: http://stackoverflow.com/a/26123591
has comment: http://stackoverflow.com/comment/40971519
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40970964
tagged with: matrix

http://stackoverflow.com/q/26159275
upvote count: 2
tagged with: playframework
favorite count: 0
tagged with: scala
has body: For reasons stemming from this question I need to write a custom action composition in scala that can be then used in java controller, something like this: LogAction.scala (Scala Custom Action Composition): import play.api.mvc._ class LogAction extends ActionBuilder[Request] { def invokeBlock[A](request: Request[A], block: (Request[A]) =&gt; Future[Result]) = { Logger.info("Calling action") block(request) } } Application.java (Java Controller): import LogAction; import play.mvc.Controller; import play.mvc.Result; import play.mvc.With; public class Application extends Controller { @With(LogAction.class) public static Result index() { return ok(views.html.admin.main.render()); } } Is something like this possible? If yes then how? The final goal is to log request and response bodies using this particular action composition.
type: UnansweredQuestion
tagged with: playframework-2.0
score: 2
has title: Play Framework 2.3: using scala action composition in java controller
answer count: 0
downvote count: 0
tagged with: playframework-2.3
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/26157715

http://stackoverflow.com/q/26137639
linked to: http://stackoverflow.com/q/1099300
accepted answer: http://stackoverflow.com/a/26137827
has body: For example, I've got some place in my code, that receives many files (many of them are identical) from disk and, further, unmarshalls them. final File configurationFile = getConfigurationFile(); FileOutputStream fileOutputStream = new FileOutputStream(configurationFile); Marshaller.marshal(configObject, fileOutputStream); Obviously, I can create a special cache map for them to increase performance (in order not to unmarshall identical files again and again). For my case, HashMap implementation will be enough. The question is: what key for that should I use? configurationFile.hashCode() is very bad for this? Thanks for all your answers!
has answer: http://stackoverflow.com/a/26137696
tagged with: caching
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40968922
possible better answer: http://stackoverflow.com/a/26137696
has answer: http://stackoverflow.com/a/26137722
type: Question
has title: How can I create cache map in this situation?
has answer: http://stackoverflow.com/a/26137827
has comment: http://stackoverflow.com/comment/40968849
score: 0
tagged with: java
answer count: 3

http://stackoverflow.com/comment/40829503
type: Comment
type: QuestionComment
has text: I am also looking for the same. You may add "total" in case of pagination
comment on: http://stackoverflow.com/q/26060473
score: 0

http://stackoverflow.com/comment/40914377
type: Comment
has text: does the delete() and reading from the array "get()" happen at same time ? say on different threads for example ?
comment on: http://stackoverflow.com/q/26107340
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40977102
type: Comment
comment on: http://stackoverflow.com/a/26141103
score: 0
has text: Actually they should be placed in the `WEB-INF/lib`, because you say that you use custom classloader.
type: AnswerComment

http://stackoverflow.com/q/26067096
score: 71
tagged with: mockito
tagged with: matcher
tagged with: junit
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26075910
has title: How to write a matcher that is not equal to something
possible better answer: http://stackoverflow.com/a/26067411
has answer: http://stackoverflow.com/a/26142918
has comment: http://stackoverflow.com/comment/84333332
has answer: http://stackoverflow.com/a/26067411
answer count: 4
type: AnsweredQuestion
has body: I am trying to create a mock for a call. Say I have this method I am trying to stub out: class ClassA { public String getString(String a) { return a + "hey"; } } What I am trying to mock out is: 1st instance is when(classA.getString(eq("a")).thenReturn(...);` in the same test case when(classA.getString([anything that is not a])).thenReturn(somethingelse); The 2nd case is my question: How do I match anyString() other than "a"?
upvote count: 71
tagged with: java
has answer: http://stackoverflow.com/a/51244393
accepted answer: http://stackoverflow.com/a/26075910
type: Question

http://stackoverflow.com/comment/41127943
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26187341
has text: this does not make sense. 'default' cookie policy was introduced in version 4.4

http://stackoverflow.com/a/26071843
answers question: http://stackoverflow.com/q/26071574
accepted answer of: http://stackoverflow.com/q/26071574
score: 1
upvote count: 1
downvote count: 0
type: AcceptedAnswer
has body: I'd recommend not using SAX, here's an example using XPath instead. You can write to a file using java.util.FileWriter. public class Test { public static void main(String[] args) throws Exception { BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt")); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse("test.xml"); XPathFactory xPathFactory = XPathFactory.newInstance(); writer.append(xPathFactory.newXPath().compile("//note/to").evaluate(document)); writer.newLine(); writer.append(xPathFactory.newXPath().compile("//note/from").evaluate(document)); writer.newLine(); writer.append(xPathFactory.newXPath().compile("//note/head").evaluate(document)); writer.newLine(); writer.append(xPathFactory.newXPath().compile("//note/body").evaluate(document)); writer.newLine(); writer.close(); } } If you really must use SAX, here's a cleaner way of doing it public class ReadXml { public static void main(String[] args) throws Exception { new ReadXml().read(); } public void read() throws Exception { SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); File folder = new File("."); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles) { if (file.isFile() &amp;&amp; file.getName().endsWith(".xml")) { Handler handler = new Handler(); saxParser.parse(file, handler); save(handler, file.getName() + ".txt"); } } } private void save(Handler handler, String filename) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); writer.append(handler.getFrom()); writer.newLine(); writer.append(handler.getTo()); writer.newLine(); writer.append(handler.getHead()); writer.newLine(); writer.append(handler.getBody()); writer.newLine(); writer.close(); } private class Handler extends DefaultHandler { private StringBuilder content; private String to; private String from; private String body; private String head; @Ov…
type: Answer

http://stackoverflow.com/comment/40997191
comment on: http://stackoverflow.com/q/26152547
type: Comment
has text: You use `View#addView()` method. It'll put it on the top left corner. If you want to move it around you have to use Margins and/or Gravity.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41062910
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26186497
has text: @T145 adding info to map uses put function. is there any reason that you don't want to use map?

http://stackoverflow.com/comment/40913513
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26106829
has text: You can't merge sort this way. You should do a frequency count, merge the frequency counts, and then obtain the words in order of count. Say you have to merge "a c" and "b c" you might come up with "a b c" but say the total of a'a are 10, the total of b's is 9 and the total of c's is 5+6=11, this means that the total of c is high even though in each list it was lower. Merge sort assumes the order of an entry cannot change due to what you merge it with.

http://stackoverflow.com/q/26120311
upvote count: 154
has comment: http://stackoverflow.com/comment/40947785
has comment: http://stackoverflow.com/comment/40956860
linked to: http://stackoverflow.com/q/15575669
has comment: http://stackoverflow.com/comment/40936901
downvote count: 0
has title: Why does adding 0.1 multiple times remain lossless?
has comment: http://stackoverflow.com/comment/40936916
has answer: http://stackoverflow.com/a/26149668
has comment: http://stackoverflow.com/comment/40963690
favorite count: 0
linked to: http://stackoverflow.com/q/18496560
has comment: http://stackoverflow.com/comment/40937132
has body: I know the 0.1 decimal number cannot be represented exactly with a finite binary number (explanation), so double n = 0.1 will lose some precision and will not be exactly 0.1. On the other hand 0.5 can be represented exactly because it is 0.5 = 1/2 = 0.1b. Having said that it is understandable that adding 0.1 three times will not give exactly 0.3 so the following code prints false: double sum = 0, d = 0.1; for (int i = 0; i &lt; 3; i++) sum += d; System.out.println(sum == 0.3); // Prints false, OK But then how is it that adding 0.1 five times will give exactly 0.5? The following code prints true: double sum = 0, d = 0.1; for (int i = 0; i &lt; 5; i++) sum += d; System.out.println(sum == 0.5); // Prints true, WHY? If 0.1 cannot be represented exactly, how is it that adding it 5 times gives exactly 0.5 which can be represented precisely?
answer count: 3
has answer: http://stackoverflow.com/a/26120458
tagged with: double
linked to: http://stackoverflow.com/q/9902968
has comment: http://stackoverflow.com/comment/41010486
has comment: http://stackoverflow.com/comment/41002962
accepted answer: http://stackoverflow.com/a/26120449
tagged with: precision
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26120458
has comment: http://stackoverflow.com/comment/40952166
tagged with: floating-point
has comment: http://stackoverflow.com/comment/40964079
type: Question
has comment: http://stackoverflow.com/comment/40937084
has comment: http://stackoverflow.com/comment/41003793
has comment: http://stackoverflow.com/comment/40936905
score: 154
has comment: http://stackoverflow.com/comment/41003631
tagged with: java
linked to: http://stackoverflow.com/q/21690585
has answer: http://stackoverflow.com/a/26120449

http://stackoverflow.com/a/26182426
has body: Use an IChangeListener to listen for changes on the model observable value. This will be called after the model has been updated from the target. Something like: IObservableValue targetOV = WidgetProperties.text(SWT.Modify).observe(text control); IObservableValue modelOV = PojoProperties.value("your field").observe(object); bindContext.bindValue(targetOV, modelOV); modelOV.addChangeListener(change listener);
has comment: http://stackoverflow.com/comment/41053016
score: 1
has comment: http://stackoverflow.com/comment/41054654
has comment: http://stackoverflow.com/comment/41052743
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26182202
answers question: http://stackoverflow.com/q/26182202
type: Answer
has comment: http://stackoverflow.com/comment/41053397
upvote count: 1

http://stackoverflow.com/comment/65610679
comment on: http://stackoverflow.com/a/26177962
score: 1
type: AnswerComment
has text: Has this changed? I'm on Weka 3.8 and I don't see any javadoc in that folder or any subfolder. Some classes seem to have docs by default but others like Weka.core.Instances methods don't.
type: Comment

http://stackoverflow.com/a/26055800
downvote count: 0
type: Answer
has body: If you create your application using Swing, so you can test it with FEST. But this lib is no longer supported and works wrong with Linux. There are some another non-free test tools for Swing and JavaFX but I've never used these tools and cannot say whether they good or not. You can found something about test tools for JavaFX here. For Swing here.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26055420
has comment: http://stackoverflow.com/comment/40819651

http://stackoverflow.com/q/26077641
answer count: 3
tagged with: replaceall
tagged with: string
favorite count: 0
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/26077942
has title: Replacing all special characters, numbers and alphabets
has answer: http://stackoverflow.com/a/26077746
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26077786
has body: This is the code for example String a="abcd ABCD 0123 !@#$%^&amp;*()"; This is syntax for replacing numbers &amp; alphabets with blank a = a.replaceAll("[a-zA-Z0-9]",""); This is syntax for replacing special characters with blank a = a.replaceAll("[^\\w\\s-_]",""); So how do I combine both of these syntax to replace special characters, numbers and alphabets with blank without using this method a = a.replaceAll(".",""); to replace entire string with blank? Is there any other way ??
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40859795
tagged with: replace

http://stackoverflow.com/q/26140978
type: Question
accepted answer: http://stackoverflow.com/a/26141853
upvote count: 1
answer count: 1
has body: In the documentation for Java's Runtime class it states: Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned. What does it mean by 'no inherent limit'? Won't there always be a max heap size?
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/40975239
has title: When will Java's Runtime.maxMemory() return Long.MAX_VALUE?
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26141853
score: 1
favorite count: 0

http://stackoverflow.com/a/26163920
score: 2
has body: Since you need to not modify the reference of the object you can wrap the Game in something else. The quickest (but ugly) fix is to use an array of size 1, then set the content of the array later. This works because the the array is effectively final, what is contained in the array doesn't have to be. @Override public Observable&lt;Game&gt; call(RxMessage&lt;byte[]&gt; gameRawReply) { Game[] game = new Game[1]; switch(game_model) { case SINGLE: { ebs.subscribe(new Action1&lt;RxMessage&lt;byte[]&gt;&gt;() { @Override public void call(RxMessage&lt;byte[]&gt; t1) { if(!singleGame.contains(0) { game[0] = new Game(); singleGames.put(0, game[0]); } else { game[0] = singleGames.get(0); } } }); } } return rx.Observable.from(game[0]); } Another similar option is to make a new class that has a Game field and you then set that field later.
downvote count: 0
answers question: http://stackoverflow.com/q/26163645
has comment: http://stackoverflow.com/comment/41018090
upvote count: 2
type: Answer

http://stackoverflow.com/a/26160871
has comment: http://stackoverflow.com/comment/41012128
upvote count: 3
has comment: http://stackoverflow.com/comment/41011996
has body: Your descending function returns one string, and always the same string (the last one in the order after sorting the collection). It doesn't matter how often you call it, if the data doesn't change, you'll always get back that same, last, string. If you want the first 10 after sorting, descending would need to return a List&lt;String&gt; containing those 10: public List&lt;String&gt; descending() { List&lt;String&gt; x = new ArrayList&lt;String&gt;(10); Collections.sort(oneName, new OneNameCountCompare()); for(OneName b: oneName) { x.add(b.toString()); if (x.size() == 10) // Or don't use enhanced for, use an index instead { break; } } return x; } Then when printing it, replace your for (int i = 0 ; i &lt; 10; i++) loop with: for (String s : descending()) { System.out.println(s); }
has comment: http://stackoverflow.com/comment/41012119
score: 3
accepted answer of: http://stackoverflow.com/q/26160725
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26160725

http://stackoverflow.com/comment/41013849
has text: Thanks. I can't find ReportTabManager in [TeamCity's Javadoc](http://javadoc.jetbrains.net/teamcity/openapi/current/jetbrains/buildServer/web/reportTabs/package-summary.html) though... What gives ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26139577

storage
tag name: storage
tags question: http://stackoverflow.com/q/26039111
tags question: http://stackoverflow.com/q/26142656
tags question: http://stackoverflow.com/q/26117511
type: Tag

http://stackoverflow.com/comment/40969384
type: Comment
comment on: http://stackoverflow.com/a/26135057
has text: can u please upload image of required layout?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26171858
tagged with: java
has answer: http://stackoverflow.com/a/26175308
type: Question
score: 0
tagged with: jakarta-mail
has body: I am looking for the open source API if there is any available which can convert javax.mail.Message object to XML specific format or some sample code if there is any already exist ? Please let me know if you know any. Thanks.
answer count: 1
tagged with: email
has title: Convert javax.mail.Message Email to XML format
type: UnansweredQuestion

http://stackoverflow.com/a/29340196
has body: It appears the shuffle sort is running out of memory. You could check your configuration to see how you have allocated memory. By using the java.opts, you can make sure the java heap of the reducer is not going to claim all memory, since it also needs memory for OS and core processes. As a rule of thumb, I leave 512MB for these. The out of memory on the shuffle sort can have something to do with the shuffle sort competing for memory. Lowering the percentage you allow the shuffle to use often solves the problem. Ofc, the best settings depend on your setup. mapreduce.reduce.memory.mb=4096 mapreduce.reduce.java.opts="-server -Xmx3584m -XX:NewRatio=8 -Djava.net.preferIPv4Stack=true" mapreduce.reduce.shuffle.input.buffer.percent=0.2
type: Answer
answers question: http://stackoverflow.com/q/26041723
score: 0

http://stackoverflow.com/q/26043255
upvote count: 1
answer count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40797973
has comment: http://stackoverflow.com/comment/40796976
has comment: http://stackoverflow.com/comment/40797112
has comment: http://stackoverflow.com/comment/40796770
accepted answer: http://stackoverflow.com/a/26043296
tagged with: dictionary
downvote count: 1
has title: How to update values in map in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26043296
tagged with: java
has body: I have map which has some keys and values and I would like to update values as listed below. This data is just for this testing example. Map&lt;String, Double&gt; map = new LinkedHashMap&lt;String, Double&gt;(); map.put("s",100.00); map.put("d",80.00); map.put("a",80.00); map.put("e",80.00); map.put("c", 50.00); map.put("w", 50.00); map.put("q", 20.00); After update and I print map it should give me this: [s=1, d=2, a=2, e=2, c=3, w=3, q=4] Pretty much I would compare values and increments them. I case they are equal it stays the same. Map is sorted by values. I have stored values in list and done this in list but can not think how to do it with maps. Thank you!
type: Question

http://stackoverflow.com/comment/84376624
has text: Did you try new Gson().fromJson(userinput, BarList.class);
comment on: http://stackoverflow.com/q/26193024
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41007502
type: QuestionComment
comment on: http://stackoverflow.com/q/26158441
has text: @EWit I return just 1. And a don't now why.
score: 0
type: Comment

http://stackoverflow.com/q/26070533
answer count: 1
accepted answer: http://stackoverflow.com/a/26070556
favorite count: 0
has comment: http://stackoverflow.com/comment/40847161
has comment: http://stackoverflow.com/comment/40847116
has comment: http://stackoverflow.com/comment/40847167
has title: Implementing Scanner to read text file to array
upvote count: 1
has comment: http://stackoverflow.com/comment/40847137
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40847155
type: Question
has answer: http://stackoverflow.com/a/26070556
score: 0
has body: For this program, what i have written so far is in the code below. I am stuck. Any hints/help would be greatly appreciated. Given the UML Class Diagram and the TestApp class, produce a working system that meets the following requirements: Implement a Department class with toString and equals overrides. Two department objects are equal if both the name and building numbers match. Create an abstract Employee class with toString and equals overrides. Two abstract employees are considered to be the same if they are in the same department. Implement a Consultant class that has an hourlySalary. Two consultants are equal if they have the same rate (in pennies). Implement a SalariedEmployee class. Salaried employees are equal if they are in the same department and have the same salary (in pennies). Follow the TODO instructions in the TestApp class to read the departments from the input txt file and test the system. Ouput should be: Executive 100 Research 112 Engineering 115 Production 120 Accounting 122 Executive 100(100) Steve Jobs $1000000.00 Research 112(200) Bill Joy $300000.00 Engineering 115(300) James Gosling $300000.00 Production 120(1100) Craig McClanahan $250.00 Accounting 122(400) Kevin Malone $51567.00 Research 112 import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class TestApp { public static void main(String[] args) { ArrayList&lt;Department&gt; depts = readDepartmentsFromFile("depts.txt"); displayDepartments(depts); ArrayList&lt;Employee&gt; company = new ArrayList&lt;&gt;(); populateEmployeeArray(company, depts); // TODO: Display everyone's pay w/o referring to the // subclasses (i.e., using Employee only) // TODO: Display all departments that are equal to this one: Department d1 = new Department("Research", 112); // TODO: Display all departments that are equal to this one: Department d2 = new Department("Accounting", 50); } private static void displayDepartments(ArrayList&lt;Department&gt…

http://stackoverflow.com/comment/40980883
type: QuestionComment
has text: What was you input text value?
score: 0
comment on: http://stackoverflow.com/q/26143959
type: Comment

http://stackoverflow.com/q/26153618
upvote count: 30
type: Question
has body: Coming from a C and C++ background, I have always assumed that dereferencing in Java is the process of accessing an object via its reference. For example, "ref" is a reference, and it is dereferenced when used to access the Integer object it refers to: Integer ref = new Integer(7); // Dereference "ref" to access the object it refers to. System.out.println(ref.toString()); And NullPointerExceptions occur when that dereferencing process fails: Integer ref = null; // Dereferencing "ref" causes an exception. System.out.println(ref.toString()); However, my interpretation conflicts with one of the topics being tested on Oracle's new Java SE 8 Programmer I exam (beta): Explain an Object's Lifecycle (creation, "dereference by reassignment" and garbage collection) So according to whoever created the Java 8 exam, dereferencing in Java is the act of reassigning a reference, rather than the act of evaluating a reference: For example: // Create an Integer object, and a reference to it. Integer ref = new Integer(7); ref = null; // Now (according to Oracle?): // - The reassignment means ref has been "dereferenced". // - The dereferenced object is now eligible for Garbage Collection. Googling the issue anecdotally suggests that Oracle's definition is more widely used, but that doesn't mean it is correct, and the only hit on google for "dereference by reassignment" is for that new Java 8 exam! The JLS doesn't really shed any light either way. Is there any formal or authoritative definition (as opposed to personal opinions) on what dereferencing really means in Java? (i.e. Does it relate to evaluation or reassignment?) It seems strange that two completely different definitions manage to coexist.
has answer: http://stackoverflow.com/a/36236082
has comment: http://stackoverflow.com/comment/40999028
has comment: http://stackoverflow.com/comment/40998864
favorite count: 0
score: 30
has answer: http://stackoverflow.com/a/26160720
has comment: http://stackoverflow.com/comment/40998863
has answer: http://stackoverflow.com/a/67656111
has answer: http://stackoverflow.com/a/67655723
accepted answer: http://stackoverflow.com/a/67656111
has comment: http://stackoverflow.com/comment/40998899
has comment: http://stackoverflow.com/comment/40998912
answer count: 4
possible better answer: http://stackoverflow.com/a/36236082
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Is there a formal or authoritative definition for "dereferencing" in Java?

http://stackoverflow.com/a/26111129
type: AcceptedAnswer
type: Answer
has body: I figured out the problem I was checking if it was at the correct lane incorrectly I needed to change if (pos.x - vec.x &lt; CLOSE_VEC) { To if (!(pos.x - vec.x &lt; 0) &amp;&amp; pos.x - vec.x &lt; CLOSE_VEC) { I need to make sure that the value isn't negative so the rectangle can move right.
accepted answer of: http://stackoverflow.com/q/26110619
answers question: http://stackoverflow.com/q/26110619
score: 0

http://stackoverflow.com/a/26083733
downvote count: 1
has comment: http://stackoverflow.com/comment/40891719
has comment: http://stackoverflow.com/comment/40871110
has comment: http://stackoverflow.com/comment/40871073
has comment: http://stackoverflow.com/comment/40871031
has comment: http://stackoverflow.com/comment/40872352
answers question: http://stackoverflow.com/q/26083694
has body: It has to be in classpath beside copying. You didn't mention anything about classpath. Pleasr check the same. Something like %CLASSPATH%:
has comment: http://stackoverflow.com/comment/40888866
has comment: http://stackoverflow.com/comment/40888840
type: Answer
has comment: http://stackoverflow.com/comment/40871260
score: 0
upvote count: 1

http://stackoverflow.com/a/26152932
downvote count: 0
answers question: http://stackoverflow.com/q/26152831
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40997681
has comment: http://stackoverflow.com/comment/40998131
has body: I don't understand why you would ask the user how many numbers they want to sum ahead of time. Basically, your code can be simplified and handle an arbitrary number of numbers. It's also a really bad idea to call close() on a Scanner wrapping System.in (Because you can't re-open it, and if you extract it into a method you will create a hard to debug and find issue). Anyway, you could do something like, Scanner scanner = new Scanner(System.in); // System.out.print("How many values do you want to parse?: "); // int numValues = scanner.nextInt(); System.out.println("Please enter values to sum (type quit to stop)"); int sum = 0; // &lt;-- start at 0. int count = 0; while (scanner.hasNext()) { if (scanner.hasNextInt()) { count++; sum += scanner.nextInt(); } else { String str = scanner.next(); if (str.equalsIgnoreCase("quit")) { break; // &lt;-- end the loop. } System.out.printf("The value '%s' is not an int (quit to stop).%n", str); } } System.out.printf("The sum of your %d values is %d.%n", count, sum); // scanner.close(); // &lt;-- Really Bad Idea Edit Based on your comment, Scanner scanner = new Scanner(System.in); System.out.println("Please enter values to sum (type quit to stop)"); while (scanner.hasNextLine()) { String str = scanner.nextLine(); str = (str != null) ? str.trim() : ""; if (str.equalsIgnoreCase("quit")) { break; // &lt;-- end the loop. } else if (str.length() == 0) { continue; } int sum = 0; // &lt;-- start at 0. int count = 0; Scanner scan2 = new Scanner(str); while (scan2.hasNextInt()) { count++; sum += scan2.nextInt(); } System.out.printf("The sum of your %d values is %d.%n", count, sum); }
has comment: http://stackoverflow.com/comment/40998355
accepted answer of: http://stackoverflow.com/q/26152831
has comment: http://stackoverflow.com/comment/40997876
has comment: http://stackoverflow.com/comment/40998087
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40997663

http://stackoverflow.com/comment/40884080
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26084955
has text: I appreciate your input @james large. This is an important point. I'm sure if the documentation does not specify having any java.io.PrintStream syncrhonized, certain implementations may not bother locking it. The specific code that prompted this question for me fortunately does not have anywhere near the consequences that you described but in the future double checking the documentation on the implementation you're using would be wise.

http://stackoverflow.com/comment/40803656
type: Comment
has text: @user1544101, you are welcome. I stucked before with this "new line" many times in many languages))
comment on: http://stackoverflow.com/a/26046771
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41066506
type: AnswerComment
has text: then maybe try adding a method to userDetailsForm that sets all the variables in that class to empty.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26172992

http://stackoverflow.com/comment/40980052
type: Comment
has text: This is a [very common](http://stackoverflow.com/questions/16689449/printing-even-and-odd-using-two-threads-in-java) exercise. See [here](http://stackoverflow.com/questions/18799591/print-natural-sequence-with-help-of-2-threads1-is-printing-even-and-2nd-is-pri). Another with [semaphores](http://stackoverflow.com/questions/22976412/how-to-make-sure-two-threads-printing-even-odd-numbers-maintain-even-first-then).
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26143604

http://stackoverflow.com/comment/40814307
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26052861
has text: You need to make sure that the directory containing the resources is within the projects class and build paths
score: 1

http://stackoverflow.com/q/26081547
has body: I need help in making the data read from within a file appear inside the JTable. And yes, I've already searched for answers before I asked and unfortunately, my problem still persists. Here is a sample code for you to see what's happening: import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; public class Inventory extends JFrame { public JLabel jLabel2 = new JLabel(); public JLabel jlabel3 = new JLabel(); public static int i = 0; public static void main(String[] args) { Inventory invent = new Inventory(); }//main public Inventory() { //super("Inventory"); getContentPane().setBackground(Color.WHITE); getContentPane().setLayout(null); setSize(400, 350); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(true); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); jLabel2.setFont(new Font("Tahoma", 0, 24)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 0, 153)); jLabel2.setText("Our Products:"); getContentPane().add(jLabel2); jLabel2.setBounds(120, 10, 240, 20); String[] inventoryHeading = {"Item ID", "Item Name", "Item Description", "Item Price", "Item Stock"}; String inventoryArr[][] = new String[100][5]; try { File items = new File("inventory.dat"); Scanner itemScanner = new Scanner(items); while(itemScanner.hasNext()) { String line = itemScanner.nextLine(); String[] inventoryFile = line.split("; "); String itemID = inventoryFile[0]; String itemName = inventoryFile[1]; String itemDescr = inventoryFile[2]; String itemPrice = inventoryFile[3]; String itemStock = inventoryFile[4]; for(int col = 0; col &gt; 5; col++) { inventoryArr[i][col] = itemID; col = col+1; inventoryArr[i][col] = itemName; col = col+1; inventoryArr[i][col] = itemDescr; col = col+1; inventoryArr[i][col] = itemPrice; col = col+1; inventoryArr[i][col] = itemStock; i++; }//for }//while }//try catch(FileNotFoundException e1) { JOptionPane.show…
has comment: http://stackoverflow.com/comment/40867362
type: AnsweredQuestion
has title: Data read from a file doesn't show up inside the JTable
has answer: http://stackoverflow.com/a/26081679
accepted answer: http://stackoverflow.com/a/26081668
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26081679
tagged with: java
tagged with: jtable
answer count: 2
has answer: http://stackoverflow.com/a/26081668
favorite count: 0
has comment: http://stackoverflow.com/comment/40867409
score: 0

http://stackoverflow.com/q/26098174
tagged with: data-persistence
accepted answer: http://stackoverflow.com/a/26098431
score: 0
type: AnsweredQuestion
has body: Basically what the title says. Currently if the orientation changes in my app the ball resets back to the top of the game, however I wish to change my code so that if the user changes orientation of the device the ball and racket stay in the same spot. How would I achieve this? Would I place my entire in these two methods? protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Log.v(TAG, "onSaveInstanceState"); } and protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); Log.v(TAG, "onRestoreInstanceState"); } (note I have already initialized the constants for TAG, within my code not seen here). (it's also an activity)
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26098431
has title: Best to way to implement data persistence when orientation changes in android?
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/40897536

http://stackoverflow.com/comment/41006118
type: AnswerComment
score: 0
has text: will usig xammp help?i want to connect mysql to netbeans for java programming
type: Comment
comment on: http://stackoverflow.com/a/26157500

http://stackoverflow.com/q/26062384
possible better answer: http://stackoverflow.com/a/26062455
downvote count: 1
has answer: http://stackoverflow.com/a/26062496
has comment: http://stackoverflow.com/comment/40831918
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3059333
has comment: http://stackoverflow.com/comment/41601173
tagged with: java
answer count: 2
tagged with: validation
accepted answer: http://stackoverflow.com/a/26062496
score: 1
has title: Validating a text against some rules
favorite count: 0
has comment: http://stackoverflow.com/comment/40831920
has answer: http://stackoverflow.com/a/26062455
has comment: http://stackoverflow.com/comment/40831940
has comment: http://stackoverflow.com/comment/40832115
upvote count: 2
has body: I have a text and I need to validate it against the following rules: The text must have a length of 8 characters The text must have a leading letter The text must have a trailing letter The text must have 6 numbers between the 2 letters A good example is:L123456X or l123456x I did it the following way: public boolean isValidated(String str) { boolean validated = false; char a = str.charAt(0); char z = str.charAt(str.length() - 1); int i; if (str.length() == 8 &amp;&amp; Character.isLetter(a) &amp;&amp; Character.isLetter(z)) { validated = true; for ( i = 1; i &lt; str.length() - 1; ++i ) { if(Character.isLetter(str.charAt(i))) { validated = false; break; } } } return validated; } Is there a simpler way?

http://stackoverflow.com/a/26131760
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26131280
has body: Spring's RestTemplate is what I was looking for: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html Here is a link where it is used used. Interesting part near the bottom: http://dyutiman.wordpress.com/2010/12/09/simple-rest-web-service-spring/
downvote count: 0

http://stackoverflow.com/a/26065821
has comment: http://stackoverflow.com/comment/40838873
has comment: http://stackoverflow.com/comment/40838688
type: Answer
has body: The Integer.parseInt throws NumberFormatException if it cannot convert a string into integer. In your case I would check the values of input that is s. JavaDoc for Integer.parseInt(String s) Examples Integer.parseInt(" 234"); ---&gt; Throws NumberFormatException as it has space Integer.parseInt(""); ---&gt; Throws NumberFormatException as it is not parseable for an integer Integer.parseInt(null); ---&gt; Throws NumberFormatException and not npe Integer.parseInt(" 234 ".trim()); ---&gt; Doesnt throw NumberFormatException as it trims before trying to parse it. I would try int t = Integer.parseInt(s.trim()); This would clear your NumberFormatException. As for the other part of your question it is a very poor effort. Please read the java doc for split string. stringint.split(""); what are you splitting the string with ??? You should be using the modulo operator. that is %. Usage 5%2 will return 1 that is the remainder if you do something like this in a loop public static int maxDigit(int num){ int maxDigit=0; while(num&gt;0) { if(maxDigit&lt;num%10){ maxDigit=num%10; } num/=10; } return maxDigit; } The maxDigit will have what you need. This is a looping approach try recursive your self show the effort I would be wiling to help you if i see the effort.
answers question: http://stackoverflow.com/q/26065805
has comment: http://stackoverflow.com/comment/40838730
has comment: http://stackoverflow.com/comment/40838837
score: 0

http://stackoverflow.com/a/32880533
answers question: http://stackoverflow.com/q/26055504
has body: Though the issue is already resolved, I faced similar issue, and none of the steps mentioned above and on other threads worked. I had to additionally specify the protocol as SMTPS for this to work. So here is my working code snippet. @Bean JavaMailSender javaMailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setHost(props.getHost()); mailSender.setPort(props.getPort()); mailSender.setUsername(props.getUsername()); mailSender.setPassword(props.getPassword()); Properties mailProperties = new Properties(); mailProperties.put("mail.smtp.auth", props.getSmtp().isAuth()); mailProperties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); mailProperties.put("mail.smtp.starttls.enable", props.getSmtp().isStarttlsEnable()); mailSender.setJavaMailProperties(mailProperties); mailSender.setProtocol("smtps"); return mailSender; }
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/26128181
type: Answer
has body: Answer based on How do I preserve line breaks when using jsoup to convert html to plain text? How about adding some special text after each &lt;br/&gt; in your HMTL. This way when you call text() you will have instead of line&lt;br/&gt;line something like line[specialString]line and then you can just replace this [specialString] with \n. I mean something like element.select("br").append("@REPLACEME@"); String lyrics = element.text().replaceAll("\\s*@REPLACEME@\\s*", "\n"); You can also use Jsoup.clean method on HTML text code of your lyrics to remove all unwanted tags like &lt;b&gt; &lt;i&gt; &lt;!-- comments --&gt; except tags defined by you like in this case &lt;br /&gt; and then replace this br tag with either \n or "" depending on if your HTML had actually line breaks after &lt;br/&gt;. So your code can look like String lyrics = Jsoup.clean( element.html(), //html to clean Whitelist.none().addTags("br")//allowed tags ).replace("&lt;br /&gt; ", "");
score: 0
answers question: http://stackoverflow.com/q/26126639

http://stackoverflow.com/q/26038016
tagged with: java
accepted answer: http://stackoverflow.com/a/26038662
has comment: http://stackoverflow.com/comment/40798319
answer count: 2
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/70689
has answer: http://stackoverflow.com/a/26038394
favorite count: 0
has comment: http://stackoverflow.com/comment/40798264
tagged with: singleton
possible better answer: http://stackoverflow.com/a/26038394
has comment: http://stackoverflow.com/comment/40786704
has title: Maintaining different properties in the singleton with single element enum?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40798185
has answer: http://stackoverflow.com/a/26038662
upvote count: 2
has body: This is a follow up question after reading answers to this question. Most of people so keen on recommending single element enums over singleton class implementations. For instance: Singleton with enum: public enum Singleton{ INSTANCE; public void doStuff(){ //...... } public void doMoreStuff(){ //...... } } According to Java Docs; An enum type is a special data type that enables for a variable to be a set of predefined constants. My Question: Pardon me if this is a stupid question. As singletons are capable of maintaining global states for the application, When implementing singletons in with the single element enums, how can you maintain different states with your singleton? For example If I want my Singleton to keep followings; public myStringField=""; public int myIntField=0; How can I do it with single element enums?
type: Question
tagged with: enums

http://stackoverflow.com/comment/40911114
has text: _"is not working"_ is pretty vague. In what way is it not working? Does it throw an exception? Do nothing when it's supposed to do something? Do the wrong thing? Something else?
score: 0
comment on: http://stackoverflow.com/q/26105690
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26068814
has body: In order to access a cell in Apache POI, you have to get a row first, and then get cell within chosen row. Below is example: //Input file InputStream inp = new FileInputStream("workbook.xls"); //Create workbook instance Workbook wb = WorkbookFactory.create(inp); //Create sheet instance Sheet sheet = wb.getSheetAt(0); for(int i = 3; i &lt;= 16; ++i){ //Rows from 4 to 15 (Apache POI is zero based) Row row = sheet.getRow(i); Cell cell = row.getCell(2); //Column "C" //Do something with cell } // Write the output to a file FileOutputStream fileOut = new FileOutputStream("workbook.xls"); wb.write(fileOut); fileOut.close(); Source (more examples here)
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26068627
score: 1
has comment: http://stackoverflow.com/comment/40844000

http://stackoverflow.com/q/26059692
has answer: http://stackoverflow.com/a/26060111
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40827444
tagged with: java
has comment: http://stackoverflow.com/comment/40827000
has title: Automation of ssh session using jsch library in java
tagged with: automation
has body: I am automating the ssh session using java, using this code i am able to login and i get the output on screen, but after this, after we enter the application to run in the ssh session, it doesn't take username and password as it requires keyboard interactions like TAB and ENTER and function keys etc, so is there a way to send keyboard events in place of commands so that automation is successful? public class jschputty { public static void main(String args[]) { String host="x.x.x.x"; String user="username"; String password="password"; String command1="ls -ltr\t"; try{ java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); JSch jsch = new JSch(); Session session=jsch.getSession(user, host, 22); session.setPassword(password); session.setConfig(config); session.connect(); System.out.println("Connected"); ChannelExec channel=(ChannelExec) session.openChannel("exec"); BufferedReader in=new BufferedReader(new InputStreamReader(channel.getInputStream())); channel.setCommand(command); channel.connect(); String msg=null; while((msg=in.readLine())!=null){ System.out.println(msg); } channel.disconnect(); session.disconnect(); System.out.println("DONE"); }catch(Exception e){ e.printStackTrace(); } } }
type: UnansweredQuestion
type: Question

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/26045312

http://stackoverflow.com/comment/40799333
type: Comment
has text: What do you think "private" means?
score: 5
comment on: http://stackoverflow.com/q/26044625
type: QuestionComment

http://stackoverflow.com/q/26055530
tagged with: oracle-database
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26056940
has body: First, I have to apologize if this is a silly question but I am new to PL/SQL. I am working on a project that requires some interaction with an Oracle database using java and PL/SQL. I have an undeterminable list of key-values which I would like to pass to the database, my initial research seems to point me to oracle.sql.STRUCT and oracle.sql.ARRAY. I am not totally in favour of STRUCT and ARRAY objects because they require existing objects/tables types in the database side. Edit: in my pl/sql CREATE OR REPLACE TYPE myItem AS object (c1 VARCHAR2(10), c2 VARCHAR2(30)); CREATE OR REPLACE TYPE text_table AS TABLE OF myItem ; in my java code java.sql.Connection connection = myGetConnection(); // create variables for the oracle.sql.ARRAY ArrayDescriptor arraydesc = ArrayDescriptor.createDescriptor("TEXT_TABLE", connection); Object[] arrayObject = new Object[2]; //create STRUCT objects StructDescriptor descriptor = StructDescriptor.createDescriptor("MYITEM", connection); // Loop through the map and put objects in the arrayObject for(int i = 0; i &lt; myMap.size(); i++){ String key = "key"+1; String value = "value"+2; Object[] obj = {key,value}; STRUCT structObj = new STRUCT(descriptor, connection, obj); // put the struct object in the array object arrayObject[i] = structObj; } // create the oracle.sql.ARRAY ARRAY array = new ARRAY(arraydesc, connection, arrayObject); //.. oracleCallableStatement = connection.prepareCall("{call myPackage.myProcedure(?)}"); oracleCallableStatement.setArray(1, array); oracleCallableStatement.execute(); oracleCallableStatement.close(); The fact that I have to excplictly declare a type in my oracle database makes me think there must be an easier way of doing things. These are very primitive objects. Is this the right way to go about it and is this really my only option?
upvote count: 1
type: Question
tagged with: java
tagged with: plsql
tagged with: sql
has answer: http://stackoverflow.com/a/26056940
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: How should I pass key-values to a PL/SQL procedure?

http://stackoverflow.com/q/26178887
type: Question
has comment: http://stackoverflow.com/comment/41046462
has comment: http://stackoverflow.com/comment/41048581
has title: Insert json data to database using preparestatement
favorite count: 0
has comment: http://stackoverflow.com/comment/41046067
upvote count: 2
has comment: http://stackoverflow.com/comment/41046222
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41046133
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41045941
tagged with: mysql
has comment: http://stackoverflow.com/comment/41046385
has comment: http://stackoverflow.com/comment/41046344
downvote count: 1
has body: I have json data like this { "name": "ABCD", "age": "43", "DateOfBirth": "2000-10-10" } Both its key and value are surrounded by double quote. Now I need to insert this to my database. name : varchar age : integer DateOfBirth : Date Using a gson, I convert the json data to a HashMap (String,String) but now What should I use with prepareStatement , setString() or setObject() ? Will they make sure that works with all DBMS ( MySql,Postgres,SQlserver...)

http://stackoverflow.com/comment/40791910
score: 0
has text: Ah thank God that I know which line throws that exception...
comment on: http://stackoverflow.com/q/26040597
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26083337
has comment: http://stackoverflow.com/comment/40871504
has comment: http://stackoverflow.com/comment/40918124
upvote count: 9
has body: To implement multiple ways of sorting a collection of Employee references, you should create separate classes implementing Comparator&lt;Employee&gt;. So you might have: public class EmployeeAgeComparator implements Comparator&lt;Employee&gt; { ... } public class EmployeeSalaryComparator implements Comparator&lt;Employee&gt; { ... } Then you just pass an instance of the appropriate comparator into the Arrays.sort method. Basically, implementing Comparable is good when there's one sort order which is a sensible default - but comparators allow you to separate "the things being compared" from "the thing doing the comparing." As a side-note, using double to represent currency values (like salaries) is a bad idea, due to the way binary floating point works (e.g. not being able to represent 0.1 exactly)... use BigDecimal, or store an integer number of cents (or whatever currency unit you're using).
answers question: http://stackoverflow.com/q/26083314
downvote count: 0
has comment: http://stackoverflow.com/comment/40871388
score: 9
has comment: http://stackoverflow.com/comment/40918093
type: Answer

http://stackoverflow.com/q/26116826
has body: I am new to ANTLR framework. I have been working around this for a week. Now am in a situation where i need to parse the Java file and extract the data. Am using ANTLR 4 for parsing. I create the Lexer, Parser and Visitor files using ANTLR in built tool. When I try to over ride the Visitor method I doesn't gets called and returns null value. Here is the coding. I have generated JavaLexer, JavaParser, JavaVisitor, JavaBaseVisitor, JavaListener package com.antlr; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.tree.*; import java.io.FileInputStream; import java.io.InputStream; public class ExtractInterfaceVisitor { public static class AnnVisitor extends JavaBaseVisitor&lt;String&gt; { @Override public String visitAnnotation (JavaParser.AnnotationContext ctx) { System.out.println("Annotation"); return ctx.getText(); } @Override public String visitClassDeclaration( JavaParser.ClassDeclarationContext ctx) { System.out.println("Class Declaration"); return ctx.getText(); } } public static void main(String[] args) throws Exception { String inputFile = null; inputFile = "C:/Users/User/Desktop/antlr/java1/Demo.java"; //Contains a Java File InputStream is = System.in; is = new FileInputStream(inputFile); ANTLRInputStream input = new ANTLRInputStream(is); JavaLexer lexer = new JavaLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); JavaParser parser = new JavaParser(tokens); parser.setBuildParseTree(true); // tell ANTLR to build a parse tree ParseTree tree = parser.compilationUnit(); // parse // show tree in text form //System.out.println(tree.toStringTree(parser)); AnnVisitor Visitor = new AnnVisitor(); String result = Visitor.visit(tree); System.out.println("visitor result = "+result); } } Demo.java @ClassAnnotation(Value="Class") public class Demo { @MethodAnnotation(Value="Method") void MethodName(int x, String y) { } int x; int[ ] g(/*no args*/) { } int average() { } List&lt;Map&lt;String, Integer&gt;&gt;[] h() { return null; } } Java.g4 /** J…
upvote count: 7
has answer: http://stackoverflow.com/a/26120022
type: Question
has comment: http://stackoverflow.com/comment/40931073
tagged with: grammar
downvote count: 0
answer count: 6
has comment: http://stackoverflow.com/comment/40930960
has answer: http://stackoverflow.com/a/26117177
tagged with: antlr4
has answer: http://stackoverflow.com/a/26119312
has title: Visitor methods for Java grammar not working in ANTLR 4.4
has answer: http://stackoverflow.com/a/50142539
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45253432
has comment: http://stackoverflow.com/comment/77466898
has answer: http://stackoverflow.com/a/60495601
score: 7
tagged with: java

http://stackoverflow.com/a/26140483
has comment: http://stackoverflow.com/comment/41007666
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/41006900
upvote count: 0
answers question: http://stackoverflow.com/q/26140002
has comment: http://stackoverflow.com/comment/41007562
has body: You can use memory writing the data compressed to a ByteArrayOutputStream baos = new ByteArrayOutputStream ... new GZIPOutputStream(baos)); byte[] bytes = baos.toByteArray(); // &lt; 100 MB? ByteArrayInputStream .... And then later wrap the input stream in a GZIPInputStream. Still a minor slow down, but should be ideal for XML.
type: Answer

eclipse
tags question: http://stackoverflow.com/q/26142984
tags question: http://stackoverflow.com/q/26175736
tags question: http://stackoverflow.com/q/26146799
tags question: http://stackoverflow.com/q/26076613
tags question: http://stackoverflow.com/q/26186652
tags question: http://stackoverflow.com/q/26051032
tags question: http://stackoverflow.com/q/26048316
tag name: eclipse
tags question: http://stackoverflow.com/q/26144276
tags question: http://stackoverflow.com/q/26161545
tags question: http://stackoverflow.com/q/26161735
tags question: http://stackoverflow.com/q/26164476
tags question: http://stackoverflow.com/q/26097261
tags question: http://stackoverflow.com/q/26043916
tags question: http://stackoverflow.com/q/26080472
tags question: http://stackoverflow.com/q/26192666
tags question: http://stackoverflow.com/q/26104219
tags question: http://stackoverflow.com/q/26049904
tags question: http://stackoverflow.com/q/26106326
tags question: http://stackoverflow.com/q/26176044
tags question: http://stackoverflow.com/q/26182345
tags question: http://stackoverflow.com/q/26080951
tags question: http://stackoverflow.com/q/26136051
tags question: http://stackoverflow.com/q/26068679
tags question: http://stackoverflow.com/q/26105835
tags question: http://stackoverflow.com/q/26034527
tags question: http://stackoverflow.com/q/26122814
tags question: http://stackoverflow.com/q/26115753
tags question: http://stackoverflow.com/q/26072554
tags question: http://stackoverflow.com/q/26107364
tags question: http://stackoverflow.com/q/26116827
tags question: http://stackoverflow.com/q/26036552
tags question: http://stackoverflow.com/q/26125959
tags question: http://stackoverflow.com/q/26142606
tags question: http://stackoverflow.com/q/26034901
tags question: http://stackoverflow.com/q/26130265
tags question: http://stackoverflow.com/q/26054836
tags question: http://stackoverflow.com/q/26060458
tags question: http://stackoverflow.com/q/26167478
tags question: http://stackoverflow.com/q/26094681
tags question: http://stackoverflow.com/q/26147858
tags question: http://stackoverflow.com/q/26108360
tags question: http://stackoverflow.com/q/26099564
tags question: http://stackoverflow.com/q/26176608
tags question: http://stackoverflow.com/q/26076650
tags question: http://stackoverflow.com/q/26179538
tags question: http://stackoverflow.com/q/26191830
tags question: http://stackoverflow.com/q/26169569
tags question: http://stackoverflow.com/q/26171583
tags question: http://stackoverflow.com/q/26089433
tags question: http://stackoverflow.com/q/26034494
tags question: http://stackoverflow.com/q/26161398
tags question: http://stackoverflow.com/q/26177232
tags question: http://stackoverflow.com/q/26174682
tags question: http://stackoverflow.com/q/26114117
tags question: http://stackoverflow.com/q/26133717
tags question: http://stackoverflow.com/q/26104666
tags question: http://stackoverflow.com/q/26042189
tags question: http://stackoverflow.com/q/26039816
tags question: http://stackoverflow.com/q/26150628
tags question: http://stackoverflow.com/q/26091275
tags question: http://stackoverflow.com/q/26056733
tags question: http://stackoverflow.com/q/26125014
tags question: http://stackoverflow.com/q/26145558
tags question: http://stackoverflow.com/q/26067538
tags question: http://stackoverflow.com/q/26162855
tags question: http://stackoverflow.com/q/26160499
tags question: http://stackoverflow.com/q/26070816
tags question: http://stackoverflow.com/q/26096466
tags question: http://stackoverflow.com/q/26076117
tags question: http://stackoverflow.com/q/26188919
tags question: http://stackoverflow.com/q/26129736
tags question: http://stackoverflow.com/q/26073572
tags question: http://stackoverflow.com/q/26085453
tags question: http://stackoverflow.com/q/26144806
tags question: http://stackoverflow.com/q/26047488
tags question: http://stackoverflow.com/q/26051510
tags question: http://stackoverflow.com/q/26132591
tags question: http://stackoverflow.com/q/26155691
tags question: http://stackoverflow.com/q/26178788

http://stackoverflow.com/q/26100006
has answer: http://stackoverflow.com/a/26100067
has body: I want to know. What can be happen, when I use AsyncTask in IntentService.
linked to: http://stackoverflow.com/q/15167152
tagged with: android
has comment: http://stackoverflow.com/comment/40900587
tagged with: android-activity
favorite count: 0
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has title: What can be happen if I use AsyncTask in IntentService?
possible better answer: http://stackoverflow.com/a/26101681
accepted answer: http://stackoverflow.com/a/26100067
has comment: http://stackoverflow.com/comment/40901005
has answer: http://stackoverflow.com/a/26101681
tagged with: java
has comment: http://stackoverflow.com/comment/40901085
has answer: http://stackoverflow.com/a/57968701
linked to: http://stackoverflow.com/q/6875658
has comment: http://stackoverflow.com/comment/40900522
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26138493
has answer: http://stackoverflow.com/a/26139408
tagged with: eclipse
type: Question
has title: How to sort a list of my objects
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/26139701
score: 0
has answer: http://stackoverflow.com/a/26143027
upvote count: 1
has answer: http://stackoverflow.com/a/26139370
answer count: 4
has body: I've been coding for hours now trying to finish my assignment. Now that I am done, I would like to add a method that sorts the value of the customers. So that customer 2 comes on top and 5 last. How do I do that? Here is the code for the first class: public class Customer { private int customerNumber; private int purchases; private int shippingCost; private int productPrice; public int getProductPrice() { return productPrice; } public void setProductPrice(int productPrice) { this.productPrice = productPrice; } public int getPurchases() { return purchases; } public Customer(int purchases, int shippingCost, int productPrice) { this.purchases = purchases; this.shippingCost = shippingCost; this.productPrice = productPrice; } public void setPurchases(int purchases) { this.purchases = purchases; } public int getShippingCost() { return shippingCost; } public void setShippingCost(int shippingCost) { this.shippingCost = shippingCost; } protected int calculateValue() { int value=purchases*(productPrice-shippingCost); return value; } public int getCustomerNumber() { return customerNumber; } public void setCustomerNumber(int customerNumber) { this.customerNumber = customerNumber; } The second class: public class Subscriber extends Customer{ private int years; private int fee; public Subscriber(int purchases, int shippingCost, int productPrice) { super(purchases, shippingCost, productPrice); } public Subscriber(int purchases, int shippingCost, int productPrice,int _years,int _fee) { super(purchases, shippingCost, productPrice); years=_years; fee=_fee; } public int getYears() { return years; } public void setYears(int years) { this.years = years; } public int getFee() { return fee; } public void setFee(int fee) { this.fee = fee; } protected int calculateSubscriptionValue() { return years*fee; } protected int calculateValue(){ int value=super.calculateValue(); value+=calculateSubscriptionValue(); return value; } Third class: public class BusinessSubscriber extends Subscriber{ publ…
type: UnansweredQuestion
downvote count: 1
tagged with: java

http://stackoverflow.com/q/26169515
tagged with: rest
type: UnansweredQuestion
tagged with: resttemplate
has title: sending post data using rest template
tagged with: curl
tagged with: spring-mvc
tagged with: java
type: Question
score: 0
has body: I am trying to mimic the request below: curl -d "client_id=pxb5bw&amp;client_secret=yMwN&amp;grant_type=password&amp;username=foi&amp;password=wdY" "https://connect.xyz.com/oauth2/token" -k Using rest template Spring.java package spring; import com.fasterxml.jackson.core.JsonProcessingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import org.w3c.dom.Entity; public class Spring { private final RestTemplate restTemplate; public Spring(RestTemplate restTemplate) { this.restTemplate = restTemplate; } public void call() { Spring client = null; client.restTemplate.getMessageConverters().add(new FormHttpMessageConverter()); client.restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(headers); MultiValueMap&lt;String, String&gt; map = new LinkedMultiValueMap&lt;String, String&gt;(); map.add("grant_type", "password"); map.add("client_id", "dsgdsfg"); map.add("client_secret", "gvsdfg"); map.add("username","foi"); map.add("password", "wdY"); ResponseEntity&lt;String&gt; result = restTemplate.postForEntity("https://connect.gettyimages.com/oauth2/token ", entity, String.class, map);…
answer count: 1
has comment: http://stackoverflow.com/comment/41030897
has answer: http://stackoverflow.com/a/26171231

http://stackoverflow.com/comment/40993045
score: 0
type: Comment
has text: It is a class project so it has to run on 7. Is there a possibility that you would know an alternative for 7?
comment on: http://stackoverflow.com/a/26149840
type: AnswerComment

http://stackoverflow.com/q/26152146
has title: Date loop with String
has comment: http://stackoverflow.com/comment/40996141
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: loops
tagged with: calendar
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26155483
has body: Calendar c = Calendar.getInstance(); //getting calendar TextView date, diet; Button forward, back; int count = 0; String [] word; @Override protected void onCreate... c.setFirstDayOfWeek(c.getFirstDayOfWeek()); //set first day (current day) //mT is method from database, "1" is for Monday, "1" for diet; final String[] word = { "" + mT(1, 1), "" + mT(1, 2), "" + mT(1, 3), "" + mT(1, 4), "" + mT(1, 5), "" + mT(1, 6), "" + mT(1, 7) }; ....//... SharedPreferences getPref = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); final String values = getPref.getString("list", "4"); if (values.contentEquals("1")) { //this display String and corresponding day (example "2, Tuesday") diet.setText(word[c.getFirstDayOfWeek()]); } //on Click forward button forward.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { c.add(Calendar.DATE, +1); counter(); if (values.contentEquals("1")) { diet.setText(word[c.getFirstDayOfWeek()+count]); } String word is related to number of day and on click method it paralel shifts with day in a week (if day in a week is "Monday" it calls String "0" --> mT(1,1) private void counter() { //And this is simple loop count++; if(count&gt;=7){ // --&gt; 7 is number of days in a week count=0; // start from beginning } My problem is when String comes to 7 (last one -->... mT(1, 7)) application crashes. But it needs to start from beginning (first String[] --> mT(1,1)) and parallel with that to follow coresponding day in a week. Can anyone help me with fixing this problem?
tagged with: date
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26155483
favorite count: 0
tagged with: android

http://stackoverflow.com/q/26173802
has answer: http://stackoverflow.com/a/29016936
type: Question
has answer: http://stackoverflow.com/a/26177184
accepted answer: http://stackoverflow.com/a/26177184
upvote count: 1
has answer: http://stackoverflow.com/a/26173828
favorite count: 0
possible better answer: http://stackoverflow.com/a/26173828
answer count: 4
has comment: http://stackoverflow.com/comment/41036444
downvote count: 0
has body: This is my first Hibernate practice, I got the following Error java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter I added the jar file to project library but the error still remains. I am using Eclipse. How can i Solve this problem, Is this related to my code ? or about Settings in Eclipse ? This is my hibernate example This is my hibernate example hibernate configuration Errors Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter at org.hibernate.bytecode.cglib.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:33) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:182) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:160) at org.hibernate.tuple.entity.AbstractEntityTuplizer.&lt;init&gt;(AbstractEntityTuplizer.java:135) at org.hibernate.tuple.entity.PojoEntityTuplizer.&lt;init&gt;(PojoEntityTuplizer.java:55) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.&lt;init&gt;(EntityEntityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.&lt;init&gt;(EntityMetamodel.java:269) at org.hibernate.persister.entity.AbstractEntityPersister.&lt;init&gt;(AbstractEntityPersister.java:425) at org.hibernate.persister.entity.SingleTableEntityPersister.&lt;init&gt;(SingleTableEntityPersister.java:109) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:226) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218) at com.hib.anoop.ManageEmployee.main(ManageEmployee.java:20) Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.CallbackFilter 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 …
has comment: http://stackoverflow.com/comment/41036628
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: eclipse
has title: Hibernate: How can i resolve java.lang.IncompatibleClassChangeError:
has answer: http://stackoverflow.com/a/26173851

jboss
tags question: http://stackoverflow.com/q/26108461
tags question: http://stackoverflow.com/q/26108931
tags question: http://stackoverflow.com/q/26100406
tags question: http://stackoverflow.com/q/26036178
tags question: http://stackoverflow.com/q/26112874
tags question: http://stackoverflow.com/q/26102789
tags question: http://stackoverflow.com/q/26048667
tags question: http://stackoverflow.com/q/26118582
tags question: http://stackoverflow.com/q/26098526
tags question: http://stackoverflow.com/q/26039920
tags question: http://stackoverflow.com/q/26075266
tag name: jboss
tags question: http://stackoverflow.com/q/26151933
tags question: http://stackoverflow.com/q/26155275
tags question: http://stackoverflow.com/q/26087194
tags question: http://stackoverflow.com/q/26137219
tags question: http://stackoverflow.com/q/26119169
type: Tag
tags question: http://stackoverflow.com/q/26034599
tags question: http://stackoverflow.com/q/26094536
tags question: http://stackoverflow.com/q/26144574
tags question: http://stackoverflow.com/q/26159419
tags question: http://stackoverflow.com/q/26054075
tags question: http://stackoverflow.com/q/26040082
tags question: http://stackoverflow.com/q/26187763
tags question: http://stackoverflow.com/q/26139466
tags question: http://stackoverflow.com/q/26143840
tags question: http://stackoverflow.com/q/26158898
tags question: http://stackoverflow.com/q/26046628
tags question: http://stackoverflow.com/q/26140179
tags question: http://stackoverflow.com/q/26161279
tags question: http://stackoverflow.com/q/26047220

http://stackoverflow.com/comment/41007412
type: QuestionComment
score: 2
has text: You can't test concurrency reliably, it's one thing that can be considered random. In order to write good, thread safe, code you need to have a thorough grounding in concurrent techniques, and rely almost solely on those. Tests may pass every time, but there might still be a 1 in 1,00,000 chance of catastrophic failure.
comment on: http://stackoverflow.com/q/26158465
type: Comment

http://stackoverflow.com/comment/41074239
comment on: http://stackoverflow.com/q/26194289
type: Comment
has text: `new` is not a method, of no class, although the syntax used in your example might lead to this assumption. `new` invokes the constructor of the specified class. As @BoristheSpider says, the situation here is that you are creating an instance of an inner class so you might want to learn [how they work](http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html). BTW “the ultimate super class” is called `java.lang.Object`.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40852648
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26068095
has text: Works fine for me. Did you put the classes into corresponding sub-directories when specifying packages?
type: Comment

http://stackoverflow.com/q/26089297
has answer: http://stackoverflow.com/a/49645438
type: Question
has body: I have an gae app which is written in java and is split into two different modules. One of these modules has a cron.xml which was installed on initial deployment. Cron tasks works fine and are executed as expected. Now my problem is that when I redeploy my app with maven (> mvm appengine:update), if I have made changes to the cron.xml, these changes aren't reflected on the server when deployment is done. I.e it's the old cron.xml that's being used. If I try to update the cron.xml manually (mvn appengine:cron_update) I get an error: "Bad argument: The requested action does not support EAR configurations" Basically my question is how do I update the cron.xml?
has answer: http://stackoverflow.com/a/57844761
upvote count: 3
answer count: 3
tagged with: cron
tagged with: google-app-engine
favorite count: 0
type: UnansweredQuestion
has title: GAE update cron.xml with maven on app with java modules
has answer: http://stackoverflow.com/a/61842656
has comment: http://stackoverflow.com/comment/43757176
has comment: http://stackoverflow.com/comment/43756500
score: 3
has comment: http://stackoverflow.com/comment/43737027
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/40802631
has text: Doesn't `methodToCompareArrays` already do at least some of this for you?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26046342

http://stackoverflow.com/q/26079943
score: 0
answer count: 1
has body: There must be something fundamental that I'm not fully understanding about the fragment management. Here's the current architecture of my app: We have a menu activity that has been generated using the template provided in Eclipse (MenuActivity.java) Each fragments shown from the menu has two layouts. One for phone and another for tablets. These layouts only contain FrameLayout that are replaced with fragments using the FragmentManager/Transaction. Each fragment implements onCreateOptionsMenu to add their own bits of the menu. The problem is that when I switch tabs using the drawer menu, some of the options stays in the action bar. Also, the fragment that receives the call to onOptionsItemSelected is always the last fragment that was selected. Some code of MainActivity.java @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); Fragment fragment = null; String tag = ""; switch(position) { case 0: tag = "tours_main_fragment"; fragment = new ToursMainFragment(); mTitle = getString(R.string.title_section1); break; case 1: tag = "motos_main_fragment"; fragment = new MotoMainFragment(); mTitle = getString(R.string.title_section2); break; } if(fragment != null) { fragmentManager .beginTransaction() .replace(R.id.container, fragment, tag) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { if (!mNavigationDrawerFragment.isDrawerOpen()) { // Only show items in the action bar relevant to this screen // if the drawer is not showing. Otherwise, let the drawer // decide what to show in the action bar. getMenuInflater().inflate(R.menu.menu, menu); restoreActionBar(); return false; } return super.onCreateOptionsMenu(menu); }
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26080068
has title: Menu drawer Fragments inflates their menu even when not shown
tagged with: java
type: Question
tagged with: android-fragments

http://stackoverflow.com/comment/40980680
comment on: http://stackoverflow.com/q/26143894
type: QuestionComment
has text: Just an idea, but since this is windows... do you have any whitespaces in the path to tomcat?
type: Comment
score: 0

http://stackoverflow.com/q/26050047
tagged with: http://stackoverflow.com/tag/xml
score: 6
tagged with: spring
upvote count: 6
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26050336
accepted answer: http://stackoverflow.com/a/26050336
linked to: http://stackoverflow.com/q/26231165
has title: No XML Spring ApplicationContext
has body: I am trying create an project with and without spring xml configurations. First at all, I create my xml configuration like that: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"&gt; &lt;bean id="memoryManagerProduct" class="br.com.caelum.stock.ProductManager"&gt; &lt;constructor-arg ref="memoryProductDAO"/&gt; &lt;/bean&gt; &lt;bean id="memoryProductDAO" class="br.com.caelum.stock.dao.MemoryProductDAO"/&gt; &lt;/beans&gt; That I created my non XML configuration (I do not know if is right base in the fact that I do not know how invoke that) package br.com.caelum.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import br.com.caelum.stock.ProductManager; import br.com.caelum.stock.dao.MemoryProductDAO; import br.com.caelum.stock.dao.Persistable; import br.com.caelum.stock.model.Product; @Configuration public class AppConfig { @Bean public Persistable&lt;Product&gt; memoryProductDAO(){ return new MemoryProductDAO(); } @Bean public ProductManager memoryProductManager(){ return new ProductManager(memoryProductDAO()); } } Than I created an JUnit test: package br.com.caelum.stock; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import br.com.caelum.stock.model.Product; public class ProductManagerTest { private ProductManager manager; @Test public void testSpringXMLConfiguration() { ApplicationCon…
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26173413
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/26173724
has body: I have an array like this: ArrayList&lt;FuelData&gt; arrValue = objrp.FuelReport(AccountID, deviceID, datefrom, dateto, timezone, timefrom, timeto); for (int i = 0; i &lt; arrValue.size(); i++) { String statusDescription = StatusCode.getDescription(AccountID, arrValue.get(i).GetStatusCode(), privLabel, null); String detail = "Mức nhiên liệu:" + Math.round(arrValue.get(i).GetFuelLevel()) + " l\\nQuãng đường đi được:" + Math.round(arrValue.get(i).GetFuelLevel())// adding GetOdometer here + " km\\nThời gian: " + ConvertFromEpoch(arrValue.get(i).getTimeStamp()) + "\\nĐịa điểm:" + GetUTF8FromNCRDecimalString(arrValue.get(i) .getAddress()) + "\\nTrạng thái: " + GetUTF8FromNCRDecimalString(statusDescription); strscr += "chartData.push({fuelLevel: " + arrValue.get(i).GetFuelLevel() + ",odometerKm: " + arrValue.get(i).GetOdometerKM() + ", detail:\"" + detail + "\"});\n"; } now I want to add this method: GetOdometer(String accountID, String deviceID, String timestamp) to this line: + Math.round(arrValue.get(i).GetFuelLevel())// adding GetOdometer here.This method is not belong to FuelData class but in other class. Can I do this, and if can, how can I do?
score: -5
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41035790
has comment: http://stackoverflow.com/comment/41035869
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41035691
tagged with: java
has answer: http://stackoverflow.com/a/26173724
has title: Add a method to an exited ArrayList
has comment: http://stackoverflow.com/comment/41035706
type: Question
has comment: http://stackoverflow.com/comment/41035817
upvote count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/41035766
has comment: http://stackoverflow.com/comment/41035784

http://stackoverflow.com/a/26078598
accepted answer of: http://stackoverflow.com/q/26045663
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41074862
answers question: http://stackoverflow.com/q/26045663
type: Answer
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/40863589
has comment: http://stackoverflow.com/comment/40933938
has comment: http://stackoverflow.com/comment/40923026
has comment: http://stackoverflow.com/comment/41074099
has comment: http://stackoverflow.com/comment/40862168
has comment: http://stackoverflow.com/comment/40921869
has body: Ignore blank does not accomplish what you want it to. In a situation as you describe, when the user is typing into the cell, it prevents him creating a blank entry. However, it does NOT prevent him exiting data entry mode (e.g. using ESC) which will also leave the cell blank. It also does not prevent him from selecting the cell, and hitting Delete without going into data entry. Depending on exactly what you want to do, you can use a VBA event macro to test whether the cell is blank after a certain event. Whether this should be a Worksheet_SelectionChange event, Worksheet_Deactivate event, Workbook_Close event, or one or more other events, depends on the specifics of your project.
has comment: http://stackoverflow.com/comment/40862004
has comment: http://stackoverflow.com/comment/40917630

http://stackoverflow.com/q/26050410
accepted answer: http://stackoverflow.com/a/26050514
type: Question
possible better answer: http://stackoverflow.com/a/26051339
has answer: http://stackoverflow.com/a/26051339
has comment: http://stackoverflow.com/comment/40810107
answer count: 2
tagged with: runnable
downvote count: 0
favorite count: 0
tagged with: timer
tagged with: android
has body: I would like to ask, if is there a better away to call a method multiple times giving a 5 sec delay between each call. But I really want is to call the Toas() method about 7 times, and with my code below, it doesnt look right. Thanks guys @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... CallMultipleToast(); ........ private void CallMultipleToast(){ Runnable call_1 = new Runnable() { @Override public void run() { Toast("Message one"); Runnable call_2 = new Runnable() { @Override public void run() { Toast("Message two"); Runnable call_3 = new Runnable() { @Override public void run() { Toast("Message three"); //CAN I ADD MORE } };//end call_3 new Handler().postDelayed(call_3, 5000); } };//end call_2 new Handler().postDelayed(call_2, 5000); } };//end call_1 new Handler().postDelayed(call_1, 5000); } private void Toast(String message){ Toast.makeText(this, message, Toast.LENGTH_LONG).show(); }
has title: Android How to call a method multiple times with a delay between them
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26050514
tagged with: performance
has comment: http://stackoverflow.com/comment/40810761
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26114018
upvote count: 1
has answer: http://stackoverflow.com/a/26129915
has body: I want to make a full-screen application with javaFX .. i used stage.setFullScreen(true); every time i change the scene like this @Override public void start( Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("Language.fxml")); Scene scene = new Scene(root); stage.setFullScreen(true); stage.setScene(scene); stage.show(); } the problem is while transition the full screen appears to be turned off then back on instantly and the "press esc ... " sign appears every single scene is there a solution for this ?!
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26129915
tagged with: transition
type: Question
tagged with: fullscreen
has answer: http://stackoverflow.com/a/26114323
answer count: 2
possible better answer: http://stackoverflow.com/a/26114323
downvote count: 0
has title: fullscreen transition in javaFX
favorite count: 0

http://stackoverflow.com/comment/40794951
has text: @PatrickJAbareII Well you right :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26042189

glassfish
tags question: http://stackoverflow.com/q/26120899
tags question: http://stackoverflow.com/q/26178724
tags question: http://stackoverflow.com/q/26117886
tags question: http://stackoverflow.com/q/26175870
tags question: http://stackoverflow.com/q/26157539
tags question: http://stackoverflow.com/q/26039200
tags question: http://stackoverflow.com/q/26126425
tags question: http://stackoverflow.com/q/26147101
tags question: http://stackoverflow.com/q/26144541
tag name: glassfish
tags question: http://stackoverflow.com/q/26065700
tags question: http://stackoverflow.com/q/26107101
tags question: http://stackoverflow.com/q/26163638
tags question: http://stackoverflow.com/q/26184018
tags question: http://stackoverflow.com/q/26174170
type: Tag
tags question: http://stackoverflow.com/q/26123592
tags question: http://stackoverflow.com/q/26084711

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/26104219
type: Tag
tags question: http://stackoverflow.com/q/26182290

http://stackoverflow.com/comment/40964239
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26130624
has text: So from the IDE view, you should be basically seeing `Project/src/res/theimage.png` and using `getResource("/res/theimage.png");`. Clean and build your project if you need to. Also try creating a new project and trying.

http://stackoverflow.com/comment/40983802
has text: … got this error in logcat: 10-01 23:03:08.606: W/Ads(1002): Not enough space to show ad. Needs 320x50 dp, but only has 288x407 dp. 10-01 23:03:08.606: W/Ads(1002): Not enough space to show ad. Needs 320x50 dp, but only has 288x375 dp.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26142594

http://stackoverflow.com/comment/40993000
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26149934
has text: Can you explain where the main class is defined ?

http://stackoverflow.com/comment/40805189
has text: thanks I was thinking something similar to this but this doesn't use the for each loop that I have above. I just want the amount to be stored in an array and return it not sure how to do that.
type: Comment
comment on: http://stackoverflow.com/a/26047668
score: 0
type: AnswerComment

http://stackoverflow.com/a/26054541
type: Answer
answers question: http://stackoverflow.com/q/26048524
has body: Don't even attempt it. XML is not a regular language [technical term] so regular expressions are the wrong tool for the job. See the famous post here: RegEx match open tags except XHTML self-contained tags Use an XML parser.
score: 0

http://stackoverflow.com/comment/41034719
type: AnswerComment
has text: Make sure your classpath is set properly. Else use: $ export CLASSPATH=.:<path1>:<path2>
score: 0
comment on: http://stackoverflow.com/a/26172804
type: Comment

http://stackoverflow.com/a/26093920
answers question: http://stackoverflow.com/q/26093115
type: Answer
has body: Your Namenode is in save mode. You need to leave that. hadoop dfsadmin -safemode leave Here is the Explanation
score: 0
has comment: http://stackoverflow.com/comment/40961953
has comment: http://stackoverflow.com/comment/40963361

http://stackoverflow.com/q/26131849
has comment: http://stackoverflow.com/comment/40958752
tagged with: static
tagged with: args
has title: Why am i getting this error? Exception in thread "main" java.lang.NoClassDefFoundError: "
tagged with: void
has comment: http://stackoverflow.com/comment/40958691
type: UnansweredQuestion
type: Question
has body: Here is the full error message: Exception in thread "main" java.lang.NoClassDefFoundError: DataEntry/java Caused by: java.lang.ClassNotFoundException: DataEntry.java at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Here is my code: import java.awt.*; import java.awt.event.*; public class DataEntry { public static void main(String[] args) { Frame frm=new Frame("DataEntry frame"); Label lbl = new Label("Please fill this blank:"); frm.add(lbl); frm.setSize(350,200); frm.setVisible(true); frm.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); Panel p = new Panel(); Panel p1 = new Panel(); Label jFirstName = new Label("First Name"); TextField lFirstName = new TextField(20); Label jLastName =new Label("Last Name"); TextField lLastName=new TextField(20); p.setLayout(new GridLayout(3,1)); p.add(jFirstName); p.add(lFirstName); p.add(jLastName); p.add(lLastName); Button Submit=new Button("Submit"); p.add(Submit); p1.add(p); frm.add(p1,BorderLayout.NORTH); } } The file is saved as DataEntry.java and the DataEntry.class file is in the same directory. Can someone please tell me what I am doing wrong?
tagged with: java
has answer: http://stackoverflow.com/a/26131870
score: 0
tagged with: program-entry-point
answer count: 1

cmd
tags question: http://stackoverflow.com/q/26106807
type: Tag
tags question: http://stackoverflow.com/q/26063267
tags question: http://stackoverflow.com/q/26174975
tags question: http://stackoverflow.com/q/26163483
tag name: cmd

http://stackoverflow.com/q/26182460
has title: JavaFX 8 HiDPI Support
favorite count: 0
linked to: http://stackoverflow.com/q/23229149
score: 25
accepted answer: http://stackoverflow.com/a/26184471
type: AnsweredQuestion
upvote count: 25
tagged with: java
has body: I just tried out the JavaFX Hello World Example on a 4k screen on Arch Linux, but unfortunately the GUI does not scale. The documentation says Hi-DPI support. JavaFX 8 now supports Hi-DPI displays. So how can I make my application dpi aware?
linked to: http://stackoverflow.com/q/26160709
type: Question
tagged with: hdpi
has comment: http://stackoverflow.com/comment/41052489
has answer: http://stackoverflow.com/a/59052811
has comment: http://stackoverflow.com/comment/41052653
has answer: http://stackoverflow.com/a/26184471
answer count: 2
tagged with: javafx-8
possible better answer: http://stackoverflow.com/a/59052811
downvote count: 0

http://stackoverflow.com/q/26046889
has comment: http://stackoverflow.com/comment/40804564
has answer: http://stackoverflow.com/a/26133455
has title: Poisson Distribution in Java (correctness?)
has comment: http://stackoverflow.com/comment/40811314
has comment: http://stackoverflow.com/comment/40804441
type: Question
has comment: http://stackoverflow.com/comment/125355752
has comment: http://stackoverflow.com/comment/40804309
linked to: http://stackoverflow.com/q/1241555
linked to: http://stackoverflow.com/q/5657861
has comment: http://stackoverflow.com/comment/40825025
tagged with: poisson
has comment: http://stackoverflow.com/comment/125355784
has comment: http://stackoverflow.com/comment/40811202
has comment: http://stackoverflow.com/comment/125355867
accepted answer: http://stackoverflow.com/a/26133455
tagged with: curve
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/125355818
has comment: http://stackoverflow.com/comment/125355691
score: 2
has comment: http://stackoverflow.com/comment/40804024
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40803627
has body: I have to generate data for a Poisson distribution. My range is n = 1000 up to 100K. Where n is the number of data elements; k varies from 1 to n. It says to use lambda as n/2 I have never taken stats and have no idea how to get the correct curve here. I can feed it lambda as n/2, but do I vary K from 0-n? I tried this (passing k in as a parameter) and when I graphed the data it ramped up, not a fish tail. What am I doing wrong, or am I doing it correctly? Thanks I have this code in java from Knuth. static double poissonRandomNumber(int lambda) { double L = Math.exp(-lambda); int k = 0; double p = 1; do { k = k + 1; double u = Math.random(); p = p * u; } while (p &gt; L); return k - 1; }
upvote count: 2
has comment: http://stackoverflow.com/comment/40804071
tagged with: java
has comment: http://stackoverflow.com/comment/40805406

http://stackoverflow.com/q/26163162
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26163279
tagged with: https
type: Question
tagged with: ssl
has body: I've been serving a web application over HTTPS on the default port of 443 with embedded Jetty (let's call that serverA) on Ubuntu 14.04 (using a self-signed certificate). It's been working fine for ages now, but I want to run another embedded Jetty web server (serverB) on the same machine. I'd like serverB to run SSL using the default port 443, so I need to change serverA to listen for requests on some other port. I've been trying serverA with 444 and 8080. The server fires up just fine, telling me that it's listening for requests on the correct port. but requests just hang and the server logs are telling me nothing. If I start the server up listening on port 443, then everything works fine. I didn't think it matters which port I use as long as I have the web server configured to use SSL. Is there something else I need to do? Here's my launch code: // Java 7 bug (feature?) - this disables SNI everywhere... // required or else outgoing HTTPS requests will fail System.setProperty("jsse.enableSNIExtension", "false"); PropertyConfigurator.configure("./log4j.properties"); Server server = new Server(); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar("war"); server.setHandler(webapp); HttpConfiguration https = new HttpConfiguration(); https.addCustomizer(new SecureRequestCustomizer()); SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStorePath("keystore.jks"); sslContextFactory.setKeyStorePassword("password"); sslContextFactory.setKeyManagerPassword("password"); ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https)); sslConnector.setPort(port); server.setConnectors(new Connector[] { sslConnector }); try { LOG.info("Starting server on port " + port); server.start(); server.join(); } catch (Exception e) { LOG.fatal("The web server has crashed", e); } Note: The reason this is on StackOverflow and not SuperUs…
has title: How to user embedded Jetty with HTTPS over port other than 443?
has comment: http://stackoverflow.com/comment/41017681
has comment: http://stackoverflow.com/comment/41017725
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41018033
tagged with: embedded-jetty
accepted answer: http://stackoverflow.com/a/26163279
tagged with: jetty

http://stackoverflow.com/comment/41031610
type: Comment
type: QuestionComment
score: 0
has text: We can't use @JsonIgnore for this use case as it would break our other uses of Jackson that serialize these objects.
comment on: http://stackoverflow.com/q/26170872

http://stackoverflow.com/comment/40784280
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26035204
has text: I've expanded my comment as an answer, if it suits you, and it answers your question, then you can mark it as correct. If you need more details let me know ;)

http://stackoverflow.com/a/26193749
answers question: http://stackoverflow.com/q/26193024
has body: You can't map json objects ({ ... }) to java lists so you have to create for the "list" objects a own class to map the objects to. That is very sub-optimal because you have to create for each item in the list a own property in your class but if you have no control over the json you have to deal with it. The classes should look like the following then BarListResponse.java: public class BarListResponse { @SerializedName("error") @Expose(serialize = false) String errrocode; @Expose(serialize = false) String status; @SerializedName("BarList") BarList bar_list; public String getErrrocode() { return errrocode; } public void setErrrocode(String errrocode) { this.errrocode = errrocode; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public BarList getLst() { return bar_list; } public void setLst(BarList lst) { this.bar_list = lst; } } BarList.java: public class BarList { Bar Bar1; Bar Bar2; ... } If you have somehow control over the json output you could change the "BarList" to a json array: { "error": "200", "status": "OK", "BarList": [ { "Name": "yash", "sex": "male", "Type": "barowner", "userId": "x25df", "ContactNo": "1234567890", "zipCode": "110055", "Address": "Ghumtarastachaltigali", "Email": "nahihairee@gmail.com" }, { "Name": "yash", "sex": "male", "Type": "barowner", "userId": "x25df", "ContactNo": "1234567890", "zipCode": "110055", "Address": "Ghumtarastachaltigali", "Email": "nahihairee@gmail.com" } ] } And change the response class to the following: public class BarListResponse { @SerializedName("error") @Expose(serialize = false) String errrocode; @Expose(serialize = false) String status; @SerializedName("BarList") List&lt;Bar&gt; bar_list; public String getErrrocode() { return errrocode; } public void setErrrocode(String errrocode) { this.errrocode = errrocode; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public List&lt;Bar&gt; getLst…
type: Answer
score: 0

http://stackoverflow.com/comment/40823018
type: Comment
has text: Guys got it sorted my silly mistake i have being trying to sent the email with a null content. Thanks for all the help.
comment on: http://stackoverflow.com/q/26055504
score: 0
type: QuestionComment

http://stackoverflow.com/a/26042063
answers question: http://stackoverflow.com/q/26041546
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26041546
score: 1
has comment: http://stackoverflow.com/comment/40795148
type: AcceptedAnswer
downvote count: 0
has body: A recursive function is a function that calls itself until it reaches a return statement, that stops it from recalling itself. Take your example, the Factorial function. Factorial is a mathematical function that returns the number multiplied by itself - 1 multiplied by itself - 2, ... multiplied by 1, example: factorial of 5 = 5! = 5x4x3x2x1 = 120. it is also equal to itself multiplied by the factorial of itself -1, which is: 5! = 5x4! Take into consideration that 0! = 1. to represent this in a Java code, you need a loop that multiplies the numbers starting from 1, and going till the number you are calculating its factorial. Further more, explaining your code, let us calculate Factorial(5): Factorial() returns an integer. Initial Call from main(): 5 != 0, then skip the condition (n == 0); t = Factorial(5-1) = Factorial(4); Second call from Factorial(4): 4 != 0, then skip the condition (n == 0); t = Factorial(4-1) = Factorial(3); Third call from Factorial(3): 3 != 0, then skip the condition (n == 0); t = Factorial(3-1) = Factorial(2); Fourth call from Factorial(2): 2 != 0, then skip the condition (n == 0); t = Factorial(2-1) = Factorial(1); Fifth call from Factorial(1): 1 != 0, then skip the condition (n == 0); t = Factorial(1-1) = Factorial(0); Sixth call from Factorial(0): 0 == 0, then return value 1; First return, 1, to Fifth call (Factorial(1)): return n*t = return 1*1 = return value 1; Second return, 1, to Fourth call (Factorial(2)): return n*t = return 2*1 = return value 2; Third return, 2, to third call (Factorial(3)): return n*t = return 3*2 = return value 6; Second return, 6, to second call (Factorial(4)): return n*t = return 4*6 = return value 24; Second return, 24, to First call (Factorial(5)): return n*t = return 5*24 = return value 120; Second return, 120, to Initial call (from main()): print(120); Hope this helps you understand recursion.
type: Answer
has comment: http://stackoverflow.com/comment/40794973

http://stackoverflow.com/comment/40813588
has text: Yes that is true but he wants us to get familiar with for loops.
comment on: http://stackoverflow.com/a/26052370
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26085775
upvote count: 1
downvote count: 1
score: 0
type: Answer
has body: If I understand you correctly: Maven: The Complete Reference, 3.4.1. Dependency Scope system [...] you have to provide an explicit path to the JAR on the local file system. [...] The artifact is assumed to always be available and is not looked up in a repository.
answers question: http://stackoverflow.com/q/26070816

http://stackoverflow.com/q/26091822
score: 1
tagged with: ant
tagged with: java
tagged with: ivy
has body: I have a basic program with a simple entity for the service builder set up with no properties for the purpose of web service calls. I depend locally on the javax.ws.rs library contained in javax.ws.rs-api-2.0.1.jar. In the IDE, The code does not show any errors. I can see the Ivy dependencies in the project explorer window. however when i call the build-services command, It fails to compile the code with Classes from the external jars. Am i missing a step when depending on jars in my application? shouldn't this automatically be linked? ant output: [javac] Compiling 4 source files to C:\liferay\liferay-developer-studio\liferay-plugins-sdk-6.2\portlets\myApp-portal-portlet\docroot\WEB-INF\service-classes [javac] ---------- [javac] 1. ERROR in C:\liferay\liferay-developer-studio\liferay-plugins-sdk-6.2\portlets\myApp-portal-portlet\docroot\WEB-INF\service\com\example\myApp\portal\service\ExternalApiLocalService.java (at line 69) [javac] public javax.ws.rs.client.WebTarget myAppRestApi(); [javac] ^^^^^^^^^^^^^^^^^^ [javac] javax.ws.rs.client cannot be resolved to a type [javac] ---------- [javac] 2. ERROR in C:\liferay\liferay-developer-studio\liferay-plugins-sdk-6.2\portlets\myApp-portal-portlet\docroot\WEB-INF\service\com\example\myApp\portal\service\ExternalApiLocalService.java (at line 71) [javac] public javax.ws.rs.client.WebTarget myAppRegisterService(); [javac] ^^^^^^^^^^^^^^^^^^ [javac] javax.ws.rs.client cannot be resolved to a type [javac] ---------- [javac] 3. ERROR in C:\liferay\liferay-developer-studio\liferay-plugins-sdk-6.2\portlets\myApp-portal-portlet\docroot\WEB-INF\service\com\example\myApp\portal\service\ExternalApiLocalService.java (at line 73) [javac] public javax.ws.rs.client.WebTarget myAppValidPaService(); [javac] ^^^^^^^^^^^^^^^^^^ [javac] javax.ws.rs.client cannot be resolved to a type [javac] ---------- [javac] ---------- [javac] 4. ERROR in C:\liferay\liferay-developer-studio\liferay-plugins-sdk-6.2\portlets\myApp-portal-portlet\docroot\WEB-…
type: Question
has answer: http://stackoverflow.com/a/26093947
tagged with: liferay
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26093947
upvote count: 1
has title: Service Builder does not compile code that depends on IVY jar
type: AnsweredQuestion

http://stackoverflow.com/a/26184029
has body: Declare this field in your class, outside of a method. Timer timer = new Timer(); Declare this method. public void setTimerToChangeColors() { timer.schedule(new TimerTask() { @Override public void run() { // Whatever you want your ball to do to changes its colors setTimerToChangeColors(); } }, 10*1000); // 10 seconds * 1000ms per second } You only need to call setTimerToChangeColors once. It will continue restarting itself every 10 seconds. You can fill in the code for what you want to do when the task is triggered. If you want random time, you will have to edit where the timer is scheduled 10*1000 to a random generator.
answers question: http://stackoverflow.com/q/26165506
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26165506

http://stackoverflow.com/q/26154535
has comment: http://stackoverflow.com/comment/41000499
tagged with: collision
has comment: http://stackoverflow.com/comment/41000585
tagged with: java
tagged with: jpanel
type: Question
has title: keeping sprites from colliding java
score: 0
tagged with: game-engine
has comment: http://stackoverflow.com/comment/41004473
has comment: http://stackoverflow.com/comment/41000593
has comment: http://stackoverflow.com/comment/41014414
answer count: 0
has body: I am making a game in java and I have most of it done. However, one of the last bugs i need to fix is that enemy sprites can overlap each other and spawn on top of one another off screen. I want to make it so if enemy sprites collide they can only touch but not overlap. here is the code for the enemy class. import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.util.ArrayList; import javax.swing.ImageIcon; public class Enemy extends Base { int x; int y; int velx = -2; int vely = 0; public Enemy(int x, int y) { super(x,y); this.x = x; this.y = y; } public void update() { movement(); x += velx; y += vely; if (x &lt; - 15) { x = -15; movement(); } if (x &gt; 1100) { x = 1100; movement(); } if (y &gt; 660) { y = 660; movement(); } if (y &lt; 10) { y = 10; movement(); } } public void draw(Graphics g) { g.drawImage(getEnemyImage(), x, y, null); } public static Image getEnemyImage(){ ImageIcon ic = new ImageIcon("enemy.gif"); return ic.getImage(); } public Rectangle getBounds(){ return new Rectangle(x, y, getEnemyImage().getWidth(null), getEnemyImage().getHeight(null)); } public void checkColision(){ ArrayList&lt;Base&gt; enemies = GamePanel.getEnemyList(); if (x &lt;= 0) { velx = 2; } if (x &gt;= 1096) { velx = -2; } for (int a = 0; a &lt; enemies.size(); a++) { Base temp = GamePanel.enemy.get(a); if (getBounds().intersects(temp.getBounds())) { // where the collision check should happen. } } } public void movement(){ if (y &gt; 16) { if (x &gt; GamePanel.p.getX()) { velx = - 2; } if (x &lt; GamePanel.p.getX()) { velx = 2; } if (y &gt; GamePanel.p.getY()) { vely = -2; } if (y &lt; GamePanel.p.getY()) { vely = 2; } } } } and this is where the enemies are spawned. for (int a = 0; a &lt; enemy_amount; a++) { space += 50; int rand = (int)(Math.random() * 2) + 1; if (rand == 1) { int randp = (int)(Math.random() * 2) + 1; int x = 0; int y = 0; if (randp == 1) { x = 1250 + space; y = 500; } if (randp == 2) { x = 1250 + space; y = 100; } enemy.add(…
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/comment/124945474
has text: I tried running it with : '{"menu":{"id":"file","value":"File","popup":{"menuitem":[{"value":"New","body":{"services":[{"id":"7d45d915-2e91-4d75-810f-c389339050cb"}]}}]}}}' tried to extract with "menu.popup.menuitem" and it failed
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26087867
type: AnswerComment

http://stackoverflow.com/q/26039819
has comment: http://stackoverflow.com/comment/40790428
score: 0
tagged with: stringescapeutils
tagged with: unicode-escapes
has comment: http://stackoverflow.com/comment/40790653
has title: Escape String in Grails to avoid JSON error
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40790562
has comment: http://stackoverflow.com/comment/40790881
has comment: http://stackoverflow.com/comment/40790549
has comment: http://stackoverflow.com/comment/40790370
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have few strings like "12.10 On-Going Submission of ""Made Up"" Samples." 10. PRODUCT STANDARDS; APPROVAL. which I render as JSON in grails. The quotes and any other possible special characters are giving me trouble i.e they make the JSON invalid when returning a response from the REST service. How do I solve this? I have tried few things but nothing seems to work: //text: java.net.URLEncoder.encode(artifact.text, "UTF-8"), //Loses the original format //text : artifact.text.encodeAsJavaScript(), // give problem with ; //text: artifact.text.encodeAsHTML(), // gives &amp;qoute(not wanted) in the text instead of " //text: StringEscapeUtils.escapeJava((String)artifact.text), //some error // text : artifact.text // the json gets cut at the string I have a similar question here to give you the idea of what exactly I am facing The code snippet : def index() { def document def artifacts def documentId def documentName def artifactType def artifactStatus def includeClassifications def classifications def mapOfAtifactTypes = [:] def listOfArtifacts = [] def listOfClassifications = [] def rtnVal = [:] documentId = params.documentId documentName = params.documentName try { if (! rtnVal?.msg ) { //if we dont' have a message yet it means we don't yet have a failure so we can continue if (document){ rtnVal.documentName = document.docName if (artifactType) { artifacts = Artifact.findAllByDocumentAndArtifactType(document, artifactType) } else { artifacts = Artifact.findAllByDocument(document) } } else { artifacts = Artifact.list(); } if (artifacts) { def artifactToAdd = [ documentId: artifact.documentId, documentName: artifact.document.docName, artifactId: artifact.id, //URLEncode so slashes and other control characters don't cause the rendered JSON to truncate //TODO look up the proper way to encode text prior to JSON rendering //text: java.net.URLEncoder.encode(artifact.text, "UTF-8"), //text : artifact.text.encodeAsJavaScript(), //text: artifact.text.encodeAsHTML(), //text: Str…
tagged with: grails
type: Question

http://stackoverflow.com/comment/40974868
type: Comment
type: QuestionComment
has text: Hello friends..I haven't tried anything yet..I ll get back you,when I have something better to show.
comment on: http://stackoverflow.com/q/26140454
score: 0

http://stackoverflow.com/q/26064595
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26064707
type: Question
has comment: http://stackoverflow.com/comment/40837657
tagged with: arrays
has comment: http://stackoverflow.com/comment/40836477
tagged with: search
tagged with: int
answer count: 2
linked to: http://stackoverflow.com/q/9297899
downvote count: 0
has comment: http://stackoverflow.com/comment/40836695
favorite count: 0
has comment: http://stackoverflow.com/comment/40836444
has body: The assignment is to create a method that finds the second largest even int in an array of ints. I am restricted from using any methods from any libraries. Here is my code that works for all cases: public static int getSecondLargestEven(int[] ary) { int i; aryLength = ary.length; int largestEven = -1; int secondLargestEven = -1; for (i = 0; i &lt; aryLength; i++) { if (ary[i] % 2 == 0) { if (ary[i] &gt; largestEven) { if (largestEven != -1) secondLargestEven = largestEven; largestEven = ary[i]; } else { if (ary[i] != largestEven) { if (secondLargestEven == -1 || ary[i] &gt;= secondLargestEven) { secondLargestEven = ary[i]; } } } } } Prior to calling the methodI require the array to have more than one even else no method call. So, when secondLargestEven == -1, I know there is a duplicate. Is there a more efficient (less use of operators, less loops used, less memory allocation) way to accomplish the objective? How can I improve the logic of my code? How can I improve my code overall? I don't like that I have to assign the magic number -1 to secondLargestEven and largestEven because they are technically named to hold EVENS. Would it be efficient to use a loop to assign a valid even integer in the array to both secondLargestEven and largestEven and THEN proceed to search? Thanks in advance.
has comment: http://stackoverflow.com/comment/40836542
type: UnansweredQuestion
has title: Efficient method to find the second largest even int in an array
has answer: http://stackoverflow.com/a/26065523
score: 1

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/26176562
tags question: http://stackoverflow.com/q/26143942
tags question: http://stackoverflow.com/q/26039280
tags question: http://stackoverflow.com/q/26092932
tags question: http://stackoverflow.com/q/26042354
tags question: http://stackoverflow.com/q/26105254
type: Tag
tags question: http://stackoverflow.com/q/26119794
tags question: http://stackoverflow.com/q/26174551
tags question: http://stackoverflow.com/q/26160407
tags question: http://stackoverflow.com/q/26113553

http://stackoverflow.com/q/26125082
answer count: 1
favorite count: 0
has body: I have a BufferedWriter which is being used to write to a file the users details. I have noticed, however, it is not writing to file in the format I want it to, I can't seem to find a method which allows me to write text on a new line without it writing over what is already there or copy out the text already in the file. Is there any way I can edit the following code, to allow it to the above? Details = "Name: " + name + " CardNo: " + CardNo + " Current Balance: " + balance + " overdraft? " + OverDraft + " OverDraftLimit: " + OverDraftLimit + " pin: " + PinToWrite; try{ //Create writer to write to files. File file = new File(DirToWriteFile); FileOutputStream fos = new FileOutputStream(file, true); Writer bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF8")); // FileReader reads text files in the default encoding. FileReader fileReader = new FileReader("VirtualATM.txt"); // Always wrap FileReader in BufferedReader. BufferedReader bufferedReader = new BufferedReader(fileReader); String currentData = ""; while((currentData=bufferedReader.readLine()) != null) { line = currentData; bw.write(currentData); ((BufferedWriter) bw).newLine(); } bw.write(Details); System.out.println("Account created!"); There is no problem with the program (all variables work properly and have been declared somewhere) I have only posted a snippet of the code which is relevant to the question. The current output to the file after running it a few times looks like this
accepted answer: http://stackoverflow.com/a/26125459
has comment: http://stackoverflow.com/comment/40946193
linked to: http://stackoverflow.com/q/9199216
type: AnsweredQuestion
has title: How can I stop my bufferedWriter from re-writing the text which is already in the file?
tagged with: bufferedwriter
has answer: http://stackoverflow.com/a/26125459
downvote count: 0
score: 1
tagged with: java
tagged with: filewriter
type: Question
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/40946275
upvote count: 1

http://stackoverflow.com/comment/40921252
has text: `targetPosition.width`, I meant width of your `plank`.
comment on: http://stackoverflow.com/q/26087687
score: 0
type: Comment
type: QuestionComment

hadoop
tags question: http://stackoverflow.com/q/26111225
tags question: http://stackoverflow.com/q/26086143
tags question: http://stackoverflow.com/q/26176985
tags question: http://stackoverflow.com/q/26151248
tag name: hadoop
tags question: http://stackoverflow.com/q/26113315
tags question: http://stackoverflow.com/q/26096366
tags question: http://stackoverflow.com/q/26039865
tags question: http://stackoverflow.com/q/26093115
type: Tag
tags question: http://stackoverflow.com/q/26104572
tags question: http://stackoverflow.com/q/26058229
tags question: http://stackoverflow.com/q/26110333
tags question: http://stackoverflow.com/q/26133054
tags question: http://stackoverflow.com/q/26039028
tags question: http://stackoverflow.com/q/26063359
tags question: http://stackoverflow.com/q/26120971
tags question: http://stackoverflow.com/q/26133503
tags question: http://stackoverflow.com/q/26091259
tags question: http://stackoverflow.com/q/26142606
tags question: http://stackoverflow.com/q/26150576
tags question: http://stackoverflow.com/q/26098829
tags question: http://stackoverflow.com/q/26106491
tags question: http://stackoverflow.com/q/26037871
tags question: http://stackoverflow.com/q/26055220
tags question: http://stackoverflow.com/q/26121492
tags question: http://stackoverflow.com/q/26037359
tags question: http://stackoverflow.com/q/26036731
tags question: http://stackoverflow.com/q/26133634
tags question: http://stackoverflow.com/q/26170827
tags question: http://stackoverflow.com/q/26083568
tags question: http://stackoverflow.com/q/26062257
tags question: http://stackoverflow.com/q/26129100
tags question: http://stackoverflow.com/q/26045890
tags question: http://stackoverflow.com/q/26041723
tags question: http://stackoverflow.com/q/26087726
tags question: http://stackoverflow.com/q/26118148
tags question: http://stackoverflow.com/q/26105128
tags question: http://stackoverflow.com/q/26039803
tags question: http://stackoverflow.com/q/26126337
tags question: http://stackoverflow.com/q/26072962

http://stackoverflow.com/a/38311944
answers question: http://stackoverflow.com/q/26092773
score: 16
downvote count: 0
has body: How to Upload a Project to SonarQube: 1) Startup SonarQube. You should be able to see it if you type localhost:9000 into your browser. 2) In command prompt, cd to the directory of your project 3) Make sure the root folder of your project has “sonar-project.properties” file and that it is configured. If your project doesn’t have the “sonar-project.properties” file, it will get this error= Sonar Setup Undefined Mandatory Properties My “sonar-project.properties” file for my VendingMachineEmulator app looks like this: 4) In command prompt, now type “C:\sonar-scanner\sonar-scanner-2.6.1\bin\sonar-scanner.bat”. Alternatively, you could’ve also type “C:\sonar-scanner\sonar-scanner-2.6.1\bin\sonar-runner.bat” too. I’m not sure what the difference is. Make sure the directory you are in is still the main folder of your project. 5) Done! Refresh localhost:9000 and check if the project is there.
upvote count: 16
has comment: http://stackoverflow.com/comment/80949370
type: Answer

http://stackoverflow.com/q/26102738
answer count: 4
has answer: http://stackoverflow.com/a/26102857
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/26113799
type: UnansweredQuestion
upvote count: 1
has title: Is it possible to get text from captcha image with Selenium WebDriver using Java?
has answer: http://stackoverflow.com/a/26102784
type: Question
tagged with: captcha
has body: How can I capture the text from captcha images? Are there any methods? I tried: String attr = driver.findElement(By.xpath("//*[@id='recaptcha_challenge_image']")).getAttribute("value"); System.out.println(attr);
score: 1
tagged with: java
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26104885

http://stackoverflow.com/comment/41026261
has text: The var pix is short for pixels .
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26163493

http://stackoverflow.com/comment/40898059
type: Comment
comment on: http://stackoverflow.com/q/26097213
has text: By customizing and styling the [Tree View](http://docs.oracle.com/javafx/2/ui_controls/tree-view.htm)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41071296
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26192396
type: QuestionComment
has text: It sounds more like your server is reading *uploaded* content, *from* the browser *to* the server. Please clarify.

http://stackoverflow.com/a/50486726
has comment: http://stackoverflow.com/comment/97566273
score: 7
answers question: http://stackoverflow.com/q/26098295
upvote count: 7
has comment: http://stackoverflow.com/comment/99864709
downvote count: 0
has body: I tried the thebradness's answer, but I get a java.lang.reflect.InaccessibleObjectException (Java 10) probably because of the Java Platform Module System. Rather than searching a workaround for making the reflection working, I prefered looking for another way to achieve it. After checking the ScrollPaneSkin internal code, I noticed that the viewport css class is given to the viewRect argument. So I can Node#lookup it via CSS selectors rather than get it via reflection. It's a simplier and more readable solution (and working in JAVA 9+) : public void fixBlurryText(ScrollPane scrollPane) { StackPane stackPane = (StackPane) scrollPane.lookup("ScrollPane .viewport"); stackPane.setCache(false); } Hope it will help someone else.
type: Answer

http://stackoverflow.com/q/26138531
has title: NumberFormatException: For input string
type: Question
upvote count: 0
score: -1
possible better answer: http://stackoverflow.com/a/26138668
tagged with: numberformatexception
answer count: 2
has answer: http://stackoverflow.com/a/26138668
favorite count: 0
has comment: http://stackoverflow.com/comment/40970515
has answer: http://stackoverflow.com/a/26138738
has comment: http://stackoverflow.com/comment/40970970
tagged with: exception
type: AnsweredQuestion
tagged with: java
has body: I'm trying to filter a file searching program by lastModified date, using the Epoch value as a comparisson. When I try to execute this, it gives me the following error: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1408350905359" Apparently the initial value of my variable is empty, and I've been told to make sure to do a validation or an exception to make it not... well, be empty. Thing is, I suck and can't. I'll post the code in which I'm having problems. Can someone help? private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { String direcdate=direc1.getText(); String Phrase = (" Pastas/Ficheiros em: '" + direcdate + " ----- : ' "); File folder = new File(direcdate); File[] listOfFiles=folder.listFiles(); for (File listOfFile : listOfFiles) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); long epoch = System.currentTimeMillis(); String str = ultimaalt.getText(); int q =Integer.valueOf(str); long DIAS = q*86400000; long currentdate; currentdate = epoch - (q*DIAS); String lastmodstr; lastmodstr = valueOf(listOfFile.lastModified()); //NAO CONSIGO METER ESTA MERDA A FUNCIONAR // PRECISO DUM TRY CATCH EXCEPTION // AGORA QUAL? // fml.exe int lastmodint; lastmodint=Integer.valueOf(lastmodstr); if (lastmodint&lt;= currentdate) { if(listOfFile.isFile()) { Phrase = (Phrase + " \n --&gt;" + listOfFile.getName () + " Ultima alteração:" + sdf.format(listOfFile.lastModified()) + ". "); } else if (listOfFile.isDirectory()) { Phrase = (Phrase + " \n --&gt;" + listOfFile.getName() + "(Pasta)" + " Ultima alteração:" + sdf.format(listOfFile.lastModified()) + ". "); } else {} } } jTextPane1.setText(Phrase); // TODO add your handling code here: } EDIT: Fixed! The answer was changing: int lastmodint; lastmodint=Integer.valueOf(lastmodstr); to Long lastmodint; lastmodint=Long.valueOf(lastmodstr); Thanks!
downvote count: 1
accepted answer: http://stackoverflow.com/a/26138738

http://stackoverflow.com/comment/41057049
type: Comment
comment on: http://stackoverflow.com/a/26184855
score: 0
has text: Oh my god thank you so much! Such a simple fix.. I need more coffee.
type: AnswerComment

http://stackoverflow.com/q/26157641
type: Question
has comment: http://stackoverflow.com/comment/41006111
tagged with: mongodb
has comment: http://stackoverflow.com/comment/41007401
linked to: http://stackoverflow.com/q/19745187
score: 0
duplicate of: http://stackoverflow.com/q/16209863
has body: I'm trying to create a rest webservice in Java(Jersey) using Spring and MongoDB. I am however running into an error which I can't seem to fix. My project contains a RESOURCE, SERVICE and REPOSITORY layer. These layers contain 1 interface and 1 Class which implements the interface. I'm running into the following error: ERROR: Oct 02, 2014 10:49:39 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext INFO: Using default applicationContext Oct 02, 2014 10:49:39 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Initiating Jersey application, version 'Jersey: 1.18 11/22/2013 01:21 AM' Oct 02, 2014 10:49:43 AM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container java.lang.NullPointerException at rest.Resource.AircraftResource.findAllAircraft(AircraftResource.java:44) 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.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebA…
linked to: http://stackoverflow.com/q/7414794
answer count: 1
has comment: http://stackoverflow.com/comment/41006504
tagged with: rest
type: UnansweredQuestion
has title: java.lang.NullPointerException on @autowired interface
tagged with: spring
linked to: http://stackoverflow.com/q/16209863
has comment: http://stackoverflow.com/comment/41008914
has comment: http://stackoverflow.com/comment/41006076
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/26159488
linked to: http://stackoverflow.com/q/12762209
has comment: http://stackoverflow.com/comment/41007383

http://stackoverflow.com/comment/41026558
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26165708
score: 1
has text: @vertti More or less our two solutions are equal :D .. Good!, meaning that is a right way :D

http://stackoverflow.com/a/26061322
has body: As RobF said, you can create a shortcut in the Startup directory. You can also create a registry entry, see here.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26061217

http://stackoverflow.com/comment/40837948
type: AnswerComment
comment on: http://stackoverflow.com/a/26065111
type: Comment
score: 3
has text: which will not work if, say, the object is `{"name": "something", "other\"name":"This name has a quote in the middle"}`

http://stackoverflow.com/comment/40958691
type: QuestionComment
type: Comment
has text: Your code does not matter here. How are you compiling ?
comment on: http://stackoverflow.com/q/26131849
score: 0

http://stackoverflow.com/a/26154007
score: 6
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26153986
has body: The loop will stop as soon as i % 321 == 0 is false, which it will be right off the bat. Try: for (int i = 10000; i &lt;= 100000; i++) { if (i % 321 == 0) { println(i); } } Or: for (int i = 10000 + (10000 % 321); i &lt;= 100000; i += 321) { println(i); }
upvote count: 6

http://stackoverflow.com/a/26112720
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has body: If i understand your question correctly then what you want to do is lets say you have 10 columns and this 10 columns need to be passed to 10 test methods respectively as test data, but you want data provider as same. My recommendation: 1) Pass Method argument to your dataprovider. 2) Load whole CSV file into 2D array. 3) Based on test method name that return that column data as test data for that test. Something like below: import java.lang.reflect.Method; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class TestNGTest { @DataProvider public Object[][] dp(Method method) { System.out.println("Test method : "+method.getName()); if(method.getName().equals("test1")) return new Object[][]{{method.getName()}}; else if(method.getName().equals("test2")) return new Object[][]{{method.getName()}}; else return new Object[][]{}; } @Test(dataProvider="dp") public void test1(String name) { System.out.println("DP --&gt;"+name); } @Test(dataProvider="dp") public void test2(String name) { System.out.println("DP --&gt;"+name); } }
accepted answer of: http://stackoverflow.com/q/26110016
answers question: http://stackoverflow.com/q/26110016

http://stackoverflow.com/comment/40780775
comment on: http://stackoverflow.com/q/26034565
has text: How do you sort the Strings?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41626816
type: Comment
type: QuestionComment
has text: @Ano, I arrived the solution based on TDD.
comment on: http://stackoverflow.com/q/26162017
score: 0

http://stackoverflow.com/comment/40844044
comment on: http://stackoverflow.com/a/26068785
score: 0
type: AnswerComment
has text: I think that is something with eclipse and foreign language I just found something about it on this site: http://mcuoneclipse.com/2012/10/31/foreign-characters-for-the-eclipse-build-system/
type: Comment

http://stackoverflow.com/comment/106919073
type: Comment
score: 11
comment on: http://stackoverflow.com/a/60437231
has text: Because there was already one without mentioning to_parquet (as it was released with 0.21.0). Thought this might be useful for someone who requires a python based solution.
type: AnswerComment

http://stackoverflow.com/a/26170936
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26096736
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41150405
has body: I don't see how you can combine both your generic class parameter T and the V in the Callable&lt;V&gt; method argument, for the reasons listed in the answers to the linked post. However, maybe it would be an option - I cannot estimate how counterintuitive that would be, though -- to change the act of submitting a task to a method being invoked on the task itself? Something along the lines of... class A&lt;T extends Comparable&lt;T&gt; &amp; Callable&lt;?&gt;&gt; { public static abstract class Submittable&lt;T extends Submittable&lt;T,V&gt;,V&gt; implements Comparable&lt;T&gt;, Callable&lt;V&gt; { // ugly, but unavoidable @SuppressWarnings("unchecked") public Future&lt;V&gt; submitTo(A&lt;? super T&gt; scheduler) { return (Future&lt;V&gt;) scheduler.submit((T) this); } } // this is just an example of usage of T type List&lt;T&gt; comparables; int compareSomething(T smth) { return comparables.get(0).compareTo(smth); } // *can* be left public, but that way you enforce a single way // of submitting tasks, namely via submitTo private Future&lt;?&gt; submit(T task) { if(compareSomething(task) != 0) throw new RuntimeException(""); // the following cast is a save conversion - you could also write it cast-free // as Callable&lt;?&gt; callable = task; ...submit(callable); return someExecutorService.submit((Callable&lt;?&gt;) task); } } Now, your tasks all have to inherit A.Submittable, and then can be submitted to a scheduler instance via submitTo, returning a Future&lt;V&gt; for the correct type V. Of course, this crucially relies on T in fact being a selftype of the subclasses of Submittable. And what's going on in submitTo is - well, ugly. But it does provide you with the convenience of returning a Future&lt;V&gt; of the correct type.

http://stackoverflow.com/a/26795639
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26073178
has comment: http://stackoverflow.com/comment/73609546
score: 1
answers question: http://stackoverflow.com/q/26073178
upvote count: 1
has body: I also faced similar issue. Explicitly setting context class loader solved the problem // Get current context class loader ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); // Change context classloader to class context loader Thread.currentThread().setContextClassLoader(AzureManagementServiceDelegate.class.getClassLoader)); try { // Call Azure API and reset back the context loader } catch (Exception e) { // handle exceptions } finally { // Reset back class loader Thread.currentThread().setContextClassLoader(contextLoader); }

http://stackoverflow.com/q/26160360
has comment: http://stackoverflow.com/comment/41011397
has comment: http://stackoverflow.com/comment/41011096
has comment: http://stackoverflow.com/comment/41011280
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/26160521
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26160521
has body: I need some suggestions,here is my problem: I have about 800 function names that I need to associate with a list of data couples 'a' and 'b' with 'a' and 'b' between 0 and 10 ,these couples must be generated by a math function. A solution is to create a switch where I implement each function in a case but it's very tiring So I thought of doing such a thing: function_name='A_greater_B' user_input=A>B method getPairList(user_input) foreach(couple of 'a' and 'b') if(user_input) insert_into_pair_list(couple) Insert every conditions is a good compromise for me but I don't know how to implement line 5 in java. Any suggestions? Thanks
type: AnsweredQuestion
tagged with: numbers
tagged with: java
type: Question
has title: Suggestions for an algorithm which requires math functions

http://stackoverflow.com/comment/40809397
has text: I am afraid your interpretation of the .net documentation is wrong. See this [other answer](http://stackoverflow.com/q/19710688/697630).
type: Comment
comment on: http://stackoverflow.com/q/26049196
score: 0
type: QuestionComment

http://stackoverflow.com/q/26191144
has title: Maven - project specific classpath
upvote count: 1
has comment: http://stackoverflow.com/comment/41068715
downvote count: 1
tagged with: classpath
type: Question
score: 0
answer count: 1
tagged with: dependencies
tagged with: log4j
favorite count: 0
has body: I have a maven project which is imported project into my services. The project is a logging facade which uses log4j. The issue is that log4j is a maven dependency which is now on the classpath so the other developers will be tempted to use the log4j log manager rather than the the logging facade that I have created. It there any way I can make the log4j maven import specific to that project?
has comment: http://stackoverflow.com/comment/41068942
type: UnansweredQuestion
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/26191917

http://stackoverflow.com/a/26087797
has comment: http://stackoverflow.com/comment/40881548
has comment: http://stackoverflow.com/comment/40881652
has comment: http://stackoverflow.com/comment/40881109
has body: You forgot some brackets: else if (user.equals("R") || user.equals("r")) { if (comp.equals("S")) System.out.println("Rock beats scissor - you win!"); else if (comp.equals("P")) System.out.println("Paper beats rock - you lose"); } else if (user.equals("P")||user.equals("p")) { if (comp.equals("S")) System.out.println("Scissors beats paper- you lose"); else if (comp.equals("R")|| comp.equals("r")) System.out.println("Paper beats rock - you win"); } else if (user.equals("S")||user.equals("s")) { if (comp.equals("P")) System.out.println("Scissors beats paper - you win!"); else if (comp.equals("R")) System.out.println("Rock beats scissors - you lose!"); }
has comment: http://stackoverflow.com/comment/40878705
score: 0
has comment: http://stackoverflow.com/comment/40881670
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40881504
answers question: http://stackoverflow.com/q/26087634
accepted answer of: http://stackoverflow.com/q/26087634
type: Answer

http://stackoverflow.com/a/32889986
type: Answer
answers question: http://stackoverflow.com/q/26053663
score: 0
has body: If you are automating mobile web apps, then following is the best way to hide keyboard. Map&lt;String, Object&gt; BackspaceKeyEvent = new HashMap&lt;&gt;(); BackspaceKeyEvent.put("key", "67"); ((JavascriptExecutor)driver).executeScript("mobile:key:event", BackspaceKeyEvent);

http://stackoverflow.com/comment/41034917
comment on: http://stackoverflow.com/q/26173012
has text: By the index being within the scope of the array you mean if the index is between 0 and the length of the array or something similar?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40944123
has text: Also there is generally no semicolon after an if statement. You should get a good book or tutorial about Java basics, you have not understood the syntax well yet.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26115989
score: 0

http://stackoverflow.com/q/26131768
type: UnansweredQuestion
has body: I'm working on a program that allows a user to input an x and y. After the user inputs an x and y the program will display the two points as an ordered pair and tell the user what quadrant the point is in, if it's to the left or right of the y-axis and if the point is below or above the x-axis. Some examples of the output would include: Enter x: 3.4 Enter y: -8.2 Point: (3.4, -8.2) The point is below the x-axis. The point is to the right of the y-axis. The point lies in quadrant IV. Enter x: 3 Enter y: 0 Point: (3, 0) The point is on the x-axis. The point is to the right of the y-axis. Enter x: 0 Enter y: 0 Point: (0, 0) The point is on the origin. Here is my code import java.util.Scanner; public class Graph { public static void main( String[] args ) { //declare variables int x; int y; Scanner reader = new Scanner (System.in); // set up scanner to read user inputs // prompt x and y System.out.print ("Enter x:"); x = reader.nextInt(); System.out.print ("Enter y:"); y = reader.nextInt(); //display point System.out.println("\nPoint: ("+x+","+y+")" ); //determine where the point is on a graph if( x &gt; 0 || x &lt; 0 &amp;&amp; y &gt; 0 ) System.out.println( "\nThe point is above the x-axis."); else if ( x &gt; 0 || x &lt; 0 &amp;&amp; y &lt; 0 ) System.out.println( "\nThe point is below the x-axis."); if( x &lt; 0 &amp;&amp; y &gt; 0 &amp;&amp; y &lt; 0 ) System.out.println("\nThe point is to the left of the y-axis."); else if ( x &gt; 0 &amp;&amp; y &gt; 0 &amp;&amp; y &lt; 0) System.out.println("\nThe point is to the right of the y-axis."); else if( x &lt; 0 &amp;&amp; y &lt; 0) System.out.println( "\nThe point is in Quadrant III."); else if(x &lt; 0 &amp;&amp; y &gt; 0) System.out.println("\nThe point is in Quadrant II."); else if ( x &gt; 0 &amp;&amp; y &gt; 0) System.out.println("\nThe point is in Quadrant I."); else if ( x &gt; 0 &amp;&amp; y &lt; 0) System.out.println("\nThe point is in Quadrant IV."); if ( x == 0 &amp;&amp; y == 0) System.out.println( "\nThe po…
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/26131964
has comment: http://stackoverflow.com/comment/40958663
has comment: http://stackoverflow.com/comment/40958759
has answer: http://stackoverflow.com/a/26131890
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/40958581
has title: Questions on my program about a point on a graph
has comment: http://stackoverflow.com/comment/40958640
score: 0
has answer: http://stackoverflow.com/a/26131976

http://stackoverflow.com/a/26060315
has comment: http://stackoverflow.com/comment/40828117
downvote count: 0
has comment: http://stackoverflow.com/comment/40828482
type: Answer
has body: If you put data from hbase shell like put 'test','r1','col:age','19' it will be stored as String-bytes so when you compare it with > on BinaryComparator, it will compare lexicographicly and return any string that starts with character > than '1' you should put it put 'test','r1','col:age','\x13' (hexadecimal value) if you want to put it as integer-bytes
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26039865

http://stackoverflow.com/q/26100116
possible better answer: http://stackoverflow.com/a/26100199
tagged with: java
has title: Tables trouble. I need help to make them
has answer: http://stackoverflow.com/a/26100186
type: Question
has body: I want to make a list going to n numbers depending on user input. I then want to put a second number in each place and print the entire table. As for testing I have tried with a length 4 and numbers 1,2,3,4 but I get a error: ArrayIndexOutOfBounds. I wanted it to print 1,2,3,4. Scanner keyboard = new Scanner (System.in); System.out.println("Whats the length of the table?"); int lengde = keyboard.nextInt(); int[] minTabell = new int[lengde]; for (int i =1; i &lt;= lengde+ 1; i++) { System.out.println((i) + (" give a number")); minTabell[i] = keyboard.nextInt(); } System.out.println(minTabell); keyboard.close();
answer count: 3
accepted answer: http://stackoverflow.com/a/26100186
has answer: http://stackoverflow.com/a/26100253
score: 0
has answer: http://stackoverflow.com/a/26100199
has comment: http://stackoverflow.com/comment/40900787
has comment: http://stackoverflow.com/comment/40900858
type: AnsweredQuestion

http://stackoverflow.com/comment/41000835
comment on: http://stackoverflow.com/a/26154770
score: 1
type: AnswerComment
has text: @Ajk_P before answer something you need to correct other things. You should learn that
type: Comment

http://stackoverflow.com/a/26045796
downvote count: 1
answers question: http://stackoverflow.com/q/26045569
upvote count: 3
has body: Turns out Spring Security adds them by default when using Java configuration. Here is how they can be disabled: @EnableWebSecurity @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http // ... .headers().disable(); } }
has comment: http://stackoverflow.com/comment/59759204
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40840879
has comment: http://stackoverflow.com/comment/82781558
accepted answer of: http://stackoverflow.com/q/26045569
type: AcceptedAnswer

http://stackoverflow.com/q/26042753
tagged with: regex
linked to: http://stackoverflow.com/q/5249779
has comment: http://stackoverflow.com/comment/40813253
has comment: http://stackoverflow.com/comment/40816538
type: UnansweredQuestion
tagged with: extglob
has comment: http://stackoverflow.com/comment/40930493
linked to: http://stackoverflow.com/q/1247772
has comment: http://stackoverflow.com/comment/40846891
has body: I'd like to convert regular expression into glob I was looking on jakarta oro But i can't find method that suits my needs. That it compiles regular expression and returns its glob equivalent They are both Type-3 grammars, so in theory it should be possible. I am unfortunatelly limited by using JDK5.
has comment: http://stackoverflow.com/comment/40831775
has comment: http://stackoverflow.com/comment/40795928
tagged with: java
has comment: http://stackoverflow.com/comment/40814515
has comment: http://stackoverflow.com/comment/40795884
has title: How to convert regex into an extglob expression?
score: 4
has answer: http://stackoverflow.com/a/36636765
has comment: http://stackoverflow.com/comment/40816765
type: Question
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40795821
has comment: http://stackoverflow.com/comment/40943791
favorite count: 0
has comment: http://stackoverflow.com/comment/40796009
has comment: http://stackoverflow.com/comment/40842274

http://stackoverflow.com/q/26175812
has comment: http://stackoverflow.com/comment/41052755
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26232159
tagged with: jooq
tagged with: code-generation
has comment: http://stackoverflow.com/comment/41055319
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41144058
has comment: http://stackoverflow.com/comment/41055538
has body: My project requires me to generate DAOs and POJOs on my own. Have to do certain modifications to it. My SRS says that I have to use jOOQ. I am using it for the first time; I understand that jOOQ generates POJOs and DAOs on its own, but I couldn't find a way to disable it. I could't find anything in jOOQ's documentation that would help me with this. Could someone tell me how to disable jOOQ from generation DAO and POJO but still provide the Records. The Maven pom.xml file is as follows: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.jooq jooq-parent 3.4.1 org.jooq jooq jOOQ Apache License, Version 2.0 http://www.jooq.org/inc/LICENSE.txt repo org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.8.1 generate true false src/main/resources/xsd src/main/resources/xjb jooq-runtime-3.3.0.xsd org.jooq.conf -Xxew -Xxew:instantiate lazy -Xxew:delete -Xfluent-api -Xdefault-value -Xannotate -Xinheritance com.github.jaxb-xew-plugin jaxb-xew-plugin 1.0 org.jvnet.jaxb2_commons jaxb2-fluent-api 3.0 org.jvnet.jaxb2_commons jaxb2-default-value 1.1 org.jvnet.jaxb2_commons jaxb2-basics-annotate 0.6.2 org.jvnet.jaxb2_commons jaxb2-basics 0.5.3 org.apache.felix maven-bundle-plugin 2.1.0 true bundle-manifest process-classes manifest jar ${project.artifactId} * javax.persistence;resolution:=optional, org.apache.log4j;resolution:=optional, * <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy> org.apache.maven.plugins maven-jar-plugin 2.3.2 ${project.build.outputDirectory}/META-INF/MANIFEST.MF release org.apache.maven.plugins maven-gpg-plugin sign-artifacts verify sign log4j log4j 1.2.16 jar provided true org.slf4j integration 1.6.1 jar provided true javax.persistence persistence-api 1.0 jar provided true javax.validation validation-api 1.1.0.Alpha1 jar provided true junit junit 4.…
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/41054532
has comment: http://stackoverflow.com/comment/41054954
has comment: http://stackoverflow.com/comment/41141109
has comment: http://stackoverflow.com/comment/41054285
has title: jOOQ disable DAO and POJO generation
downvote count: 0
tagged with: pojo
type: Question
has answer: http://stackoverflow.com/a/26232159
type: AnsweredQuestion

http://stackoverflow.com/a/26185553
upvote count: 1
answers question: http://stackoverflow.com/q/26185323
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26185323
type: Answer
score: 1
has body: Seems that doesn't change the order: public class TestMap implements Comparable&lt;TestMap&gt; { private static int counter = 0; private int count; public TestMap() { count = counter++; } @Override public String toString() { return count + ""; } @Override public int compareTo(TestMap o) { return count - o.count; } public static void main(String[] args) throws Exception { ConcurrentSkipListMap&lt;TestMap, String&gt; x = new ConcurrentSkipListMap&lt;&gt;(); TestMap a = new TestMap(); TestMap b = new TestMap(); x.put(a, "A"); x.put(b, "B"); System.out.println("Before"); for (Map.Entry&lt;TestMap, String&gt; entry : x.entrySet()) { System.out.println("Key: " + entry.getKey() + " val: " + entry.getValue()); } for (TestMap t : x.keySet()) { if (t.count == 0) { t.count = 5; } } System.out.println("After"); for (Map.Entry&lt;TestMap, String&gt; entry : x.entrySet()) { System.out.println("Key: " + entry.getKey() + " val: " + entry.getValue()); } } } Output: Before Key: 0 val: A Key: 1 val: B After Key: 5 val: A Key: 1 val: B

http://stackoverflow.com/comment/40825957
type: Comment
type: QuestionComment
has text: you said you are receiving "["Bob", "Human"]" . Just do $("#currentPlayer").append(playerNameAndType[0]); $("#playerType").append(playerNameAndType[1]);
comment on: http://stackoverflow.com/q/26059060
score: 0

http://stackoverflow.com/comment/40923944
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26112812
has text: In your AnotherActivity you are calling method `changeText` using instance of your fragmentB where your FragmentB is actually not initialized and without initializing it you are trying access its views thats why its throwing nullpointer error to you.

http://stackoverflow.com/comment/41064111
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26188412
has text: We've not tried compiling with Java 6 and running on Java 7. We're trying Java 6 byte code compiled with Java 7, run on Java 7. You're saying thats unlikely to be a cause? Should we try running that on Java 6 JVM? More importantly, if I understood your comment correctly, can you recommend an article that explains why thats the case?

http://stackoverflow.com/q/26190119
has answer: http://stackoverflow.com/a/26190260
score: 0
tagged with: java
tagged with: jtextfield
has answer: http://stackoverflow.com/a/26190223
type: Question
answer count: 2
has title: JTextField to Properties file
tagged with: fileinputstream
has body: I am trying to append the input in a Jtextfield into a test properties config file I have setup. However, I am receive the NullPointerException every time I try to append the text. I've read that Properties API doesn't allow adding/remove/editing so I also tried BufferedWriter but it doesn't work either. If anyone know a way to do this I would be very grateful. Appending text via JButton: if (userField.getText().toString().equals("")) { lblNullUser.setVisible(true); } else { lblNullUser.setVisible(false); } if(!chckbxRememberUser.isSelected()) { //To do: go to Lynx } else { String user = userField.getText(); c.prop.setProperty("user", user); //null on this line; problem might be the key but not sure how to fix try { c.prop.store(c.outputSteam, null); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } Configuration class: public String Config() throws IOException{ String result = ""; prop = new Properties(); propFileName = "config.properties"; inputStream = getClass().getClassLoader().getResourceAsStream(propFileName); outputSteam = new FileOutputStream("config.properties"); prop.load(inputStream); if (inputStream == null) { throw new FileNotFoundException("Config file '" + propFileName + "' not found."); } //Date time = new Date(System.currentTimeMillis()); return result; }
tagged with: properties
tagged with: append
has comment: http://stackoverflow.com/comment/41066848
type: UnansweredQuestion

http://stackoverflow.com/q/26089386
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40882685
tagged with: rserve
has comment: http://stackoverflow.com/comment/40881594
has body: I'm trying to use R within Java, specifically within Processing. I want to use the readPNG function, but when I try to, R displays an error readPNG function can't be found. This is extremely weird because I have the png library active and if I try to use it directly from R this workouts just fine. I'm using the Rservepackage to connect java and R. Any advise would be very much appriciated. Here's part of the code I'm using if it helps. import org.rosuda.REngine.Rserve.*; import org.rosuda.REngine.*; double[] data; void setup() { size(300,300); try { RConnection c = new RConnection(); // generate 100 normal distributed random numbers and then sort them data= c.eval("readPNG('juego-11932.png')").asDoubles(); } catch ( REXPMismatchException rme ) { rme.printStackTrace(); } catch ( REngineException ree ) { ree.printStackTrace(); } } void draw() { background(255); for( int i = 0; i &lt; data.length; i++) { line( i * 3.0, height/2, i* 3.0, height/2 - (float)data[i] * 50 ); } }
has comment: http://stackoverflow.com/comment/40884514
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40881939
has title: Can't find certain function when calling R within java
type: Question
has answer: http://stackoverflow.com/a/28842673
accepted answer: http://stackoverflow.com/a/28842673
tagged with: processing
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/comment/41074450
score: 2
comment on: http://stackoverflow.com/q/26193256
has text: A small runnable example, will be highly appreciated, to know the cause of the problem. If possible :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41047768
comment on: http://stackoverflow.com/a/26164609
score: 0
type: AnswerComment
has text: @M Sweet. I missed that one. Thanks!
type: Comment

http://stackoverflow.com/a/26174806
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/41108555
downvote count: 0
has body: I assume you are using TreeViewer. You can use a StyledCellLabelProvider to set different styles for parts of the label string. The DelegatingStyledCellLabelProvider class is derived from this class to make things a bit easier. Set up the label provider using: viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(myLabelProvider)); where myLabelProvider is a class implementing DelegatingStyledCellLabelProvider.IStyledLabelProvider. The provider has a getImage method as usual plus: public StyledString getStyledText(Object element) which uses a StyledString which allows you to apply different styles to the text. Something like: StyledString text = new StyledString(); text.append("unstyled text"); text.append("styled text with decorations style", StyledString.DECORATIONS_STYLER); as well as the predefined StyledString.Styler values you can define your own. The DefaultStyler class lets you use colors defined in the JFace color registry. A simple version of a styler to set the background to yellow would be: class HighlightStyler extends Styler { @Override public void applyStyles(final TextStyle textStyle) { textStyle.background = Display.getDefault().getSystemColor(SWT.COLOR_YELLOW); } }
has comment: http://stackoverflow.com/comment/41108449
has comment: http://stackoverflow.com/comment/41108609
answers question: http://stackoverflow.com/q/26173834
type: Answer

http://stackoverflow.com/a/26117655
upvote count: 3
answers question: http://stackoverflow.com/q/26117511
type: Answer
score: 3
downvote count: 0
has body: Based on a previous answer, the path to external SD card actually varies with different device manufactures. "Environment.getExternalStorageDirectory() refers to whatever the device manufacturer considered to be "external storage". On some devices, this is removable media, like an SD card. On some devices, this is a portion of on-device flash. Here, "external storage" means "the stuff accessible via USB Mass Storage mode when mounted on a host machine", at least for Android 1.x and 2.x. But the question is about external SD. How to get a path like "/mnt/sdcard/external_sd" (it may differ from device to device)? Android has no concept of "external SD", aside from external storage, as described above. If a device manufacturer has elected to have external storage be on-board flash and also has an SD card, you will need to contact that manufacturer to determine whether or not you can use the SD card (not guaranteed) and what the rules are for using it, such as what path to use for it." Based on this answer. So, There is no absolute way to get this path via code.

http://stackoverflow.com/a/26193395
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26192832
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42027074
has comment: http://stackoverflow.com/comment/42026766
has comment: http://stackoverflow.com/comment/41072568
has comment: http://stackoverflow.com/comment/41072592
has body: Never use impl_ methods: these are not part of the public API. To convert an awt Image to an FX Image, the SwingFXUtils class in javafx.embed.swing has a toFXImage(...) method that converts a BufferedImage to a JavaFX Image. It's not clear whether the image you have from the icon is a BufferedImage, so you'll need a couple of steps to make that work: BufferedImage bImg ; if (awtImage instanceof BufferedImage) { bImg = (BufferedImage) awtImage ; } else { bImg = new BufferedImage(awtImage.getWidth(null), awtImage.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = bImg.createGraphics(); graphics.drawImage(awtImage, 0, 0, null); graphics.dispose(); } Image fxImage = SwingFXUtils.toFXImage(bImg, null); This is a fairly inefficient approach, as you are first creating an awt image from your file, then converting it to an FX image, possibly via an intermediate buffered image. If you have access to the source code for the ShellFolder class, you might see how that implements the getIcon() method and follow the same process. At some point, it must get an InputStream with the image data; once you have that you can pass it to the javafx.scene.image.Image constructor.
upvote count: 5
answers question: http://stackoverflow.com/q/26192832

http://stackoverflow.com/a/26145646
type: AcceptedAnswer
has body: The first error means that Eclipse has crashed. This can leave the workspace in a corrupt state. If nothing else works, try to create a new workspace or use these instructions to clean it. The second error means that you refer to facelet-taglib_1_0.dtd in one of your files and Eclipse can't find it. Try to add the file to your project. Eclipse might hang here because it tries to download the file from the Internet and that doesn't work for some reason (firewall, missing proxy server, etc).
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26143821
answers question: http://stackoverflow.com/q/26143821

http://stackoverflow.com/a/26093026
has comment: http://stackoverflow.com/comment/40888472
answers question: http://stackoverflow.com/q/26092711
has body: Please see jolokia framework(http://www.jolokia.org/), it is remote JMX with JSON over HTTP.It's very easy using.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41585835

http://stackoverflow.com/comment/40871554
score: 1
comment on: http://stackoverflow.com/q/26083994
type: QuestionComment
has text: @Joe-Welcome, a cup of coffee would surely help you .:)
type: Comment

http://stackoverflow.com/comment/40933229
type: QuestionComment
comment on: http://stackoverflow.com/q/26117982
has text: Such examples are available on net and what your asking is the logic which is irrelevent.
score: 0
type: Comment

http://stackoverflow.com/q/26090774
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26092190
has comment: http://stackoverflow.com/comment/40888238
tagged with: text
tagged with: java
tagged with: file
type: Question
has body: I seem to be having a problem with this code. The purpose is to find out the average number of tries it takes to roll a 1 on a 5 sided die. I think I have the math right; I just can't get the while loop that reads the text file to work. import java.io.IOException; import java.io.PrintWriter; import java.io.File; import java.util.Random; import java.util.Scanner; public class BottleCapPrize { public static void main (String[] args) throws IOException { Random randy = new Random(); PrintWriter outFile = new PrintWriter(new File("boost.txt")); Scanner inFile = new Scanner(new File("boost.txt")); Scanner in = new Scanner(System.in); int trials; int tries = 6; int winCap = 6; int token = 0; double average; int total = 0; System.out.print("Please enter the number of trials: "); trials = in.nextInt(); for (int loop = 1; loop &lt;= trials; loop++) { winCap = 6; tries = 0; while (winCap != 0) { tries++; winCap = randy.nextInt(5); } outFile.println(tries); System.out.println(tries); } while (inFile.hasNext()) { token = inFile.nextInt(); total = total + token; } average = (double)total/(double)trials; System.out.println("Average : " + average); outFile.close(); inFile.close(); in.close(); } }
has title: Having trouble with reading text files
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40884649
has answer: http://stackoverflow.com/a/26092924

http://stackoverflow.com/a/26170237
accepted answer of: http://stackoverflow.com/q/26157741
has comment: http://stackoverflow.com/comment/41041242
answers question: http://stackoverflow.com/q/26157741
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41030921
has body: This is a little difficult to explain, so I will try to keep it simple. First of all you need to have in mind the the list of TraineeStatus is not going to be retrieved in the same request has the contact/trainees list, you will need a separate HTTP request to get that list. The same way you have ContactRepository to get all the Trainees records, you will need a TraineeStatusRepository to get all the TraineeStatus records. Then, on one of your Services you would need a method to get the TraineeStatus list, like this: private List&lt;TraineeStatus&gt; findAllTraineeStatus() { return traineeStatusRepository.findAll(); } After that you will need to define an HTTP API to access that list (i.e. GET http://example.com/traineeStatus). The idea is probably the same you have to retrieve the ContactList. Then, on your AngularJS app, you would need to use a function to load the list of TraineeStatus. For example: $scope.getTraineeStatus = function () { // assuming the HTTP API is: GET http://example.com/traineeStatus $http.get('http://example.com/traineeStatus', config) .success(function (data) { $scope.traineeStatus = data; }) .error(function (err) { // handle error }); } And then loop through the $scope.traineeStatus property on the ng-repeat: &lt;select required ng-model="contact.traineestatus" name="traineestatus.id" placeholder="&lt;spring:message code='sample.status'/&gt; "&gt; &lt;option ng-repeat="status in traineeStatus" value="{{status.id}}"&gt;{{status.value}}&lt;/option&gt; &lt;/select&gt;
upvote count: 2

http://stackoverflow.com/comment/40894117
has text: Or write a Listener, have a look at [this tutorial](http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html)
comment on: http://stackoverflow.com/q/26095954
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40839244
type: QuestionComment
has text: Oh wait I see what I did. When I had the previous error I had it list.get(k+1) = list.get(k). My mistake.
score: 1
comment on: http://stackoverflow.com/q/26066186
type: Comment

http://stackoverflow.com/comment/40840303
has text: as i see you havent understand the first post , have you created an appcontext in order to bind the controllers at they start up??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26059034
type: Comment

easymock
tags question: http://stackoverflow.com/q/26044120
tags question: http://stackoverflow.com/q/26120956
tag name: easymock
tags question: http://stackoverflow.com/q/26123399
type: Tag

http://stackoverflow.com/comment/41060694
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26186711
has text: see http://stackoverflow.com/a/26186740/1085186 correct ans !

http://stackoverflow.com/a/26140689
type: AcceptedAnswer
downvote count: 0
has body: I finally found it! To run the 32bit Java I need to install the 32bit libs (ia32-libs) for Ubuntu like this: sudo -i cd /etc/apt/sources.list.d echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" &gt;ia32-libs-raring.list apt-get update apt-get install ia32-libs this come from here now i can run java -version and i get the expected response thx for your help anyway
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26121087
answers question: http://stackoverflow.com/q/26121087

http://stackoverflow.com/a/26120909
upvote count: 2
answers question: http://stackoverflow.com/q/26102635
score: 2
has body: There probably isn't a simple way to do this since the whole point of the EJB design is that you don't care about such things. The first error inside of a transaction makes it invalid -> rollback. That's the rule. If you want something special, then get yourself a database connection from the session and use plain SQL instead of EJB to modify the data. That way, you can try to INSERT a new instance and handle all exceptions yourself. When the insert succeeds, you can use EJB to load the newly created object to add it to the session. That said, I'm not sure what you're trying to achieve with the code above. Just ignoring when you can't create a new instance in the database feels like "I don't care about quality of my product." Maybe your attempt to work around an error is just a symptom of a bad design of your application. Take a step back and consider what you're doing and why. Maybe if you told us more about the reasons why you want to ignore all errors (even the really, really deadly ones), we would be able to point out a better solution. EDIT So you get javax.persistence.EntityExistsException which means you tried to save the same entity twice. That can mean any number of things: You loaded the bean in a different session and now you try to save it in a second one. Since the new session can't know if the bean exists, it tries to create it again. Instead of loading the bean from the session like you should, you cheated and create a new instance manually. Of course, the session manager now thinks this is a new bean. The correct solution depends on what you need to achieve. If you modified myEntity and need to save the changes, use em.merge(). The EM will then check if the object already exists and if it does, it will do an SQL UPDATE instead of an INSERT If you just want to give some other class a valid entity, then you need to get it from the database. If the database returns null, you need to create a new instance and persist it and then return it. See also: JPA …
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26102635

http://stackoverflow.com/comment/41042286
type: AnswerComment
comment on: http://stackoverflow.com/a/26176903
type: Comment
has text: Didn't think about field access because I often found the variable declared as private. But your consideration is correct
score: 1

http://stackoverflow.com/comment/40933731
type: QuestionComment
has text: Thank you Gyro. I have considered something like this myself and will probably go down this route.
type: Comment
comment on: http://stackoverflow.com/q/26116748
score: 0

http://stackoverflow.com/comment/40873462
type: Comment
comment on: http://stackoverflow.com/a/26085010
type: AnswerComment
has text: Is there anyway I could decouple this from Gson?
score: 0

http://stackoverflow.com/comment/41061808
comment on: http://stackoverflow.com/q/26187046
type: QuestionComment
has text: @chiastic-security It's not obvious to me, which is why I asked. There's a rather large difference in my mind between `list.add("a");` and `list.add("\"a\"");` for instance. Without clarification from the OP, I cannot guess exactly what the input is or how it ought to be parsed.
score: 0
type: Comment

http://stackoverflow.com/comment/40796101
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26042866
has text: yes, and to add - if possible do not use List<Object> create an interface for getters use List<MyInterface>

http://stackoverflow.com/a/26171440
accepted answer of: http://stackoverflow.com/q/26171427
score: 1
downvote count: 1
has body: Just use generics for the declaration of foo: Map&lt;Character,Integer&gt; foo = new HashMap&lt;Character,Integer&gt;(); Then, foo.keySet() will have the correct generic type Set&lt;Character&gt;, fixing the problem.
answers question: http://stackoverflow.com/q/26171427
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/comment/40980603
type: Comment
has text: it is not going through each of the if statements. Any Ideas
score: 0
comment on: http://stackoverflow.com/q/26143959
type: QuestionComment

http://stackoverflow.com/comment/41053622
type: Comment
type: QuestionComment
score: 2
has text: @user3203455: "the value is coming from a textfield" doesn't explain why you're using `float` instead of either `double` or `BigDecimal`.
comment on: http://stackoverflow.com/q/26182982

http://stackoverflow.com/comment/41361160
has text: Fair enough - if you decide that you only want to use Digester for "configuration" files then no worries. Myself, I use the tools that make my job easiest, regardless of what they may or may not have been originally intended for, and frequently use Digester for all kinds of XML -> Java mappings. And I think Digester is perfect for this use case, as shown by the simplicity of the solution.
comment on: http://stackoverflow.com/a/26125411
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40806669
type: AnswerComment
comment on: http://stackoverflow.com/a/26048412
has text: Perfect!. Thankyou so much. I noticed the .post method which I found runs in the UI Thread. Cheers.
type: Comment
score: 0

http://stackoverflow.com/q/26149410
has body: I'm sending data to an API from Java using POST. What I'm trying to do is send a particular variable to the API in the POST request, and then use the value of it. But currently the value is empty. The API is definitely being called. My Java looks like this: String line; StringBuffer jsonString = new StringBuffer(); try { URL url = new URL("https://www.x.com/api.php"); String payload = "{\"variable1\":\"value1\",\"variable2\":\"value2\"}"; HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF-8"); writer.write(payload); writer.close(); BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); while ((line = br.readLine()) != null) { jsonString.append(line); } br.close(); connection.disconnect(); } This is based on: How to send Request payload to REST API in java? Currently the value isn't being read correctly. Am I sending it correctly in Java? Do I have to do something to decode it?
has answer: http://stackoverflow.com/a/26149725
has title: How to decode JSON from Java REST API request?
has answer: http://stackoverflow.com/a/26149681
tagged with: rest
answer count: 2
tagged with: api
linked to: http://stackoverflow.com/q/15570656
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/26190252
tagged with: dbunit
has body: I am unit testing my JPA entity beans using DbUnit framework. I have generated entities from DB tables. And also exported DB data into xml files which DbUnit can use while executing tests. But for every test I receive error as: Caused by: org.hsqldb.HsqlException: integrity constraint violation: unique constraint or index violation; UK_25T4P9GXGVRCC8R3VL93JKAJE table: NEW_TAB at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.Constraint.getException(Unknown Source) at org.hsqldb.index.IndexAVLMemory.insert(Unknown Source) at org.hsqldb.persist.RowStoreAVL.indexRow(Unknown Source) at org.hsqldb.TransactionManager2PL.addInsertAction(Unknown Source) at org.hsqldb.Session.addInsertAction(Unknown Source) at org.hsqldb.Table.insertSingleRow(Unknown Source) at org.hsqldb.StatementDML.insertSingleRow(Unknown Source) at org.hsqldb.StatementInsert.getResult(Unknown Source) at org.hsqldb.StatementDMQL.execute(Unknown Source) at org.hsqldb.Session.executeCompiledStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) My test persistence.xml is as: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence com.dummy.entity.NewTab <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:UNITTEST"/> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value=""/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> Every testcase is executed using: try { final DatabaseConnection connection = new DatabaseConnection(jdbcConnection); //connection.getConnection().prepareStatement("SET DATABASE REFERENTIAL INTEGRITY FALSE").execute(); final DatabaseConfig config = connection.getConfig(); // config.setProperty(FEA…
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: jpa
has title: DbUnit + HSQLDB + JPA Entity: integrity constraint violation: unique constraint or index violation; UK_25T4P9GXGVRCC8R3VL93JKAJE table: NEW_TAB
has comment: http://stackoverflow.com/comment/41067516
has answer: http://stackoverflow.com/a/26193366
has comment: http://stackoverflow.com/comment/41103224
answer count: 1
tagged with: hsqldb
favorite count: 0
type: UnansweredQuestion
tagged with: unique-constraint

http://stackoverflow.com/q/26151190
has comment: http://stackoverflow.com/comment/40994449
tagged with: loops
has comment: http://stackoverflow.com/comment/40994427
type: Question
tagged with: java
score: -1
downvote count: 2
has title: How do I update the integer while the loop is running?
answer count: 3
has comment: http://stackoverflow.com/comment/40994643
upvote count: 1
has answer: http://stackoverflow.com/a/26151287
has answer: http://stackoverflow.com/a/26151702
favorite count: 0
has body: When we enter 0 in the program it is supposed to stop running the loop and print the average of the numbers. When I run the program and initially enter 0, the program exits. If I enter in an integer that is not zero first, and then enter 0, the program keeps running and I can't quit.I figure that the integer value needs to update when the user enters a new value for the program to quit, and the sum to be correct. How do I update the integer value while the loop is running? I should change or add something in the loop I'm guessing. import java.util.Scanner; public class Exercise05_01 { public static void main(String[] args){ float negCount = 0; float sum = 0; float posCount = 0; Scanner input = new Scanner(System.in); System.out.println("Enter a positive or negative integer. Entering 0 ends program"); int integer = input.nextInt(); while (integer != 0) { if (integer &gt; 0) { posCount = +1; sum = +integer; } if (integer &lt; 0) { negCount = +1; sum = +integer; } float count = negCount + posCount; if (integer == 0) { System.out.println("The answer"); } } } }
tagged with: while-loop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26151787

http://stackoverflow.com/comment/40916627
score: 0
type: Comment
type: QuestionComment
has text: I am using Netbeans 8.0 and I tried debugging it....it was not entering the loop....
comment on: http://stackoverflow.com/q/26094626

http://stackoverflow.com/q/26092098
answer count: 2
has answer: http://stackoverflow.com/a/26094107
score: 0
tagged with: java
tagged with: wordpress
has answer: http://stackoverflow.com/a/26092668
has title: While loop using Nested if functions/statement
has body: import javax.Swing.JOPtionPane; public class while looping { public static void main (String []args){ String a= JOptionPane.ShowInputDialog("Please enter an Integer"); int b=Integer.parseInt(a); int j=1; while(j&lt;=b){ j++; int k=1; while (k&lt;j){ System.out.print("*"); k++; } System.out.println(); } } } } This is my program and when i run it it says that javac: invalid flag: while what does it mean?
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/26126773
has comment: http://stackoverflow.com/comment/40950330
has comment: http://stackoverflow.com/comment/40950663
has comment: http://stackoverflow.com/comment/40949164
score: 0
has comment: http://stackoverflow.com/comment/40949288
type: Answer
has comment: http://stackoverflow.com/comment/40949583
has body: you can use Spring Security and create a custom AuthenticationProvider . You can use a JNDI lookup to get the authservice directly from the Container it self. Example: @Component public class CustomAuthenticationProvider implements AuthenticationProvider { @Autowired private AuthService authService; public Authentication authenticate(Authentication authentication) throws AuthenticationException { String name = authentication.getName(); String password = authentication.getCredentials().toString(); // use the credentials to try to authenticate against the third party system if (authService(name, password)) { List&lt;GrantedAuthority&gt; grantedAuths = new ArrayList&lt;&gt;(); return new UsernamePasswordAuthenticationToken(name, password, grantedAuths); } else { throw new AuthenticationException("Unable to auth against third party systems"); } } @Override public boolean supports(Class&lt;?&gt; authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } Also, read more about RESTful apis using Spring here: http://www.baeldung.com/rest-with-spring-series/
answers question: http://stackoverflow.com/q/26126413

http://stackoverflow.com/comment/41058143
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26185452
has text: `Character.getNumericValue('?')` != casting.
score: 0

http://stackoverflow.com/q/26097597
favorite count: 0
has comment: http://stackoverflow.com/comment/40909857
has comment: http://stackoverflow.com/comment/40896659
tagged with: multithreading
type: AnsweredQuestion
has body: I have a Util class with a utility methods as: public static String formatAmount(String amount) throws Exception { return String.format("%,.2f", Double.valueOf(amount)); } Is this method thread safe? I am not modifying amount any where else. Secondly, I have another method as. private boolean checkIfDateIsAHoliday(org.joda.time.LocalDate date) { boolean isHoliday = false; ....... return isHoliday; } Is this method thread safe? I am not modifying date any where else.
has answer: http://stackoverflow.com/a/26098462
tagged with: java
has answer: http://stackoverflow.com/a/26099086
accepted answer: http://stackoverflow.com/a/26099086
type: Question
has title: Is my static util method thread safe
upvote count: 1
has answer: http://stackoverflow.com/a/26097656
score: 0
possible better answer: http://stackoverflow.com/a/26097656
has answer: http://stackoverflow.com/a/26097670
has comment: http://stackoverflow.com/comment/40896403
downvote count: 1
answer count: 4

http://stackoverflow.com/comment/40972245
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26139476
has text: If args[0] is a 'Student' and you modify something in the `Student` then the student changes, yes, and since the student you pass in to 'change' is the same student instance as the one in `args[0]` then yes, `args[0]` will reflect the same change. Technically you are not making changes in `args` then, but in some value that happens to be stored in `args`
score: 0

http://stackoverflow.com/comment/41001085
comment on: http://stackoverflow.com/a/26154856
score: 0
type: AnswerComment
has text: @rents Yes, the class definition (including method names) is part of the bytecode. (Note that most of what is in a .class file will look like gibberish when opened with a normal text editor.)
type: Comment

http://stackoverflow.com/a/26047089
answers question: http://stackoverflow.com/q/26047024
score: 0
has body: Use String formattedInput = rawInput.replaceAll( ",", "") and then parse the formattedInput string
type: Answer

http://stackoverflow.com/q/26085892
type: Question
has title: Java Servlet nullPointerException login logout sessions
score: -1
has answer: http://stackoverflow.com/a/26085957
has comment: http://stackoverflow.com/comment/40875062
tagged with: servlets
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40876904
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40875004
has comment: http://stackoverflow.com/comment/40875041
has body: Hi I'm new to Servlets probably easy question. After I've passed the data into forms and click on the submit button I get java.lang.NullPointerException LogOut.doPost(LogOut.java:45) any ideas how to pass through this exception? Code doGet: protected void doGet(HttpServletRequest request, HttpServletResponse response) { PrintWriter out = response.getWriter(); response.setContentType("text/html"); HttpSession session = request.getSession(false); out.println("&lt;form method='post' action='LogOut'&gt;" + "usr &lt;input type='text' id='username'/&gt;" + "pass &lt;input type='password'id='password'/&gt;" + "&lt;input type='submit' value='Login'&gt;&lt;/form&gt;"); //If the username and password is correct if (session != null) { String username = (String) session.getAttribute("username"); out.println("Hi " + username + "sessioon is started with id " + session.getId()); out.println("&lt;a id='logout' value='Logout' /&gt;"); } } code doPost protected void doPost(HttpServletRequest request, HttpServletResponse response) { PrintWriter out = response.getWriter(); String username = request.getParameter("username"); String password = request.getParameter("password"); response.setContentType("text/html"); if (username.equals("usr") &amp;&amp; password.equals("pass")) { //line 45 HttpSession sess = request.getSession(); sess.setAttribute("username", username); } else { out.println("Wrong input data"); } }
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/40914617
has text: The following should help: http://blog.bdoughan.com/2010/08/jaxb-namespaces.html
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26107483

http://stackoverflow.com/q/26144609
has answer: http://stackoverflow.com/a/26145040
has answer: http://stackoverflow.com/a/26144717
type: Question
has title: How can I optimize generating random numbers between 0 and 133300 until a defined target is reached?
answer count: 2
has comment: http://stackoverflow.com/comment/40981835
has comment: http://stackoverflow.com/comment/40982020
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/26144717
has comment: http://stackoverflow.com/comment/40982017
accepted answer: http://stackoverflow.com/a/26145040
has body: import java.util.Random; public class FindInt{ public static void main(String[] args){ int guess = 49; int trys = 0; Random r = new Random(); while(r.nextInt(133300) != guess){ trys = trys + 1; } System.out.println(guess + " has been found in random after " + trys + " trys!"); } } Is there a more efficient way to write this, or is my usage of a while loop correct? Any additional suggestions to optimize this code would be appreciated.
favorite count: 0
downvote count: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40965117
score: 1
type: AnswerComment
type: Comment
has text: Thank you willie, but this will disable weblogic basic auth for all the other applications as well deployed in the same container.
comment on: http://stackoverflow.com/a/26134062

video
tags question: http://stackoverflow.com/q/26160395
tags question: http://stackoverflow.com/q/26068678
type: Tag
tags question: http://stackoverflow.com/q/26131725
tags question: http://stackoverflow.com/q/26101463
tags question: http://stackoverflow.com/q/26127098
tags question: http://stackoverflow.com/q/26053011
tag name: video
tags question: http://stackoverflow.com/q/26148071

http://stackoverflow.com/comment/40870991
score: 0
type: Comment
type: QuestionComment
has text: Possible Duplicate:http://stackoverflow.com/questions/8150535/intellij-idea-indexed-maven-repositories-list-how-to-add-remote-maven-repos
comment on: http://stackoverflow.com/q/26083708

http://stackoverflow.com/q/26152259
accepted answer: http://stackoverflow.com/a/26154921
tagged with: java
has answer: http://stackoverflow.com/a/30386245
type: Question
answer count: 2
score: 5
tagged with: android
has body: I tried to run the example of libvlc.I compiled the vlc to android and copy the sdk library to the project as they wrote. https://bitbucket.org/edwardcw/libvlc-android-sample and I recive this error 1236-1236/com.compdigitec.libvlcandroidsample E/VLC/LibVLC﹕ Can't load vlcjni library: java.lang.UnsatisfiedLinkError: Couldn't load vlcjni from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.compdigitec.libvlcandroidsample-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.compdigitec.libvlcandroidsample-1, /system/lib]]]: findLibrary returned null in this lines their is the problem try { System.loadLibrary("vlcjni"); } catch (UnsatisfiedLinkError ule) { Log.e(TAG, "Can't load vlcjni library: " + ule); /// FIXME Alert user System.exit(1); } under libs/armeabi-v7a I have those files gdb.setup gbdserver libiomx-hc.so libiomx-gingerbread.so libiomx-ics.so libvlcjni.so I think that the .so files dont loaded. How can I fix this? I checked in the apk files and their is no dic libs. or any of libvlc files.. this is my build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.compdigitec.libvlcandroidsample" minSdkVersion 7 targetSdkVersion 17 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } debug { } } } dependencies { compile 'com.android.support:support-v4:18.0.0' } Thanks
favorite count: 0
upvote count: 5
downvote count: 0
possible better answer: http://stackoverflow.com/a/30386245
has title: LibVlc android cant load libs
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26154921
tagged with: libvlc

http://stackoverflow.com/q/26140338
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has title: sharing data between c++/c and Java
has comment: http://stackoverflow.com/comment/41038745
has answer: http://stackoverflow.com/a/26140568
has body: I am working with a c process that reads an ambient sensor via stream, each second it reads 1000 samples about light,Temperature and sound of the surrounding ambient, now I would like to read this data by means of a java program I know there are solutions such as share memory but I'm looking for some good tutorial, guide, example that can help me to achieve my task.
has comment: http://stackoverflow.com/comment/41036677
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40973661
tagged with: java
has comment: http://stackoverflow.com/comment/40974161
type: Question
tagged with: http://stackoverflow.com/tag/c
tagged with: data-sharing

http://stackoverflow.com/comment/40990682
type: AnswerComment
has text: Good idea, it creates it on C:\src\SavedGames - there is no such directory.
type: Comment
comment on: http://stackoverflow.com/a/26149167
score: 0

http://stackoverflow.com/comment/40977891
type: Comment
has text: In that case, you have to change count to (count+1) as you are starting from x^2/2!. Also, you are printing Math.exp(power) instead of Math.exp(x) in your main function.
type: AnswerComment
comment on: http://stackoverflow.com/a/26141450
score: 0

http://stackoverflow.com/comment/40972833
type: QuestionComment
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).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26139856

http://stackoverflow.com/comment/40948877
comment on: http://stackoverflow.com/q/26126423
has text: ..."*created a for loop for it but got stuck*"..."*I want to have multiple smaller arrays that are subarrays of carryOutput*"..."*is there a way that I can avoid breaking into many arrays*"..."*running MATLAB code...trying to translate it to JAVA*" It's hard to tell what you are exactly asking.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26146925
score: 0
has answer: http://stackoverflow.com/a/30554653
has comment: http://stackoverflow.com/comment/40986896
has comment: http://stackoverflow.com/comment/40986272
tagged with: string
has comment: http://stackoverflow.com/comment/40987083
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40986265
has answer: http://stackoverflow.com/a/26147225
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/26147029
type: Question
tagged with: alphabetical
has body: So I need to figure out how to find the letter that appears first in the alphabet in a string. So far I have this: import java.util.Scanner; public class alphStr { public static void main(String[] args) { System.out.println("Please enter a word - "); Scanner in = new Scanner(System.in); String word = in.nextLine(); System.out.println("The word you entered was: " + word); } } I think I can compare letters within the string by using "> || &lt;" but i'm unsure how to go about doing this. Any advice would be great! Ended up with this solution after some reading, thanks for the help everyone. import java.util.Scanner; import java.util.Arrays; public class alphStr { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter a word: "); String word = input.next(); char[] chars = word.toCharArray(); Arrays.sort(chars); String sorted = new String(chars); char x = sorted.charAt(0); System.out.println("Alphabetically, the first letter in your word is: " + x); } }
tagged with: sorting
has title: How to find the first letter (alphabetically) in a string?
has answer: http://stackoverflow.com/a/26147160
upvote count: 2

http://stackoverflow.com/comment/41033425
type: Comment
comment on: http://stackoverflow.com/q/26168369
score: 0
type: QuestionComment
has text: @MadProgrammer Yea, everything in the src gets copied to the `bin`, and that's where all the classes are compiled to when you run. Just like netbeans temporarily copies everything and compiles to the `build`

nexus
tags question: http://stackoverflow.com/q/26119169
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/26178442

http://stackoverflow.com/a/26082981
has comment: http://stackoverflow.com/comment/40918389
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26082804
downvote count: 0
upvote count: 1
has body: Setting your maximum idle instances to 1 will force it to collect all but 1 of the idle instances. The problem may be that it appears all the requests are going to the first 'dynamic' instance, the 'resident' instance is idle and therefore there is 1 'idle-dynamic' instance. That strikes me as the likely logic that is producing the observed effects.
has comment: http://stackoverflow.com/comment/40871967

http://stackoverflow.com/q/26156427
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9252354
downvote count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26156527
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: How to change Up button Android ActionBar?
accepted answer: http://stackoverflow.com/a/26156527
has body: I searched many solutions and implemented solution of Jake Wharton My style.xml code is but still my Actionbar up button is default what i have to do now? i also replaced Vaues-v11 style also.. My Min SDK is 15 Max 19 in Manifest

http://stackoverflow.com/comment/40891952
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26094941
type: Comment
has text: Thanks for your answer, unfortunately, downloading a tutorial is exactly what I'm trying to do... but my eclipse doesn't match the tutorial.

http://stackoverflow.com/q/26148664
duplicate of: http://stackoverflow.com/q/11701399
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40989664
linked to: http://stackoverflow.com/q/11701399
upvote count: 0
has answer: http://stackoverflow.com/a/26148694
has body: I know that in Java we have a lot of methods to round, but if my code returns the value 0.19998344639311716 And I need the value 0.2 If I use the method Math.round() it will return 0.0 If I use Math.ceil() it will return 1.0 What method I can use to return 0.2?
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/26148708
answer count: 2
has title: How can I round decimal numbers in Java?
has comment: http://stackoverflow.com/comment/40989606
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/153724

http://stackoverflow.com/q/26073989
has body: I got this question from one of my friends. Problem) I want to write a class which can cache data for "n" iterations for each key and after which it will fetch data from database. After fetching the data from database again for that key it should fetch data only after "n" iteration. For each fetch might be from database or cache the iteration count should be reduced. Question 1) Which is the best approach extending HashMap or writing a class which holds a HashMap Question 2) Write the code for the above problem. I have written the below code. Please suggest me with any better approach for doing this. public class CacheHashMap { private int iterationValue = 3; static Map&lt;String, String&gt; dbSimulator = new HashMap&lt;String, String&gt;(); private Map&lt;String, String&gt; cacheMap; private Map&lt;String, Integer&gt; iterationMap; static{ dbSimulator.put("Vijay","VJ"); dbSimulator.put("Smith","SM"); dbSimulator.put("Raj","RJ"); } public CacheHashMap(Map valueMap, int n) { this.iterationValue = n; if(null != valueMap){ this.cacheMap = valueMap; this.iterationMap = new HashMap&lt;String, Integer&gt;(); for(Map.Entry&lt;String, String&gt; entry:cacheMap.entrySet()){ iterationMap.put(entry.getKey(), iterationValue); } } } public String getValue(String key){ if(null != cacheMap &amp;&amp; null != iterationMap){ if(cacheMap.containsKey(key)){ if(0 == iterationMap.get(key)){ cacheMap.put(key, dbSimulator.get(key)); iterationMap.put(key, (iterationValue-1)); return cacheMap.get(key); }else{ iterationMap.put(key, (iterationMap.get(key)-1)); return cacheMap.get(key); } }else{ cacheMap.put(key, dbSimulator.get(key)); iterationMap.put(key, (iterationValue-1)); return cacheMap.get(key); } } return "No data found. Please enter a valid key"; } public void printCacheMap(){ System.out.println("=================================================================="); for(Map.Entry&lt;String, String&gt; entry:cacheMap.entrySet()){ System.out.println("Cache Map Data\tKey:: " + entry.getK…
tagged with: caching
has comment: http://stackoverflow.com/comment/40853073
has answer: http://stackoverflow.com/a/26075027
answer count: 1
has title: How to cache HashMap data for "n" number of iteration
has comment: http://stackoverflow.com/comment/40855869
accepted answer: http://stackoverflow.com/a/26075027
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40853061
type: Question
tagged with: hashmap

http://stackoverflow.com/comment/40788447
type: Comment
comment on: http://stackoverflow.com/q/26038692
has text: I will if it turns out this is not possible while populating the cursor. Would make my code much more simple if I could do it with the db.query though.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26045407
has body: You mean every notification open new activity. So i think you forgot to add this steps as referred from documentation android:excludeFromRecents="true" android:launchMode="singleTask" android:taskAffinity="" and also set your resultIntent flags like resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26045267
score: 0
answers question: http://stackoverflow.com/q/26045267

http://stackoverflow.com/a/26100910
type: Answer
has body: Yes, like java you can do that.Here hardware is your base package, it can replace all the sub class by this statement: import android.hardware.*;
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40902934
downvote count: 0
answers question: http://stackoverflow.com/q/26100766

http://stackoverflow.com/a/26197276
has comment: http://stackoverflow.com/comment/41079882
has comment: http://stackoverflow.com/comment/41079462
type: Answer
has comment: http://stackoverflow.com/comment/41079797
downvote count: 0
has comment: http://stackoverflow.com/comment/41079732
score: 1
has comment: http://stackoverflow.com/comment/41080626
has comment: http://stackoverflow.com/comment/41079831
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26194371
has body: In your dialog JOptionPane.showMessageDialog(null, SSPparagraphs, "Cashout Prices", JOptionPane.PLAIN_MESSAGE); add '.text()' to SSparagraphs JOptionPane.showMessageDialog(null, SSPparagraphs.text(), "Cashout Prices", JOptionPane.PLAIN_MESSAGE); Then, to get the output on different lines, I changed the code. I assigned the output to a string, then split it on the spaces. I then showed the formatted string in the dialog box, and in console output. package stackoverflow; import javax.swing.JOptionPane; import java.io.IOException; import java.util.logging.*; import org.jsoup.*; import org.jsoup.nodes.*; import org.jsoup.select.*; public class SimpleDialogBox { public static void main(String[] args) { // TODO code application logic here try { String url = "http://bmreports.com/bsp/additional/soapfunctions.php?element=SYSPRICE&amp;dT=NRT"; Document doc = Jsoup.connect(url).get(); Elements SSPparagraphs; SSPparagraphs = doc.select("SSP"); //paragraphs = doc.select("SBP"); String[] numbers = SSPparagraphs.text().toString().split(" "); String formattedText = new String(""); for (int x = 0; x &lt; numbers.length; x++) { formattedText += numbers[x] + "\n"; } System.out.println(formattedText); //(Element paragraphs : SSPparagraphs) JOptionPane.showMessageDialog( null, formattedText, "Cashout Prices", JOptionPane.PLAIN_MESSAGE); System.exit(0); } catch (IOException ex) { Logger.getLogger(SimpleDialogBox.class.getName()) .log(Level.SEVERE, null, ex); } } }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26194371

http://stackoverflow.com/comment/44328675
type: Comment
comment on: http://stackoverflow.com/a/27298541
type: AnswerComment
score: 0
has text: Doesn't work. which url do you use to connect with the IPMI server. I tryed http://ip/page/html/login.html but no result. Can you explain more details how to retrieve the session id

http://stackoverflow.com/a/26124690
has comment: http://stackoverflow.com/comment/40967488
has comment: http://stackoverflow.com/comment/40945803
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40947211
answers question: http://stackoverflow.com/q/26124230
score: 1
has comment: http://stackoverflow.com/comment/40947231
upvote count: 1
has body: When looking at the code for the class Texture at line 88 you can see, that the field Gdx.files is called. public Texture (String internalPath) { this(Gdx.files.internal(internalPath)); } So the only thing I can think of is, that you have to initialize the field files yourself, by calling Gdx.files = new AnyClassImplementingFiles(); in your init() - method (or any other method you call before using setImage(String)) Texture.java: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/Texture.java#L88 Gdx.java: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/Gdx.java#L33 Files.java: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/Files.java

http://stackoverflow.com/a/26110242
score: 1
upvote count: 1
has body: When you make execute() call with cache key and duration Robospice will store your response into database. getSpiceManager().execute(mRequestCity, "city", DurationInMillis.ONE_MINUTE, new ListCityRequestListener()); All following requests during one minute will get data from this cache, and then it makes network call. If you want to get data only from cache take a look on getSpiceManager().getFromCache() method. I think it's what you are looking for.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26106455
has comment: http://stackoverflow.com/comment/40927650
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40931451
type: Answer
answers question: http://stackoverflow.com/q/26106455

http://stackoverflow.com/comment/40910945
score: 0
type: AnswerComment
type: Comment
has text: The Region class looks fine for me. I think its a bug in the client code. Can you post the code that generates the json and the plain message before deserialization
comment on: http://stackoverflow.com/a/26104669

selenium
tags question: http://stackoverflow.com/q/26034994
tags question: http://stackoverflow.com/q/26078658
tags question: http://stackoverflow.com/q/26134190
tags question: http://stackoverflow.com/q/26144742
tags question: http://stackoverflow.com/q/26181434
tags question: http://stackoverflow.com/q/26163026
tags question: http://stackoverflow.com/q/26038255
tags question: http://stackoverflow.com/q/26094375
tags question: http://stackoverflow.com/q/26121464
tags question: http://stackoverflow.com/q/26095711
tags question: http://stackoverflow.com/q/26126388
tag name: selenium
tags question: http://stackoverflow.com/q/26177864
tags question: http://stackoverflow.com/q/26161596
tags question: http://stackoverflow.com/q/26067078
tags question: http://stackoverflow.com/q/26145710
tags question: http://stackoverflow.com/q/26072275
tags question: http://stackoverflow.com/q/26152321
tags question: http://stackoverflow.com/q/26086077
tags question: http://stackoverflow.com/q/26055137
tags question: http://stackoverflow.com/q/26160860
tags question: http://stackoverflow.com/q/26092982
tags question: http://stackoverflow.com/q/26060890
tags question: http://stackoverflow.com/q/26164811
tags question: http://stackoverflow.com/q/26153407
type: Tag
tags question: http://stackoverflow.com/q/26055420
tags question: http://stackoverflow.com/q/26159655
tags question: http://stackoverflow.com/q/26042612
tags question: http://stackoverflow.com/q/26182345
tags question: http://stackoverflow.com/q/26180642
tags question: http://stackoverflow.com/q/26114562
tags question: http://stackoverflow.com/q/26184039

http://stackoverflow.com/comment/40865751
type: QuestionComment
has text: Have to implemented describeContents and writeToParcel, these to methods of Parcelable. Because I run same code and not getting error.
score: 0
comment on: http://stackoverflow.com/q/26080542
type: Comment

http://stackoverflow.com/comment/40976777
type: Comment
comment on: http://stackoverflow.com/a/26139546
has text: So I finally abandoned Eclipse and went to the free Intellij. It's not bad, even counting that I don't know any of the shortcuts yet..
type: AnswerComment
score: 0

http://stackoverflow.com/q/26122732
score: 2
has comment: http://stackoverflow.com/comment/40941502
favorite count: 0
has answer: http://stackoverflow.com/a/26122870
type: Question
downvote count: 2
has body: I want to delete duplicate record in my database table, and I do it in java by using this query String sql = "DELETE e1 FROM tweet_after_preprocessing e1, tweet_after_preprocessing e2 WHERE e1.tweet = e2.tweet AND e1.tweet_after_preprocessing_id &gt; e2.tweet_after_preprocessing_id" The problem is when there are so many records in my database table, the process will take so long, and make my program look not curently running. and I want to use progress bar to show progress of the executing, how can I do that?. I don't now the maximum and the minimum value, so how can i accessing the progress bar?.
has comment: http://stackoverflow.com/comment/40942101
tagged with: java
answer count: 3
tagged with: mysql
upvote count: 4
has answer: http://stackoverflow.com/a/26122823
has comment: http://stackoverflow.com/comment/40941576
has title: How to run progress bar while executing the mysql query in java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26122871
tagged with: progress-bar

http://stackoverflow.com/comment/40943988
type: Comment
type: QuestionComment
score: 0
has text: @ParKein It looks like that site uses [basic](http://en.wikipedia.org/wiki/Basic_access_authentication) (which is hardly recommended anymore).
comment on: http://stackoverflow.com/q/26123638

http://stackoverflow.com/q/26174776
type: Question
downvote count: 0
tagged with: jsp
has title: Load image in jsp from different URL but same domain?
tagged with: struts2
has comment: http://stackoverflow.com/comment/41048184
answer count: 1
accepted answer: http://stackoverflow.com/a/26176612
has body: I am trying to load an image into my jsp located in the 'files' folder on the class path. The URL of the .jsp in which I try to load images is http://www.my-webapp.com/authenticated/dashboard. The problem is that jsp is searching for the 'files' folder inside the 'authenticated' folder instead of class path. This is the URL I get when I use the 'Inspect Element' of Google Chrome: How can I tell my jsp to search for 'files folder on classpath but not in 'authenticated' folder? My struts.xml (if needed): /authenticated/dashboard.jsp Thank you
favorite count: 0
has comment: http://stackoverflow.com/comment/41048140
upvote count: 1
has comment: http://stackoverflow.com/comment/41039372
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: imageurl
has answer: http://stackoverflow.com/a/26176612
tagged with: static-content

http://stackoverflow.com/comment/40853557
score: 0
type: Comment
has text: no i am accessing live server, i tried many example found on google but failed to connect every time. @PandiyanMuthu
comment on: http://stackoverflow.com/a/26053045
type: AnswerComment

http://stackoverflow.com/comment/41023066
comment on: http://stackoverflow.com/a/26114774
type: AnswerComment
has text: I got the DB working in the app. Thanks for that. Unfortunately it didn't solve the ArrayIndexOutOfBounds error. It has to be something with the additional character added to the text display. I'm looking into it now. Let me know if you would like to take a look at the full source.
score: 0
type: Comment

http://stackoverflow.com/q/26123606
tagged with: ejb
answer count: 1
tagged with: morphia
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: jakarta-ee
score: 2
has answer: http://stackoverflow.com/a/26128589
tagged with: java
has body: I am attempting to use Morphia as part of a web service I am creating using Java EE. I read the morphia documentation about their DAO support which said: In a web application environment, we would probably use a dependency injection framework (like Guice or Spring) to inject the dependencies into the DAO, and then inject the DAO into a controller, so the controller would never directly deal with the gritty details. Therefore I have an EJB marked with the @Stateless annotation (so that I can inject when I need it) that extends the BasicDAO morhpia provides as follows: @Stateless public class PlayerDAO extends BasicDAO&lt;Player, ObjectId&gt;{ @EJB ConnectionFactory factory; public PlayerDAO(){}; public PlayerDAO(Morphia morphia, MongoClient mongo){ super(mongo, morphia, "testdb"); } } My problem is that I need to provide the constructor that takes the Morphia and MongoClient parameters and calls the super constructor, which then means I also need to provide a no-args constructor to satisfy Java EE's requirements. When I add this constructor NetBeans shows the error: public PlayerDAO(){}; constructor BasicDAO.BasicDAO(Datastore) is not applicable (actual and formal argument lists differ in length) constructor BasicDAO.BasicDAO(MongoClient,Morphia,String) is not applicable (actual and formal argument lists differ in length) constructor BasicDAO.BasicDAO(Class,Datastore) is not applicable (actual and formal argument lists differ in length) constructor BasicDAO.BasicDAO(Class,MongoClient,Morphia,String) is not applicable (actual and formal argument lists differ in length) Is there a way to get around this behaviour, or should I be taking a different approach in order to use MongoDB as part of a java ee web service?
has title: Using Morphia with Java EE
type: Question
upvote count: 2
tagged with: mongodb

http://stackoverflow.com/q/26139942
has title: Servlet sending Server Sent Events updates faster than coded
tagged with: jsp
has comment: http://stackoverflow.com/comment/51191738
score: 0
has comment: http://stackoverflow.com/comment/53411875
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: server-sent-events
has comment: http://stackoverflow.com/comment/51191721
tagged with: servlets
type: Question
has body: Code structure : Server : Java Servlet Client : Simple JSP Communication : Server Sent Events every 1 second Here is the problem. My code needed the server to send updates every one second to the client as stated above. Hence, I added a while loop with a sleep of 1000 milliseconds in the servlet code as shown below. The following strange behavior is observed: While the server is sending updates to the client, and the client window closes by mistake, the server does not stop sending updates It continues sending the data. When the client is re-opened, it sends data much faster (almost double). For example, the server sends 60 seconds worth of updates (60 updates) in just 25-30 seconds. The server sends faster updates not only for this round of updates, but also for any subsequent updates. @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { PrintWriter writer = null; try{ res.setContentType("text/event-stream;charset=UTF-8"); res.setHeader("Cache-Control", "no-cache,no-store,max-age=0,max-stale=0"); res.setHeader("Connection", "keep-alive"); writer = res.getWriter(); while(true){ getDatafromDB(writer); // send SSE writer.write("data: \n\n"); writer.flush(); try { Thread.sleep(1000); } catch (InterruptedException iex) { System.out.println("ECGDataUpdater::doGet(): " + iex.toString()); iex.printStackTrace(); } } }catch(Exception ex){ System.out.println("ECGDataUpdater:doGet :: " + ex.toString()); ex.printStackTrace(); } finally{ try{ cxt.close(); }catch(Exception ex){ System.out.println("ECGDataUpdater:doGet:finally :: " + ex.toString()); ex.printStackTrace(); } writer.close(); } } On the other hand, when the servlet code is the default Server Sent Event code where server sends updates every 3 seconds and no while loop is involved, the server behaves as expected. Which is :: When the client window is closed while server is still sending updates, server stops sending the updates. The server resumes sending…

http://stackoverflow.com/q/26097261
has answer: http://stackoverflow.com/a/26097544
answer count: 3
downvote count: 0
tagged with: repository
favorite count: 0
has body: I am trying to set up Maven on my Windows machine. I tried both 3.2.3 and 3.1.1. I installed the m2eclipse plugin in my eclipse. I places the following dependencies in my pom.xml (just as a sample) org.springframework.boot spring-boot-tools 1.1.7.RELEASE Eclipse gives the error: Missing artifact org.springframework.boot:spring-boot-tools:jar:1.1.7.RELEASE In my .m2 repository I have the .pom file, the .jar.lastUpdated file but no actual .jar file When I execute mvn -X clean install I have the following stack trace [ERROR] Failed to execute goal on project SpringTest_Boot: Could not resolve dependencies for project SpringTest_Boot:SpringTest_Boot:jar:0.0.1-SNAPSHOT: Failure to find org.springframework.boot:sprin g-boot-tools:jar:1.1.7.RELEASE in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project SpringTest_Boot: Could not resolve dependencies for project SpringTest_Boot:SpringTest_Boot:jar:0.0.1-SNAPSHOT : Failure to find org.springframework.boot:spring-boot-tools:jar:1.1.7.RELEASE in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the u pdate interval of central has elapsed or updates are forced at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:220) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127) at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecu…
has answer: http://stackoverflow.com/a/26097394
accepted answer: http://stackoverflow.com/a/26097544
tagged with: maven
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/26097394
upvote count: 3
has answer: http://stackoverflow.com/a/26097663
tagged with: java
tagged with: eclipse
has title: Maven not downloading jars for dependencies
type: Question

http://stackoverflow.com/q/26139365
has title: Is there a way to ask Jersey to not make special symbols url-safe?
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/26139844
type: Question
tagged with: jersey
downvote count: 0
tagged with: salesforce
answer count: 1
has body: I'm trying to access a REST webservice from SalesForce from my java application. I'm using Jersey to make the webservice call. private String getRegisterId(String registerName, String accessToken) throws JSONException, BusinessException { ClientConfig config = new DefaultClientConfig(); config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client client = Client.create(config); WebResource wr = client.resource(salesforeceUrl + "/data/v31.0/query"); JSONObject register = wr // .queryParam("q", "SELECT+Id+FROM+HealthData_Register__c+WHERE+name+=+'" + registerName + "'+AND+IsDeleted+=+false") // .header(HttpHeaders.AUTHORIZATION.getValue(), "Bearer " + accessToken) // .get(JSONObject.class); JSONArray records = register.getJSONArray("records"); return records.getJSONObject(0).getString("Id"); } The problem I have is that Jersey is so nice that it changes the + symbol to %2B and the + symbol to %3D for my queryParam but SalesForce doesn't like this. It also does this for the header. If my accessToken contains a special character I will get an 401 (UNAUTHORIZED) response. Is there a way to ask Jersey to not make special symbols url-safe?
tagged with: url
favorite count: 0
has answer: http://stackoverflow.com/a/26139844
upvote count: 2

http://stackoverflow.com/a/26122288
has body: This is not a good practise, because it creates a new anonymous inner class which the JVM has to use more memory to keep track of. Other than that, it's mostly harmless. A better way of writing this code would be to use an initialisation block: Map&lt;String, String&gt; aMap = new HashMap&lt;String, String&gt;(); { aMap.put("gloves", "hand"); aMap.put("hat", "head"); aMap.put("shoes", "feet"); aMap.put("scarf", "neck"); }
score: 0
has comment: http://stackoverflow.com/comment/40940700
type: Answer
answers question: http://stackoverflow.com/q/26122029

http://stackoverflow.com/comment/41025697
type: QuestionComment
has text: what database? if you have tables, netbeans would generate stuff for you
comment on: http://stackoverflow.com/q/26168069
score: 0
type: Comment

http://stackoverflow.com/q/26133836
tagged with: android
has comment: http://stackoverflow.com/comment/40963013
has body: I am new to EA and still learning this tool to generate the sequence diagram using reverse engineering but could not find enough information on this topic. Please help me if anybody knows to create this. I found out the way to create the class diagram using reverse engineering and that we can do by creating the new model and importing the source project into EA. steps are as mentioned below. Create a new model create a new diagram Go to project tab in EA Goto source code engineering option Import source directory This will import all the java file into EA and will generate the class diagram using reverse engineering. Next i am looking to create sequence diagram using EA for android application but could not get any information. Please guide me if anyone has done this already or any one want to share information on this. Thanks in Advance.
tagged with: enterprise-architect
has answer: http://stackoverflow.com/a/33589708
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40969717
score: 6
has comment: http://stackoverflow.com/comment/40967378
upvote count: 7
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40962525
has comment: http://stackoverflow.com/comment/40999543
tagged with: java
has title: How to construct sequence diagrams using reverse engineering in Enterprise Architect for android application
has comment: http://stackoverflow.com/comment/40967465
linked to: http://stackoverflow.com/q/26460519
has comment: http://stackoverflow.com/comment/41564009
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26095464
tagged with: spring
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14138556
downvote count: 0
has title: Spring-OAUTH2.0: No resource available error on calling /oauth/token
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43359953
has answer: http://stackoverflow.com/a/27708891
has body: We have a set of ReST webservices which we need to protect using OAUTH2.0. I am trying to implement OAUTH2.0 by referring to the below resources: Spring-security context setup for 2-legged (client credentials) OAuth2 server http://www.e-zest.net/blog/rest-authentication-using-oauth-2-0-resource-owner-password-flow-protocol/ However, after doing the required configuration, I am trying to hit the URL http://localhost:8080/{project-name}/oauth/token?grant_type=password&client_id=client1&client_secret=client1&username=admin&password=admin Tomcat throws error that - The requested resource is not available. When I tried to place a debug point inside ClientDetailsServiceImpl.java, the flow came there with the correct details. Not able to understand what I am doing wrong here. Any suggestions are appreciated. TIA. Below are the file details: Spring Configuration 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:oauth="http://www.springframework.org/schema/security/oauth2" xmlns:sec="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd "> <intercept-url pattern="/oauth/token" access="IS_AUTHENTICATED_FULLY" /> <anonymous enabled="false" /> <http-basic entry-point-ref="clientAuthenticationEntryPoint" /> <custom-filter ref="clientCredentialsTokenEndpointFilter" before="BASIC_AUTH_FILTER" /> <access-denied-handler ref="oauthAccessDeniedHandler" …
accepted answer: http://stackoverflow.com/a/27708891
upvote count: 1
answer count: 1
favorite count: 0
tagged with: oauth
tagged with: rest

http://stackoverflow.com/comment/40833319
type: AnswerComment
has text: I can't really think of something else! Sorry!
comment on: http://stackoverflow.com/a/26051179
type: Comment
score: 0

http://stackoverflow.com/comment/68241181
type: QuestionComment
comment on: http://stackoverflow.com/q/26145917
has text: Note for others coming here, `onNext(null)` is not ok despite what other answers and comments say. See [the spec](https://github.com/reactive-streams/reactive-streams-jvm/blob/v1.0.0/README.md#2-subscriber-code). Also see [this issue](https://github.com/ReactiveX/RxJava/issues/4644) in RxJava.
score: 2
type: Comment

http://stackoverflow.com/comment/40867881
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26081780
has text: As I have written in the answer, The MouseAdaptor is an abstract class which is used for creating listener objects which listens for any mouse events and as soon as that event happens the corresponding method is called and mouse event is passed to it. Same goes for interface MouseListener.
score: 0

http://stackoverflow.com/comment/40928408
type: Comment
has text: @HarshaVardhan watch the comment for 2Dee
comment on: http://stackoverflow.com/q/26115287
score: 0
type: QuestionComment

http://stackoverflow.com/q/26071456
type: UnansweredQuestion
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/26075555
type: Question
has comment: http://stackoverflow.com/comment/40850019
has body: I've been wrestling with a programming about getting the days of the week that a specific festival falls in the next decade, so the run result will demonstrate 10 days of the week in subsequent 10 years. I have the coding, but not able to figure out how the coding works. Here is the coding from the book, and I'm especially confused with it's algorithm about date-time. public class YearTest { public static void main(String[] args) { int[] date = new int[10]; date = J(2010, 4); M(2010, date); O(2010, date); } public static int[] J(int year, int day) { int[] date = new int[10]; date[0] = day; for (int i = 1; i &lt; 10; i++) { if ( ((year + i - 1) % 4 == 0) &amp;&amp; ((year + i - 1) % 100) != 0 ) date[i] = (date[i - 1] + 366) % 7; else date[i] = (date[i - 1] + 365) % 7; } System.out.println("January: "); for (int i = 0; i &lt; 10; i++) System.out.println(date[i] + 1 + " "); return date; } } The coding below is for another two festivals, but I thought we should use M(2010, date) instead? Since date includes year and day, but here we just need day. M(2010, date); O(2010, date); Thanks in advance.
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40850847
has title: Find day of the week for a specific festival in the next decade in Java

http://stackoverflow.com/a/26118955
accepted answer of: http://stackoverflow.com/q/26118799
type: Answer
answers question: http://stackoverflow.com/q/26118799
score: 3
upvote count: 3
type: AcceptedAnswer
has body: Apache PDFBox. The Apache PDFBox™ library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents. Apache PDFBox also includes several command line utilities. Apache PDFBox is published under the Apache License v2.0. In itself, it is not compatible with Android so you may want to have a look at the Android port - PdfBox-Android library. If you want a web service, Datalogics PDF WebAPI is an option.
downvote count: 0
has comment: http://stackoverflow.com/comment/40938381

http://stackoverflow.com/comment/40924074
type: AnswerComment
has text: did you want multiple controller ?
type: Comment
comment on: http://stackoverflow.com/a/26112951
score: 0

http://stackoverflow.com/comment/40929455
has text: @Adi I know ,but I want to use subclass's log in supperclass method when extends.I think Eran's answer is pretty good.
score: 0
comment on: http://stackoverflow.com/q/26113663
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41062849
type: AnswerComment
type: Comment
has text: Or could it be because the first statement has `"some string" + aNumber`, thus causing automatic conversion of the number to a string, whereas the second statement only has a number? I don't know for sure myself: I just googled "java coerce to string" and looked over some results.
comment on: http://stackoverflow.com/a/26187782
score: 1

http://stackoverflow.com/a/26172836
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26150821
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26150821
has body: After doing a lot of research and reading different posts and blogs, I was finally able to resolve my issue. I referred the questions asked here and got the idea for doing this. Pass document as parameter to XSL Translation in Java The other solutions suggested in this thread didn't workout for me. Here is what I did, Used a URIResolver instead of parameter. public class DocumentURIResolver implements URIResolver { final Map&lt;String, Document&gt; _documents; public DocumentURIResolver(final Map&lt;String, Document&gt; documents) { _documents = documents; } public Source resolve(final String href, final String base) { final Document doc = _documents.get(href); return (doc != null) ? new DOMSource(doc) : null; } } This is how I modified my method: public ByteArrayOutputStream merge(final InputStream file1,final InputStream file2) { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer; try { transformer = tFactory.newTransformer(new StreamSource("merge.xslt")); final DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); final Document documentFile = db.parse(file2); Map&lt;String, Document&gt; docs = new HashMap&lt;String, Document&gt;(); docs.put("lookup", documentFile); transformer.setURIResolver(new DocURIResolver(docs)); transformer.transform(new StreamSource(file1), new StreamResult(outputStream)); } catch (final TransformerConfigurationException e) { LOG.warn("Problem occurred transforming files configuration issue", e); } catch (final TransformerException e) { LOG.warn("Problem occurred transforming files", e); } return outputStream; } And this is how I refereed it in my XSLT: &lt;?xml version="1.0"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:variable name=…

http://stackoverflow.com/q/26151636
has answer: http://stackoverflow.com/a/26237354
upvote count: 8
type: Question
tagged with: ejb
has answer: http://stackoverflow.com/a/26155586
tagged with: java
has title: Transactions don't rollback
has answer: http://stackoverflow.com/a/26319117
has comment: http://stackoverflow.com/comment/41016092
has comment: http://stackoverflow.com/comment/41132455
has comment: http://stackoverflow.com/comment/41130351
has comment: http://stackoverflow.com/comment/40997733
has body: I am call two methods, the first one update a table and the next one insert a record in another table. When the second transaction fails the EJB is not doing the rollback of the first transaction. This is my backing bean: @ManagedBean @ViewScoped public class TransactionTestBean implements Serializable { @EJB private TransactionTestService service; public String loadView() { return "/test/transactionTest"; } public void test() { try { service.updateTest(); } catch (Exception e) { } } } The EJB interface: @Local public interface TransactionTestService { void updateTest() throws CustomException; } The EJB class: @Stateless @TransactionManagement public class TransactionTestServiceImpl implements TransactionTestService { @Resource(mappedName = "java:jboss/datasources/xxxxxDS", shareable = true) public DataSource dataSource; private TransactionTestDAO dao; @PostConstruct public void init() { dao = new TransactionTestDAOImpl(); } @PreDestroy public void destroy() { dao = null; } @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void updateTest() throws CustomException { try (Connection connection = dataSource.getConnection()) { dao.updateRecord(connection); // dao.saveRecord(connection); } catch (SQLException exception) { throw new CustomException(exception, exception.getMessage()); } } } And my custom exception: @ApplicationException(rollback = true) public class CustomException extends Exception { public CustomException(Throwable cause, String message) { super(message, cause); } } EDITED: Added the DAO Class: public class TransactionTestDAOImpl implements TransactionTestDAO { @Override public void updateRecord(Connection connection) throws CustomException { PreparedStatement preparedStatement = null; try { preparedStatement = connection.prepareStatement("UPDATE table_x SET field_x = ? WHERE field_y = 1"); preparedStatement.setInt(1, 1); preparedStatement.executeUpdate(); } catch (Exception exception) { throw new CustomException(exception, except…
tagged with: jboss7.x
favorite count: 0
tagged with: rollback
linked to: http://stackoverflow.com/q/3493495
has comment: http://stackoverflow.com/comment/41006244
answer count: 4
score: 8
has comment: http://stackoverflow.com/comment/41130494
linked to: http://stackoverflow.com/q/16897063
linked to: http://stackoverflow.com/q/2360764
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41006522
has comment: http://stackoverflow.com/comment/41131442
downvote count: 0
has comment: http://stackoverflow.com/comment/41132148
has answer: http://stackoverflow.com/a/26237715
has comment: http://stackoverflow.com/comment/41132932
accepted answer: http://stackoverflow.com/a/26319117
possible better answer: http://stackoverflow.com/a/26237354
has comment: http://stackoverflow.com/comment/41132048

http://stackoverflow.com/a/26053092
has comment: http://stackoverflow.com/comment/40814749
has body: Add this Listener in web.xml file org.springframework.security.web.session.HttpSessionEventPublisher In a simple application the solution would be to add a HttpSessionListener. Accordingly in my web.xml: com.web.SessionCounter The code for the listener would be : public class SessionCounter implements HttpSessionListener { private int counter = 0; @Override public void sessionCreated(HttpSessionEvent event) { counter++; System.out.println("Total sessions created " + counter); } // other methods } Now whenever Spring creates a session, my listener is activated and the message will be logged to the console. Total sessions created 1 The limitation with this approach is that the above listener is outside the Spring environment. If we need to access beans here, then the code gets complicated. Spring Security provides a workaround for the problem. They have implemented a listener - HttpSessionEventPublisher. public class HttpSessionEventPublisher implements HttpSessionListener { ... }
has comment: http://stackoverflow.com/comment/40814701
score: 4
accepted answer of: http://stackoverflow.com/q/26053063
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26053063

http://stackoverflow.com/q/26150670
has comment: http://stackoverflow.com/comment/40993710
tagged with: java
has comment: http://stackoverflow.com/comment/40993511
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26151011
favorite count: 0
has comment: http://stackoverflow.com/comment/40993555
has comment: http://stackoverflow.com/comment/40993671
score: 2
has title: Exception in thread "main" java.net.ConnectException: Connection refused: connect when running Oracle tutorial example
upvote count: 2
type: UnansweredQuestion
tagged with: http
has body: I copied the sample program from Oracle Docs and I am running it "as is" in Eclipse. However, every time run it I get a ConnectionException. Do I need to configure anything else? Also, my understanding on this matter is quite weak, could you please recommend beginner guide regarding Java Web programming. The code is public class Test { public static void main(String[] args) throws Exception { URL oracle = new URL("http://www.oracle.com/"); URLConnection yc = oracle.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } } And the exception I am getting is Exception in thread "main" java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at Test.main(Test.java:9) I am able to access http://www.oracle.com via chrome and I have internet access. If it is the firewall issue, could anyone please tell me how do I solve this firewall issue?

http://stackoverflow.com/q/26139407
has title: How to encode a String in Angularjs?
upvote count: 6
tagged with: javascript
answer count: 2
has answer: http://stackoverflow.com/a/26139444
accepted answer: http://stackoverflow.com/a/26139444
has comment: http://stackoverflow.com/comment/40975081
linked to: http://stackoverflow.com/q/16630471
favorite count: 0
has body: I use Angularjs to send a get http request to my server. The server respond to rest request using Spring MVC. Here a snippet code on my angular url building : var name="myname"; var query= "wo?d"; var url = "/search/"+query+"/"+name; Here Spring MVC Controller : @RequestMapping( value = "/search/{query}/{name}" , method = RequestMethod.GET , produces = MediaType.APPLICATION_JSON_VALUE ) @ResponseBody public List&lt;Data&gt; search() { // search logic return data; } I have the problem when the query contains question mark character ( ? ). The url is split so that Spring responds : WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/my-server/web/search/wo in DispatcherServlet with name 'mvc' This is right because the question marks ? introduce the begining of request parameters. I've tried to use the js function encodeURI(query) but the question mark character is not encoded. How to encode a question mark in url ? Thanks
tagged with: angularjs
score: 6
possible better answer: http://stackoverflow.com/a/26139588
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26139588
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/41034109
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26172378
has text: @5gon12eder, he has preallocated array, so probably dimension sizes are known.
score: 0

http://stackoverflow.com/a/54226507
type: Answer
upvote count: 0
has body: You could make your print function static, this way you don't need an instance to call it on: public class Chapter3 { public static void print(String s) { System.out.println(s); } public static void main(String[] args) { Arrays.asList("a", "b", "c").forEach(Chapter3::print); } }
answers question: http://stackoverflow.com/q/26168806
score: -1
downvote count: 1

http://stackoverflow.com/a/26047668
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26047585
upvote count: 2
answers question: http://stackoverflow.com/q/26047585
has comment: http://stackoverflow.com/comment/40805189
type: AcceptedAnswer
downvote count: 0
has body: public Slide[] thisIsASlide (String[] slider) { // create an slide array the same length as your incoming array Slide[] slides = new Slide[slider.length]; for (int i = 0; i &lt; slider.length; ++i) { // Add a slide at index i for each string at index i in the incoming array slides[i] = thisNewMethod(slider[i], 20, 20); } // return the created array return slides; }

http://stackoverflow.com/comment/41063029
has text: that's normal when you start. I don't know any good english tutorial for beginning java, but I'm sure there are some posts about it in this forum ;) Java is fun, keep going ! And use a good IDE (lot of choice, my favorite are eclipse (open source) and IntelliJ (there is a free version)), it would have inform you there was syntax mistake, there message can be very helpful, like nem said it in comment from your question.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26187921

http://stackoverflow.com/comment/40924578
type: Comment
has text: write(str, int, int) is used for printing a portion of your string. I'm trying to print a string to a specific line in this case (lineTCount - 3) which atm in the file is line 25. I've updated the code & gotten rid of the other unneeded Integer.
comment on: http://stackoverflow.com/a/26112952
type: AnswerComment
score: 0

http://stackoverflow.com/q/26055881
score: 0
answer count: 2
tagged with: generics
has answer: http://stackoverflow.com/a/26056174
has comment: http://stackoverflow.com/comment/40819851
has comment: http://stackoverflow.com/comment/40819831
has body: I have the following classes: public interface IEntity&lt;T extends IEntity&lt;T&gt;&gt; { T createNewEntity(IEntityCreator creator); } public interface IEntityCreator { &lt;T extends IEntity&lt;T&gt;&gt; T createNewEntity(T source); } public abstract class EntityBase&lt;T extends EntityBase&lt;T&gt;&gt; implements IEntity&lt;T&gt; { @Override public T createNewEntity(IEntityCreator creator) { return creator.createNewEntity(this); //Error here } } I get the following error: "Bound mismatch: The generic method createNewEntity(T) of type IEntityCreator is not applicable for the arguments (EntityBase). The inferred type EntityBase is not a valid substitute for the bounded parameter >" I tried a different approach with the following code with no success: public interface IEntity&lt;T extends IEntity&lt;T&gt;&gt; { T createNewEntity(IEntityCreator&lt;T&gt; creator); } public interface IEntityCreator&lt;T extends IEntity&lt;T&gt;&gt; { T createNewEntity(T source); } public abstract class EntityBase&lt;T extends EntityBase&lt;T&gt;&gt; implements IEntity&lt;T&gt; { @Override public T createNewEntity(IEntityCreator&lt;T&gt; creator) { return creator.createNewEntity(this); //Error here } } This time the compiler says: "The method createNewEntity(T) in the type IEntityCreator is not applicable for the arguments (EntityBase)" What is the cause for this error? How can I correct it? Thanks
type: UnansweredQuestion
has title: Getting "Not Applicable" compile error with generic type
tagged with: java
has answer: http://stackoverflow.com/a/26058069
type: Question
tagged with: oop
has comment: http://stackoverflow.com/comment/40819587

http://stackoverflow.com/a/26126955
has body: The example code you have linked is for owlapi 3.5 (master branch). The correct example is in the version4 branch - apologies, probably a few documentation links are stale. Edit: version 4 Examples.java is here: https://github.com/owlcs/owlapi/blob/version4/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java https://github.com/owlcs/owlapi/wiki/Documentation
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26104614
answers question: http://stackoverflow.com/q/26104614
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40950027

http://stackoverflow.com/q/26154958
has comment: http://stackoverflow.com/comment/41001308
has title: Deleting duplicate files
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41022432
has comment: http://stackoverflow.com/comment/41002067
has comment: http://stackoverflow.com/comment/41001246
has comment: http://stackoverflow.com/comment/41022490
has body: My problem is, I have this code working (Almost completely perfect), but it creates two of the same file, I assumed it was the FileOutputStream, tried to create a "new File" and put it in its parameter and delete using "file.delete();" after closing it with "save.close();", just like people recommend after so many searchs, but I still keep two files, the only difference is that the files created are empty, with 0kb. Half the code I copied from a tutorial, the other half I wrote myself, but I still don't fully understand what it does, since I'm not a programmer, and java is not my main programming language. I hope someone can help me, thank you. public static boolean SetRingtone(Context context, int type, int music) { byte[] buffer = null; int size = 0; InputStream fIn = context.getResources().openRawResource(music); try { size = fIn.available(); buffer = new byte[size]; fIn.read(buffer); fIn.close(); } catch (IOException e) {return false;} String folderType = ""; if (type == RingtoneManager.TYPE_RINGTONE) folderType = "ringtones" + File.separator; else if (type == RingtoneManager.TYPE_NOTIFICATION) folderType = "notifications" + File.separator; else if (type == RingtoneManager.TYPE_ALARM) folderType = "alarms" + File.separator; String path = Environment.getExternalStorageDirectory() + File.separator + "media/audio" + File.separator + folderType; String filename = context.getResources().getResourceEntryName(music) + ".mp3"; filename = filename.replace("_", " - "); String[] artist = filename.split(" - "); boolean exists = (new File(path)).exists(); if (!exists) {new File(path).mkdirs();} try { FileOutputStream save; save = new FileOutputStream(path + filename); save.write(buffer); save.flush(); save.close(); } catch (FileNotFoundException e) {return false;} catch (IOException e) {return false;} context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + path + filename))); File f = new File(path, filename); ContentValues values = new …
has comment: http://stackoverflow.com/comment/41001749
score: 0
tagged with: android

http://stackoverflow.com/a/26117907
has body: The reason that main must be static is precisely so that the JVM doesn't have to construct an instance for the main class before it starts the program's execution, and it's quite common for a main class never to be instantiated.
has comment: http://stackoverflow.com/comment/40936215
has comment: http://stackoverflow.com/comment/40936652
has comment: http://stackoverflow.com/comment/40936816
answers question: http://stackoverflow.com/q/26117588
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26117588
score: 0
type: Answer

http://stackoverflow.com/a/26129287
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40996399
has comment: http://stackoverflow.com/comment/40990872
has comment: http://stackoverflow.com/comment/40990442
has body: You don't create an instance of ConfiguracionHolder so its constructor is not called, and abreConfiguracion(XMLConfig) is not called. I don't think you're getting any benefit from the holder idiom. It's only the static initialization that's thread-safe and that's only run once. If you want to change the config instance, then you want to run the configuration multiple times which isn't possible with that idiom. If you have different threads calling getInstance() and setConfigFileName() then you'll need some sort of synchronization between them. Making config volatile should be enough. I would move abreConfiguracion(XMLConfig) to the constructor of Configuracion, make config a class variable of Configuracion, and make configFileName a parameter to the Configuracion constructor. Also, it looks like abreConfiguracion should be returning XMLConfig instead of taking it as a parameter. Now, it doesn't seem to be setting anything that's visible outside the method.
accepted answer of: http://stackoverflow.com/q/26128631
answers question: http://stackoverflow.com/q/26128631
type: AcceptedAnswer

http://stackoverflow.com/comment/40943176
comment on: http://stackoverflow.com/a/26122698
has text: This looks about right! But I believe I have tried this already and it was throwing errors on the commas? And it says I need to use initialBalance and Interest.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41310904
type: Comment
type: QuestionComment
score: 0
has text: but i need jlabel with icon.. is there any other way to do this? i used JtextPane with html content. in this case problem is same.
comment on: http://stackoverflow.com/q/26035839

http://stackoverflow.com/a/26069937
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40918898
accepted answer of: http://stackoverflow.com/q/26069708
has comment: http://stackoverflow.com/comment/40846095
type: Answer
answers question: http://stackoverflow.com/q/26069708
has body: If you use plain JNI, you can write in both C and C++. The important thing is that if you are using C++, the JNI functions (like void Java_com_yourpackage_YourClass_yourMethod(JNIEnv* env, ...)) must be declared as extern "C", but AFAIK javah is doing it automatically.

http://stackoverflow.com/a/26108171
answers question: http://stackoverflow.com/q/26107921
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The Collections.sort() methods does . Somewhere in the sort function in java, the fucntion compareTo(Comparable other) is called to determine how your comparable should be compared to the other comparable. Lets say I have circle that I want to compare by diameter public class Circle implements Comparable&lt;Cricle&gt; { int diameter; //constructor public int compareTo(Circle c){ return this.diameter-c.diameter; } now lets make an array of circles : ArrayList&lt;Circle&gt; collection = new ArrayList; collection.add(new Circle(10)); // and more circles Now lets assume this is the sorting algorithm defined in Collection.sort() : Comparable tmp; for(int i=0;i&lt;collection.size();i++){ for(int j=i;j&lt;collection.size();j++){ if(collection.get(j).compareTo(collection.get(i)&gt;0){ //swap tmp=collection.get(i); collection.set(i,collection.get(j)); collection.set(j,tmp); } } } Java doesn't use bubble sort of course, but this is a rough example of how your implementation of compareTo will decide the oreder.

http://stackoverflow.com/a/26128562
has body: You need to get rid of the true in Inflater(true). Use just Inflater(). The true makes it expect raw deflate data. Without the true, it is expecting zlib-wrapped deflate data. PHP's gzcompress() produces zlib-wrapped deflate data.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26111357

http://stackoverflow.com/q/26141211
has comment: http://stackoverflow.com/comment/40975697
has answer: http://stackoverflow.com/a/26143716
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: tree
has body: I need to convert these type of strings which are stored in an ArrayList : Alpha.Beta.Com. Alpa.Xeta.Hash. Alpha.Eta.Dot. Alpha.Eta.Comma. Alpha.Eta.Dollar. Alpha.Xeta.Tilde Alpha.Beta.Com.Xeta. here Alpha.Beta.Com. will have Xeta as child ,but Xeta must not have Hash and Tilde as children in this object. Only,Alpha.Xeta object will have Hash and Tilde as children these strings are like tree like structure(n levels) which means ,Alpha has Beta,Xeta &amp; Eta as Child. Furthermore,Beta has Com, Xeta has Hash &amp; Tilde, Eta has Comma,Dollar &amp; Dot as child. We need to identify each parent and child using java program and then build it to XML.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40979599
accepted answer: http://stackoverflow.com/a/26143716
tagged with: java
has title: Convert a Tree like List of Strings to xml
type: Question
answer count: 1
tagged with: data-structures
tagged with: logic

http://stackoverflow.com/comment/40844154
has text: Maybe this help [Java Locales](http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html)
type: Comment
comment on: http://stackoverflow.com/a/26048888
score: 0
type: AnswerComment

http://stackoverflow.com/a/26173992
downvote count: 1
answers question: http://stackoverflow.com/q/26173966
type: Answer
upvote count: 0
has body: 'air' is using single quotes. Single quotes denote a character constant. What you're looking for is "air", a String constant. You seem to be a new programmer. I made some improvements to your program, and I'll show you them here: import java.util.Scanner; import javax.swing.JOptionPane; import java.text.DecimalFormat; /* Medium Speed Air 1100 feet per second Water 4900 feet per second Steel 16,400 feet per second Write a program that asks the user to enter "air", "water", or "steel", and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time = Distance / 1100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time = Distance / 4900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time = Distance / 16400 */ public class SpeedOfSound { public static void main(String[] args) { char timeTraveled; //what is this even doing here? Scanner scanner = new Scanner(System.in); double time = (distance/ 1100); double time2 = (distance/ 4900); double time3 = (distance/ 16400); DecimalFormat formatter = new DecimalFormat("#0.00"); System.out.println("Enter air, water, or steel: "); String material = scanner.nextLine(); System.out.print("Enter distance: "); double distance = scanner.nextDouble(); switch (material) { case "air": System.out.printf("The total time traveled is " + formatter.format(time) + "."); break; case "water": System.out.printf("The total time traveled is " + formatter.format(time2) + "."); break; case "steel": System.out.printf("The total time traveled is " + formatter.format(time3) + "seconds."); timeTraveled = material.charAt(0); //what is this even doing here? break; } scanner.close(); } // main() } // class SpeedOfSound Made the spacing and indenting more consistent Renamed your Scanner object. "k…
score: -1

http://stackoverflow.com/a/26151242
type: Answer
score: 1
upvote count: 1
has body: Assigning foo is entirely useless, because that would not be reflected in the calling method. There are several ways of achieving the same result, though: Use an array: private void F1() { boolean foo[] = new boolean[1]; List&lt;String&gt; result = F2(foo); if(foo[0]) { // do something } } private List&lt;String&gt; F2(boolean[] foo) { // Logic to set the result List&lt;String&gt; result = new ArrayList(); if(condition) { foo[0] = true; } return result; } Or any other structure that can hold a value without changing its reference (an AtomicBoolean is an example). Change the way you handle the return value: private void F1() { List&lt;String&gt; result = F2(); if(result != null) { // do something } } private List&lt;String&gt; F2() { // Logic to set the result List&lt;String&gt; result = new ArrayList(); if(condition) { return result; } return null; } Returning null where an Object is expected is a common way to indicate that something went wrong and the result is not to be considered valid. Not to be mistaken with an empty result List, which could indicate that everything is fine, there is just nothing to be returned. Throw an exception: private void F1() { try { List&lt;String&gt; result = F2(); // do something } catch (Exception e) { e.printStackTrace(); } } private List&lt;String&gt; F2() { // Logic to set the result List&lt;String&gt; result = new ArrayList(); if(!condition) { throw new Exception("Condition not met"); } return result; } Here it can be a checked or unchecked exception, depending on the effect you want. Also commonly used, for example to indicate that the input is incorrect, that there has been some error due to external causes (I/O), that the system is in a state that does not allow this operation...
downvote count: 0
answers question: http://stackoverflow.com/q/26151072

http://stackoverflow.com/q/26092910
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question
has title: Type mismatch when using "while(line = reader.readLine() != null)"
has answer: http://stackoverflow.com/a/26092931
answer count: 2
has answer: http://stackoverflow.com/a/26092987
tagged with: type-mismatch
favorite count: 0
has body: So I am trying to simply print each line of my buffered read to see if It is outputting correctly but I am getting an error in eclipse and at runtime. Absolutely everywhere I look the code for outputting buffered reader is String line; while(line = myReader.readLine() != null){ { System.out.println(line); } This throws an error saying that "Type mismatch cannot convert from boolean to string." If I change line to a boolean variable it runs and prints "true" three times which is how many lines I am expecting, so does anyone have any idea how I can print the actual text? I am assuming it is throwing the error because != null will return true or false but I cannot get it to work.
type: UnansweredQuestion

http://stackoverflow.com/q/26119729
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26124023
has answer: http://stackoverflow.com/a/35582473
tagged with: jms
tagged with: tibco
tagged with: events
has title: javax.jms.TextMessage - getStringProperty() returning null value
type: UnansweredQuestion
has body: I am listening to a Queue , when a message is posted on to the queue my listener class will listen the message and it has to process it. Listener configuration is good and i am able to receive the message . But when i try to get the value of one of the property , it is returning null even the property has value for it. Please see the attached code and my processing logic code. &lt;textMessages&gt; &lt;textMessage timestamp="1410889863339"&gt; &lt;property name="evnt_code" value="ID" /&gt; &lt;property name="prev_cmdy_abrv" value="APOISN" /&gt; &lt;text&gt;&lt;![CDATA[&lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt;&lt;ceo_eqmt_msg version="1.1"&gt;&lt;eqmt eqmt_nbr="902721" eqmt_init="UTLX" ceo_eqmt_id="56081806"&gt;&lt;evnt_dtl&gt;&lt;evnt evnt_id="19776586731" evnt_code="ID" stop_code="CU" in_out_stop_ind="O" evnt_dt="20140916124600" le_code="L" wb_nbr="161734" wb_date="20140911" evnt_stn_id="8578" evnt_crc7="B 649" evnt_tz="0" evnt_carr_abrv="CN" yard_bloc_id="CNGI" tcs_csn="1102243807" last_uptd_dt="20140916125101" upd_task_user_id="DAEI999" upd_task_id="=WO" upd_task_dt="20140916125100" match_plnd_ev_id="26624105732" phys_le_code="L" upd_src_sys_tla_code="TCS" upd_src_sys_proc_id="Q133703AEI" evnt_stop_desc_id="2059"/&gt;&lt;/evnt_dtl&gt;&lt;/eqmt&gt;&lt;/ceo_eqmt_msg&gt;]]&gt;&lt;/text&gt; &lt;/textMessage&gt; Processing as public void onMessage(Message message) { try { TextMessage textMessage = (TextMessage) message; String stringProperty = textMessage.getStringProperty("evnt_code"); } catch (JMSException ex) { LOGGER.error("Error getting property: " + propertyName + " error: " + ex.getMessage()); } } I am getting value as a null. even though 'evnt_code' property is existed in tag and inside the text message. Help on this is very much appreciated. Thanks in advance.
tagged with: message
tagged with: java
type: Question

http://stackoverflow.com/comment/40847671
type: Comment
score: 1
type: AnswerComment
has text: you already have a built-in class available called TimeUnit. have a look at my comment below.
comment on: http://stackoverflow.com/a/26070676

http://stackoverflow.com/comment/41029951
type: AnswerComment
comment on: http://stackoverflow.com/a/26169491
score: 0
type: Comment
has text: Is your RejectCall class placed in com.scimet.admin.driveon?

http://stackoverflow.com/q/26175340
linked to: http://stackoverflow.com/q/17676206
has title: Spring automatic adds model param to url
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39289627
tagged with: spring
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41039983
type: Question
has answer: http://stackoverflow.com/a/33609961
has comment: http://stackoverflow.com/comment/41039177
has body: When I use return redirect in methods, spring automatically adds my Model variables like get params to url. I've found solution here Spring MVC Controller: Redirect without parameters being added to my url but unfortunately it doesn't work with spring 3.2 Also i've found following When upgrading to spring-mvc-4.0.xsd, you should replace enableMatrixVariables and ignoreDefaultModelOnRedirect with enable-matrix-variables and ignore-default-model-on-redirect respectively. but when i add this to my mvc-dispatcher.xml my IDE says that attribute is not allowed here. Any solutions for Spring 3.2?
has comment: http://stackoverflow.com/comment/41042284
linked to: http://stackoverflow.com/q/13247239
has comment: http://stackoverflow.com/comment/41071724
answer count: 3
has answer: http://stackoverflow.com/a/26175415
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40809501
type: Comment
comment on: http://stackoverflow.com/a/26049994
has text: no i don't have constructor. i thought so simple class doesnt need constructor
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40839944
type: AnswerComment
type: Comment
has text: @trosy Think about it this way....array has a max size because of the limitation of int. theoretically it could have infinite size , I.E. create a List, fill it with > max int number of values and convert back to array. And linked list doesn't have this restriction
comment on: http://stackoverflow.com/a/26066553
score: 0

http://stackoverflow.com/q/26184274
downvote count: 1
type: Question
tagged with: gridbaglayout
has title: Can't set a fixed position for Swing elements
has answer: http://stackoverflow.com/a/26184412
answer count: 2
tagged with: layout-manager
accepted answer: http://stackoverflow.com/a/26184446
favorite count: 0
tagged with: position
has body: I'm having some problems while trying to create a simple UI using Swing. This is the window that i want to achive: I want to have two scrollable JTextAreas on the sides, and also to have two buttons in the middle of the window. Here is the code i have: public class MainWindow extends JFrame implements ActionListener { private JTextArea inputArea; private JTextArea outputArea; private JButton encriptButton, decriptButton; public MainWindow() { super(); } public void initUI() { this.setSize(900, 600); this.setResizable(false); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); inputArea = new JTextArea(); JScrollPane js = new JScrollPane(inputArea); js.setPreferredSize(new Dimension(350,400)); outputArea = new JTextArea(); JScrollPane js2 = new JScrollPane(outputArea); js2.setPreferredSize(new Dimension(350, 400)); JPanel panel = new JPanel(); encriptButton = new JButton("Encript"); decriptButton = new JButton("Decript"); panel.add(encriptButton); panel.add(decriptButton); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(js, BorderLayout.WEST); this.getContentPane().add(js2, BorderLayout.EAST); this.getContentPane().add(panel, BorderLayout.CENTER); } @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } } Now if i do something like this: MainWindow window = new MainWindow(); window.initUI(); window.setVisible(true); I get the following result: I don't know how to position the two buttons in the center of the window. And i also don't know how to set a fixed size for JTextArea. That's it. Thanks in advance!
has answer: http://stackoverflow.com/a/26184446
possible better answer: http://stackoverflow.com/a/26184412
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/40902527
comment on: http://stackoverflow.com/q/26100980
score: 0
has text: have u tried output.getInt(); retruns the first four ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41038297
type: QuestionComment
score: 1
has text: both, if possible :)
comment on: http://stackoverflow.com/q/26174817
type: Comment

http://stackoverflow.com/a/26046905
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26046374
has comment: http://stackoverflow.com/comment/86398554
has body: Change this This is the description of my J2EE component This is the display name of my J2EE component ConnectionPool com.ewheelz.ConnectionPool to this:- ConnectionPool This is the display name of my J2EE component This is the description of my J2EE component com.ewheelz.ConnectionPool diplay-name and description tag should come after servlet-name tag
answers question: http://stackoverflow.com/q/26046374
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/26144681
accepted answer: http://stackoverflow.com/a/26145118
favorite count: 0
has title: Pause loop on user input
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26145118
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40982190
has comment: http://stackoverflow.com/comment/40982463
tagged with: loops
has comment: http://stackoverflow.com/comment/40987298
possible better answer: http://stackoverflow.com/a/26144923
type: Question
has answer: http://stackoverflow.com/a/26144923
answer count: 2
score: -2
has body: If I have a loop like this: for(int i = 0; i &lt;= 10; i++) { System.out.println("Hello, User " + i; Thread.sleep(1000) } How would I go about adding code that did not require user input, but if the user chose the pause the loop at a given point, they could do so, and resume a few moments later?

http://stackoverflow.com/q/26145917
score: 46
type: Question
has answer: http://stackoverflow.com/a/48124032
has title: Observable which does not pass anything in onNext()
has comment: http://stackoverflow.com/comment/68241181
has comment: http://stackoverflow.com/comment/40985857
answer count: 6
has body: I would need an Observable, for example to provide a system clock, which does not need to pass anything in onNext(). I couldn't find a signature that would allow me to do that. Sure, I could use any object and then pass null, but that doesn't make much sense. So my question is if there is a better way to do that. Observable.create(new Observable.OnSubscribe&lt;Anyobject&gt;() { // use any object in the signature @Override public void call(Subscriber&lt;? super Anyobject&gt; subscriber) { subscriber.onNext(null); // then pass null subscriber.onCompleted(); } })
has answer: http://stackoverflow.com/a/50715697
has answer: http://stackoverflow.com/a/48390761
has answer: http://stackoverflow.com/a/50962305
has answer: http://stackoverflow.com/a/26147278
accepted answer: http://stackoverflow.com/a/26147278
possible better answer: http://stackoverflow.com/a/26150230
upvote count: 46
favorite count: 0
has answer: http://stackoverflow.com/a/26150230
tagged with: rx-java
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/41060432
has text: You are not backslashing the parentheses
comment on: http://stackoverflow.com/q/26186267
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26138251
answers question: http://stackoverflow.com/q/26137960
downvote count: 0
has comment: http://stackoverflow.com/comment/134932720
has body: It seems that you can guess the URL for the demos from the URL for the JDK, although Oracle do not appear to publish these officially. JDK URLs http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-i586.rpm http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-windows-i586.exe Demos URL - add '-demos' to directory and filename, note windows demos are .zip not .exe. http://download.oracle.com/otn-pub/java/jdk/8u11-b12-demos/jdk-8u11-linux-i586-demos.rpm http://download.oracle.com/otn-pub/java/jdk/8u11-b12-demos/jdk-8u11-windows-i586-demos.zip
score: 4
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26137960
upvote count: 4

http://stackoverflow.com/a/27756734
answers question: http://stackoverflow.com/q/26120899
type: Answer
has body: Got the same problem at first when using the GlassFish Tools or the OEPE downloads (both deliver the same version) via Eclipse Marketplace. The installation runs smoothly, but no GlassFish option when adding a new server. I'm running Kepler SR2 and Java 6 update 45. Then, when browsing the Oracle site for OEPE, I found that the latest few versions are for Java 7/8. Via the archive page for OEPE http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/oepe-archive-1716547.html I downloaded version 12.1.2.3 which is the last one for Kepler and Java 6. With this version, the GlassFish option in the New Server dialog finally turned up. Took me a few hours to find out. It's a bit disappointing that there were no error messages in neither the Eclipse UI nor in de Eclipse log. (No comments on me using an old JDK please :-) I'll upgrade in the near future.
score: 0

http://stackoverflow.com/a/42108747
score: 0
type: Answer
has body: I followed the instruction VLC published on its official wiki-page and the video starts playing automatically on my device, without pressing the Play button. https://wiki.videolan.org/Android_Player_Intents/
answers question: http://stackoverflow.com/q/26160395

http://stackoverflow.com/comment/40926608
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26114264
has text: Lazy coder is right.Your map is depricated.

crud
tags question: http://stackoverflow.com/q/26139094
tags question: http://stackoverflow.com/q/26119121
tags question: http://stackoverflow.com/q/26122332
type: Tag
tag name: crud

http://stackoverflow.com/a/26190566
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26190476
score: 3
has comment: http://stackoverflow.com/comment/41067723
has body: The variable a has type double[], not double. Therefore, calling Arrays.asList(a) will produce a List&lt;double[]&gt;, not a List&lt;double&gt;. In other words, every element in the list will be an array of double values, not a double value. Thus, iterating over such a list will not extract the 2 double values in the example array a, but a single double[] value, i.e. the array a itself. This is easy to verify by running the following statements: a = new double[2]; b = Arrays.asList(a); System.out.println(b.size()); The above code will print 1, verifying that b is a list with only 1 element, the array a. To iterate over the elements of a itself, one can run directly for (double d : a) { System.out.println(d); } To create a list of all the double values from a, each value has to be converted to a Double object before added to the list, e.g.: List&lt;Double&gt; c = new ArrayList&lt;Double&gt;(); for (double d : a) { c.add(d); // Java automatically converts from double to Double }
has comment: http://stackoverflow.com/comment/41067677

http://stackoverflow.com/a/26092085
score: 2
downvote count: 0
has body: you have used average(); in your main method but your average function signature is average(double homework, int i) Note: As you see your usage of average function in main method does not agree with your function signature.
has comment: http://stackoverflow.com/comment/40886977
upvote count: 2
has comment: http://stackoverflow.com/comment/40886861
answers question: http://stackoverflow.com/q/26092061
has comment: http://stackoverflow.com/comment/40886844
type: Answer

http://stackoverflow.com/comment/40791673
type: Comment
has text: Where are you stuck?
comment on: http://stackoverflow.com/q/26040577
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40988725
type: Comment
has text: So I tried this and added in a breakpoint into the Formatter implementation, but it never gets called. I see that it's now included in the ConversionService but the parse method never gets called. Do I need to change how I bindFromRequest? Or should it automatically attempt to bind based on class?
comment on: http://stackoverflow.com/a/26147797
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40838844
score: 0
type: Comment
has text: I have also try'd that but that did not work. It can't grab the path to the file from the object reaper. Reading from the text file is what i am try'n to do. But i have to do it from the object reaper and that is where the problem is.
comment on: http://stackoverflow.com/a/26065467
type: AnswerComment

http://stackoverflow.com/q/26148119
has title: In Google App Engine is it possible for getScheme() on a ServletRequest to return "https" when isSecure() returns false?"
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26150648
tagged with: servlets
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/26140811
has body: In Google App Engine is it possible for getScheme() on a ServletRequest to return "https" when isSecure() returns false?" This is a follow up question to this.
favorite count: 0
tagged with: google-app-engine
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26150648
score: 1
tagged with: java

http://stackoverflow.com/comment/41063023
score: 0
type: Comment
has text: @blackbelt My bad, it was so unexpected that I didn't see the `execute()` in that constructor! I searched for it in the provided code, but the typo prevented the search from finding it...
type: AnswerComment
comment on: http://stackoverflow.com/a/26184512

http://stackoverflow.com/q/26125064
type: Question
has comment: http://stackoverflow.com/comment/40949715
has title: 8 bit full adder in Java
score: 0
has body: In 'eightbitfulladder' function,I am trying to complement the sumno which is the result of addition of a positive number and a negative number.I found out the number it is sending in the 'convertobyte' function is different from the sumno computed. This is wierd. Can someone explain me what is happening. import static java.lang.Math.pow; public class CAModifiedBoothsMultiplier { public byte byteArrayTobyte(byte[] b) { byte value = 0; for (byte i = 0; i &lt; 8; i++) { value += (b[i] * (pow(2, i))); } return value; } public byte[] twosComplement(byte x) { byte y = (byte) (~x + 1); byte mask = 1; mask = (byte) (mask &lt;&lt; 7); byte num[] = new byte[10]; byte i = 0, num1 = 0; for (i = 0; i &lt; 8; i++) { if ((y &amp; mask) == 0) num1 = 0; else num1 = 1; y = (byte) (y &lt;&lt; 1); num[i] = num1; } return num; } public byte[] saveByte(byte number) { byte mask = 1; mask = (byte) (mask &lt;&lt; 7); byte num[] = new byte[10]; byte num1 = 0; byte i = 0; for (i = 0; i &lt; 8; i++) { if ((number &amp; mask) == 0) num1 = 0; else num1 = 1; number = (byte) (number &lt;&lt; 1); num[i] = num1; } return num; } public byte[] eightbitFullAdder(byte a, byte b, byte cin) { byte sum = 0, temp1 = 0, cout = 0; byte sumno[] = new byte[10]; byte ain[] = saveByte(a); byte bin[] = new byte[10]; if (cin == 1) { bin = twosComplement(b); cin = 0; } else { bin = saveByte(b); } System.out.print("The number entered is, a :"); for (int i = 0; i &lt; 8; i++) { System.out.print(ain[i]); } System.out.println("\n"); System.out.print("The number entered is, b :"); for (int i = 0; i &lt; 8; i++) { System.out.print(bin[i]); } System.out.println("\n"); for (int i = 7; i &gt;= 0; i--) { temp1 = (byte) (ain[i] ^ bin[i]); sum = (byte) (temp1 ^ cin); sumno[i] = sum; cout = (byte) ((ain[i] &amp; bin[i]) | (cin &amp; temp1)); if (i != 0) cin = cout; } for (int i = 0; i &lt; 8; i++) { System.out.print(sumno[i]); } System.out.println("\n"); if (sumno[0] == 1) { byte[] sumnocomp = new byte[10]; byte temp2 = 0; temp2…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40946222
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40946818

http://stackoverflow.com/a/26194644
type: Answer
answers question: http://stackoverflow.com/q/26194440
has body: You are mixing up the '&amp;&amp;' condition with '||', what you want the condition is (if grade is &lt;0 OR grade is >100) which covers the grade 101, which would be: if((grade&lt;0) || (grades> 100)) { //Conditions } But what you are coding is (if grade is &lt;0 AND grade is >100) which is not possible as per your program's requirement. Hope that helps !!!
score: 0

http://stackoverflow.com/comment/61594813
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26120458
has text: i am not able to wrap my head around this, can you pls give me some resources where i can study about this?

http://stackoverflow.com/comment/50670529
type: AnswerComment
comment on: http://stackoverflow.com/a/26253794
type: Comment
score: 2
has text: You can also enable disable protocols with system properties, if you are able to set those in your situation. I had the same problem and forced old SSLv3 using this "-Djdk.tls.client.protocols=SSLv3,SSLv2Hello". See https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#InstallationAndCustomization

http://stackoverflow.com/comment/41011398
type: AnswerComment
has text: Its pseudo, not real working code. If I would do that for every question I read on stackoverflow I would have a backlog of 100 times my lifetime.
type: Comment
comment on: http://stackoverflow.com/a/26141263
score: 0

http://stackoverflow.com/q/26160862
has title: Javax Mail File Path for Attachment
score: 1
tagged with: java
upvote count: 1
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/26164399
tagged with: email-attachments
tagged with: jakarta-mail
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26164399
favorite count: 0
has body: I understand this may be an amateur question: What's the path of any locatable folder for attaching a file as an attachment in a MimeMultiPart message? I've followed an example to produce this: MimeBodyPart imagePart = new MimeBodyPart(); imagePart.attachFile("logo.jpg"); imagePart.setContentID("&lt;" + cid + "&gt;"); imagePart.setDisposition(MimeBodyPart.INLINE); content.addBodyPart(imagePart); But when calling Transport.send I get file not found exception. Basically, where can I put 'logo.png' in my project structure so it's accessible to this static method?
tagged with: path
type: AnsweredQuestion

http://stackoverflow.com/q/26173639
answer count: 5
has answer: http://stackoverflow.com/a/26173757
has comment: http://stackoverflow.com/comment/41036775
has answer: http://stackoverflow.com/a/26173666
has answer: http://stackoverflow.com/a/26173702
has title: Print sequence of numbers without consequtive duplicates?
has body: Given a sequence of numbers like this: 1 2 2 5 5 5 1 7 3 7 7 7 Output should be 1 2 5 1 7 3 7 The current output of my code is 1 2 5 1 7 3 I am unable to fix the problem. Can anyone tell me what should I do or change in my code? Here's my current code: public class Q3 { public static void main(String args[]) { int [] input=new int[]{1 ,2, 2, 5, 5, 5, 1, 7, 3, 7, 7, 7}; int current= input[0]; boolean found=false; for(int i=0; i&lt; input.length; i++) { if(current == input[i] &amp;&amp; !found) { found=true; } else if(current!=input[i]) { System.out.print(" " + current); current=input[i]; found=false; } } } }
has comment: http://stackoverflow.com/comment/41036423
has comment: http://stackoverflow.com/comment/41036174
tagged with: java
has comment: http://stackoverflow.com/comment/41036290
downvote count: 3
linked to: http://stackoverflow.com/q/17967114
upvote count: 1
possible better answer: http://stackoverflow.com/a/26173751
type: Question
has answer: http://stackoverflow.com/a/26173707
type: AnsweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/41036446
has comment: http://stackoverflow.com/comment/41036170
tagged with: arrays
has comment: http://stackoverflow.com/comment/41036480
has answer: http://stackoverflow.com/a/26173751
favorite count: 0
has comment: http://stackoverflow.com/comment/41036131
accepted answer: http://stackoverflow.com/a/26173702
has comment: http://stackoverflow.com/comment/41036121

http://stackoverflow.com/comment/40860802
comment on: http://stackoverflow.com/q/26078064
has text: @trosy : You are adding `Integer.MAX_VALUE/20` elements to a list in the second iteration, no wonder why it is so slow.
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/41156802
has text: Could you give me some link where I can see how to do it?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26237354

http://stackoverflow.com/comment/41050760
type: Comment
type: QuestionComment
has text: @barbara That's exactly what an over-specified test does.
comment on: http://stackoverflow.com/q/26181125
score: 0

http://stackoverflow.com/comment/40909442
type: QuestionComment
has text: do you import the needed classes?
score: 1
comment on: http://stackoverflow.com/q/26104786
type: Comment

http://stackoverflow.com/a/26185134
accepted answer of: http://stackoverflow.com/q/26184979
answers question: http://stackoverflow.com/q/26184979
has body: Try something like this public static String sqlDateToString(java.sql.Date date){ if(date != null) { java.util.Date utilDate = new java.util.Date(date.getTime()); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH); return dateFormat.format(utilDate); } return null; } Then call the method like this while(resultSet.next()){ String sringFormatDate = className.sqlDateToString(resultSet.getDate("your_date_column")); }
has comment: http://stackoverflow.com/comment/41057857
has comment: http://stackoverflow.com/comment/41057940
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/26120123
downvote count: 0
has comment: http://stackoverflow.com/comment/40937857
type: Answer
has comment: http://stackoverflow.com/comment/40937788
score: 2
has body: You can change the style of your second Shell and use SWT.APPLICATION_MODAL which will make sure that you cannot interact with the parent shell unless you close the child shell: final Shell shell2 = new Shell(shell, SWT.SHELL_TRIM | SWT.APPLICATION_MODAL); The modality of an instance may be specified using style bits. The modality style bits are used to determine whether input is blocked for other shells on the display. The PRIMARY_MODAL style allows an instance to block input to its parent. The APPLICATION_MODAL style allows an instance to block input to every other shell in the display. The SYSTEM_MODAL style allows an instance to block input to all shells, including shells belonging to different applications. Even SWT.PRIMARY_MODAL would suffice in this case. UPDATE If on the other hand you don't want the parent to loose focus when the child is clicked, just disable the child: shell2.setEnabled(false);
upvote count: 2
answers question: http://stackoverflow.com/q/26120040
has comment: http://stackoverflow.com/comment/40936710
accepted answer of: http://stackoverflow.com/q/26120040
has comment: http://stackoverflow.com/comment/58881823
has comment: http://stackoverflow.com/comment/40938255
has comment: http://stackoverflow.com/comment/40936666
has comment: http://stackoverflow.com/comment/40936631
type: AcceptedAnswer

http://stackoverflow.com/q/26178652
tagged with: java
has comment: http://stackoverflow.com/comment/41045344
type: Question
has comment: http://stackoverflow.com/comment/41045234
tagged with: c#
has answer: http://stackoverflow.com/a/26179004
answer count: 2
has comment: http://stackoverflow.com/comment/41045927
has comment: http://stackoverflow.com/comment/41051836
downvote count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/41056764
possible better answer: http://stackoverflow.com/a/26178756
accepted answer: http://stackoverflow.com/a/26179004
has answer: http://stackoverflow.com/a/26178756
has body: I have a number of applications (.Net &amp; Java) which communicate with each other using a communication layer. I now need to extend the communication layer to allow 3rd party applications access it - as shown below. However while I want to ensure that my applications can still access all available methods in the communication layer I want to limit access to the 3rd party applications. In essence therefore I need to find a way for my applications to prove that they really are mine. Naturally I can use public/private key encryption or a unique hash in each message however this is slowing down communication between my apps to a pretty unacceptable limit. Does anyone have any other ideas ?
favorite count: 0
has title: Controlling access to a communication layer
tagged with: architecture
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/q/26072609
answer count: 1
tagged with: jar
score: 0
has body: I'm trying to do a mvn install with my local jar. Here is the pom file, Allure cli. I want to use the allure-report-builder jar from my local machine, rather than from the maven repo. So I tried this: mvn install:install-file -Dfile=allure-report-builder.jar -DgroupId=ru.yandex.qatools.allure -DartifactId=allure-report-builder -Dversion=2.1 -Dpackaging=jar install Here allure-report-builder.jar is my local jar, in the current directory. But it doesn't seems to be working properly. The resulting jar is still using the jar from maven repo. Where I'm making mistake?
tagged with: maven
has comment: http://stackoverflow.com/comment/40852946
type: Question
has comment: http://stackoverflow.com/comment/40850752
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40850676
has title: Trying to pass local jar to maven install
tagged with: java
has answer: http://stackoverflow.com/a/26074174
accepted answer: http://stackoverflow.com/a/26074174
has comment: http://stackoverflow.com/comment/40852226
has comment: http://stackoverflow.com/comment/40850742

http://stackoverflow.com/q/26190492
answer count: 1
tagged with: game-engine
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/41068128
has title: Is it possible to develop AAA game engines in Java?(or in any language on the JVM)
score: -5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41067491
has body: Or will it be possible in the near future? Can they optimize JVM further and implement even gentler garbage collectors, maybe with some support for lower-level interference? I could have asked the question if it's possible to develop AAA games, but since AAA games use highly advanced game engines, I thought the barrier to overcome here is to have similarly advanced game engines written to the JVM. Is it likely that in 5 years we will see games like Assassin's Creed, that are optimized to infinity with the help of C/C++ libraries by necessity, written in Java?
has answer: http://stackoverflow.com/a/26190571
tagged with: java
downvote count: 5
tagged with: optimization
type: Question
has comment: http://stackoverflow.com/comment/41067544
upvote count: 0

http://stackoverflow.com/a/26098429
type: Answer
has body: You use GET method, for example, Create file index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> Username: Email: Go to: http://localhost:8080/index.jsp (I use default port 8080 with Tomcat) When enter username: myname email: myname@example.com and press Submit button. See browser's address bar: http://localhost:8080/index.jsp?txtUserName=myname&emailUser=myname%40example.com
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26097953

http://stackoverflow.com/q/26162964
favorite count: 0
tagged with: postgresql
tagged with: timezone
has title: JDBC inserting now() different to the server timestamp
tagged with: jdbc
tagged with: timestamp
linked to: http://stackoverflow.com/q/12008801
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26164685
type: Question
score: 5
has answer: http://stackoverflow.com/a/26164685
upvote count: 5
has body: For this PostgreSQL test table: CREATE TABLE public.test ( id BIGSERIAL, "datetime" TIMESTAMP WITHOUT TIME ZONE DEFAULT now(), value INTEGER, CONSTRAINT test_pkey PRIMARY KEY(id) ) I am using this SQL insert: INSERT INTO it.test (value) VALUES (1); No problem when I execute the INSERT from a remote client like EMS or PgAdmin. The field datetime is populated with the server timestamp exactly, but when I execute the INSERT from a Java program using Postgres/JDBC Driver (postgresql-9.2-1002.jdbc4.jar), the field datetime is populated with a timestamp different to the server. I read that the JVM use the local PC time zone. There is any way to avoid this? If I change the datatype from timestamp to timestampz, java populate the field with the server timestamp, but I want solve it without change the datatype, because the table is used by another programs and reports.
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41016748

http://stackoverflow.com/comment/40944812
has text: What is the column type? Or rather, what is the type being returned by stored procedure?
score: 0
comment on: http://stackoverflow.com/q/26124372
type: Comment
type: QuestionComment

jxtable
tags question: http://stackoverflow.com/q/26164711
tags question: http://stackoverflow.com/q/26185675
type: Tag
tag name: jxtable

http://stackoverflow.com/q/26163693
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41018072
has comment: http://stackoverflow.com/comment/41018482
has body: I recently opened a java file in an project that I had used last week. It is now one long blank line with an error. The line is 22606 characters long which is probably the length of my file. Is it gone for good? SOLVED: Right clicked on file name and went Team->History to get backup
has comment: http://stackoverflow.com/comment/41017799
has comment: http://stackoverflow.com/comment/41018325
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41017735
has comment: http://stackoverflow.com/comment/41017844
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41018194
favorite count: 0
has answer: http://stackoverflow.com/a/26164232
has comment: http://stackoverflow.com/comment/41017574
has title: Eclipse java file is now one long blank line?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41017914
has comment: http://stackoverflow.com/comment/41017859
tagged with: java
has comment: http://stackoverflow.com/comment/41017981
has comment: http://stackoverflow.com/comment/41017544
accepted answer: http://stackoverflow.com/a/26164232

http://stackoverflow.com/q/26174258
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41037305
has body: Can anyone suggest to me why my SQLite JDBC database is not enforcing the unique primary key constraint? The create table method is: public static void TableCars() { Connection c = null; Statement stmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:WalkerTechCars.db"); System.out.println("Opened database successfully"); stmt = c.createStatement(); String sql = "CREATE TABLE IF NOT EXISTS CARS3 " + "(REGISTRATION TEXT PRIMRY KEY NOT NULL, " + " PHONE TEXT NOT NULL," + " MAKE TEXT NOT NULL, " + " MODEL TEXT, " + " COLOUR TEXT)"; stmt.executeUpdate(sql); stmt.close(); c.close(); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } System.out.println("Cars3 created successfully"); } The insert method is: public static void InsertCars(String table, String phone, String registration, String make, String model, String colour) { Connection c = null; PreparedStatement pstmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:WalkerTechCars.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); String query="INSERT INTO "+table+" (PHONE,REGISTRATION,MAKE, MODEL,COLOUR) VALUES (?,?,?,?,?)"; pstmt = c.prepareStatement(query); pstmt = c.prepareStatement ("insert into CARS3 values(?,?,?,?,?)"); pstmt.setString(1,registration); pstmt.setString(2,phone); pstmt.setString(3, make); pstmt.setString(4, model); pstmt.setString(5, colour); pstmt.executeUpdate(); pstmt.close(); c.commit(); c.close(); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } System.out.println("Car Records created successfully"); } and the line of code that should not be allowed, but can be executed repeatedly is: DbHandler.InsertCars("Cars3", "1","BN51 MZY", "Mini", "C220", "BLACK");
favorite count: 0
has answer: http://stackoverflow.com/a/26174322
type: UnansweredQuestion
has title: JDBC SQLite not enforcing unique primary key constraint
score: 3
downvote count: 0
tagged with: primary-key
tagged with: java
has comment: http://stackoverflow.com/comment/41037359
tagged with: eclipse
type: Question
upvote count: 3
tagged with: sqlite
answer count: 1

http://stackoverflow.com/a/26065628
downvote count: 0
has body: Proper and compact implementation, given that jsonObject is the json object you are referring to and it is an instance of JSONObject: jsonObject.put("new name", jsonObject.remove("name"));
type: Answer
score: 13
accepted answer of: http://stackoverflow.com/q/26065020
upvote count: 13
answers question: http://stackoverflow.com/q/26065020
type: AcceptedAnswer

http://stackoverflow.com/q/26194048
tagged with: java
type: Question
has title: Having trouble with a heapsort method
tagged with: heapsort
score: 0
has answer: http://stackoverflow.com/a/26194192
answer count: 1
has body: I'm having trouble with a Heapsort code in java. I'd like it to print out the given list as a max heap as as soon as has been built. so far so good. What I'm struggling with is the sorting part. I'd like the heapSort() method to print out the given array each step of the sorting process when the largest Element of the heap is taken out and inserted at the last position of the array. for some reason it kind of works up to some point but after 3 times it throws out something that shouldn't be and the end result is not the correct one. I'd really appreciate any kind of constructive criticism and help. I apologize in advance for my code style, I'm pretty new to java and I really tried my best. here's the output: Max-Heap: [26, 22, 18, 14, 12, 16, 8, 6, 10, 4] sorting process: [22, 14, 18, 10, 12, 16, 8, 6, 4, 26] [18, 14, 16, 10, 12, 4, 8, 6, 22, 26] [16, 14, 8, 10, 12, 4, 6, 18, 22, 26] [14, 12, 8, 10, 26, 4, 16, 18, 22, 6] [12, 26, 8, 10, 6, 14, 16, 18, 22, 4] [26, 12, 8, 10, 6, 14, 16, 18, 22, 4] [12, 26, 8, 22, 6, 14, 16, 18, 10, 4] [26, 22, 12, 18, 6, 14, 16, 8, 10, 4] [26, 22, 12, 18, 6, 14, 16, 8, 10, 4] And the code: public static void max_Heapify(int []a, int i){ int left=2*i+1; int right= 2*i+2; int largest; int heapSize= a.length; if(left&lt;heapSize &amp;&amp; a[left]&gt;a[i]){ largest= left; }else{ largest= i; } if(right&lt;heapSize &amp;&amp; a[right]&gt;a[largest]){ largest = right; } if(largest != i){ swap(a,i,largest); max_Heapify(a, largest); } } public static void createMax_Heap(int []a){ int heapSize= a.length; for(int i=heapSize/2; i&gt;=0; i--){ max_Heapify(a, i); } System.out.println("Max-Heap: " +"\n"+Arrays.toString(a)); } public static void heapSort(int []a){ createMax_Heap(a); System.out.println("sorting process: "); for(int i=a.length-1; i&gt;=1; i--){ swap(a,0,i); int heapSize= a.length-1; max_Heapify(a, 0); System.out.println(Arrays.toString(a)); } } public static void swap(int[] a, int i, int j) { int tmp; tmp = a[i]; a[i] = a[j]; a[j] = t…
accepted answer: http://stackoverflow.com/a/26194192
type: AnsweredQuestion

http://stackoverflow.com/q/26193364
type: Question
tagged with: deb
tagged with: ant
score: 0
has title: How to get any useful information when JDeb fails to create a Debian package?
answer count: 1
tagged with: package
tagged with: debian
type: AnsweredQuestion
has body: I use JDeb for a few days. I try to create a Debian package for my Java based first person shooter. I use Ant as a build tool. I put this line into my Ant script at the very beginning: &lt;taskdef name="pure-java-deb" classname="org.vafer.jdeb.ant.DebAntTask" classpath="lib/ant/jdeb-1.3.jar"/&gt; I try to use this library further: &lt;delete failonerror="false" file="${destdir}/control" /&gt; &lt;echo file="${destdir}/control"&gt; &lt;![CDATA[ Package: ${project-unix-name} Version: 0 Section: Games Priority: low Architecture: all Description: ${game-description} Maintainer: xxxxxxx@xxxxxxx.fr ]]&gt; &lt;/echo&gt; &lt;pure-java-deb destfile="${destdir}/${project-unix-name}.deb" control="${destdir}/control" verbose="true"&gt; &lt;data src="${destdir}/${game-jar-filename}" type="file"&gt; &lt;mapper type="perm" prefix="/usr/share/games/${project-unix-name}"/&gt; &lt;/data&gt; &lt;/pure-java-deb&gt; &lt;delete failonerror="false" file="${destdir}/control" /&gt; I only get the following error message even when I set "verbose" to "true": Failed to create the Debian package tuer/target/tuer.deb BUILD FAILED tuer/build.xml:463: Failed to create the Debian package tuer/target/tuer.deb Is there a way of getting any information about the cause(s) of the failure?
has answer: http://stackoverflow.com/a/26288626
accepted answer: http://stackoverflow.com/a/26288626
tagged with: java

http://stackoverflow.com/comment/40780341
type: Comment
comment on: http://stackoverflow.com/q/26034338
type: QuestionComment
has text: what's your eclipse compile settings? is eclipse set to use 1.8?
score: 1

http://stackoverflow.com/q/26059244
tagged with: multidimensional-array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26374438
has body: I have been given a task to create a program which models cell growth according to some given rules. To do this, I have to create a 2D array and populate it with Cell objects which are either living or dead according to a given probability. So far, I've been able to create what I think is an array of these objects, but I'm not sure how I would go about using the probability I've been given to assign "dead" or "normal" status to each object. This is what I've done so far (not that much I know...): public class CellGrid { // Store the cells of the game in this 2D array private Cell[][] cells; /** * Contructor for a CellGrid. Populates the grid with cells that will be * living and normal (with probability given by lifeChance) or dead. Cells * will NOT start mutated. * * @param size * the size of the grid will be size x size * @param lifeChance * the probability of each cell starting out alive * @param mutationChance * the probability that (when required) each cell will mutate */ public CellGrid(int size, double lifeChance, double mutationChance) { Cell[][] cells = new Cell[size][size]; //populates the array with new Cell objects for (int i = 0; i &lt; size; i++) { for (int j = 0; j &lt; size; j++) { cells[i][j]= new Cell(); } }
downvote count: 1
type: Question
tagged with: object
tagged with: java
score: 0
answer count: 2
has title: Populating a 2D array of objects using given probability in Java
upvote count: 1
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/26059570

dynamic-dispatch
type: Tag
tag name: dynamic-dispatch
tags question: http://stackoverflow.com/q/26035329

http://stackoverflow.com/comment/40832007
has text: Your code does not compile. Why did you put a `;` in `for(String line: ita.getText().split("\\n"));` ? Is it possible you have a static variable named `line` that gets printed instead of the actual content of the `JTextArea` ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26062414

http://stackoverflow.com/comment/40900154
comment on: http://stackoverflow.com/a/26099668
type: Comment
score: 2
type: AnswerComment
has text: @GauriShankar null is handled as a special case, explicitly. Check out the docs for [String.valueOf](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#valueOf(java.lang.Object)): `if the argument is null, then a string equal to "null"; otherwise, the value of obj.toString() is returned.`

http://stackoverflow.com/q/26137770
has title: Does addAll() return false?
has comment: http://stackoverflow.com/comment/40969388
has answer: http://stackoverflow.com/a/26138872
downvote count: 0
possible better answer: http://stackoverflow.com/a/26137849
has answer: http://stackoverflow.com/a/26137849
has answer: http://stackoverflow.com/a/26137835
answer count: 4
has body: While looking at the source code of CollectionUtils addAll method. I notice it uses |= symbol public static &lt;T&gt; boolean addAll(Collection&lt;? super T&gt; c, T... elements) { boolean result = false; for (T element : elements) result |= c.add(element); return result; } From my understanding |= is a bitwise or operator and just a shorthand of result = result|c.add(element), so for example : System.out.println(false|true); //true System.out.println(false|false); //false System.out.println(true|false); //true System.out.println(true|true); //true This means that if any item successfully added, it will return true. Now I've been wondering is there will be an instance, it will return false? If not why it has a return?
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/26137786
has comment: http://stackoverflow.com/comment/99277578
tagged with: collections
has comment: http://stackoverflow.com/comment/40969349
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40969959
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40970189
accepted answer: http://stackoverflow.com/a/26137786
score: 8
has comment: http://stackoverflow.com/comment/40975390

http://stackoverflow.com/comment/41019875
comment on: http://stackoverflow.com/a/26163338
type: Comment
has text: +1 on quoting parameter expansions, but note that it's not necessary on assignments (e.g. `LOG4j_FILE=$OPTARG;;` )
type: AnswerComment
score: 0

http://stackoverflow.com/a/26115564
has body: If I were you I would do the following. I would make this class(your network class) accessible via Singleton and I would create a pool of activities to be notified in case there is a connection. Every activity that wants to listen for this can register to this class of yours and when there is a network change you notify the activities(it can be 1 or 2...100). All you have to do is to create an interface like that: public class NetworkStateReceiver extends BroadcastReceiver { private static NetworkStateReceiver instance = null; private List&lt;INetworkNotify&gt; list = new ArrayList&lt;INetworkNotify&gt;(); protected NetworkStateReceiver(){} public static NetworkStateReceiver getInstance() { //standard code for initializing the instance; } public void registerListener(INetworkNotify listener) { //add it to the list pool. } public void deregisterListener(INetworkNotify listener) { //remove it from the pool. } private static final String TAG = "NetworkStateReceiver"; @Override public void onReceive(final Context context, final Intent intent) { Log.d(TAG, "Network connectivity change"); if (intent.getExtras() != null) { final ConnectivityManager connectivityManager =(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo ni = connectivityManager.getActiveNetworkInfo(); if (ni != null &amp;&amp; ni.isConnectedOrConnecting()) { Log.i(TAG, "Network " + ni.getTypeName() + " connected"); } else if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, Boolean.FALSE)) { Log.d(TAG, "There's no network connectivity"); } notifyListeners("Something, anything."); } } private void notifyListeners(String msg) { //e.g for(INetworkListener listener:list) { listener.onUpdate(msg); } //notify the listeners; } Below you can see the INetworkNotify interface Interface INetworkNotify { void onUpdate(String msg); } In the activity all you have to do is to implement the listener.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26115287

http://stackoverflow.com/comment/40947644
has text: @Ryan J ,I have not worked on JAXB. As I am reading,In all basic examples of Unmarshalling, first class is defined and then xml contents are parsed into the class using JAXB. In my case every XML file will have different elements and there is no guarantee which tags will come in which XML file. Also how to have hierarchical Tree structure. Based on my requirement, can you show some example or lay basic structure which i will take it forward. Thanks in advance for your help.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26125655
score: 0

http://stackoverflow.com/q/26173347
has answer: http://stackoverflow.com/a/26173598
has answer: http://stackoverflow.com/a/26173526
answer count: 3
possible better answer: http://stackoverflow.com/a/26173520
downvote count: 0
has comment: http://stackoverflow.com/comment/41035802
has comment: http://stackoverflow.com/comment/41035983
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26173598
has title: Alert user if item already exists within a HashSet
has comment: http://stackoverflow.com/comment/41035607
upvote count: 2
has comment: http://stackoverflow.com/comment/41035602
type: Question
score: 2
type: AnsweredQuestion
tagged with: alert
has body: My code uses a HashSet in order to not duplicate entries saved to the set. I want to implement an alert for user who enter the same data or string that is already stored. Is this something that can be done? I have taken Java for 2 days now and I will be grateful for any advise. Here is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_layout); aButton = (Button) this.findViewById(R.id.button1); text2 = (TextView) this.findViewById(R.id.textView1); aButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { list.add("Books"); list.add("Newspapers"); list.add("Magazines"); String listString = ""; for (String s : list) { listString += s + " - "; } text2.setText(listString); } }); sButton = (Button) this.findViewById(R.id.button2); eText = (EditText) this.findViewById(R.id.editText1); sButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Log.v("EditText", eText.getText().toString()); list.add(eText.getText().toString()); } }); } }
tagged with: java
has answer: http://stackoverflow.com/a/26173520

http://stackoverflow.com/q/26054363
has comment: http://stackoverflow.com/comment/40818385
type: Question
upvote count: 4
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/40818609
downvote count: 0
has comment: http://stackoverflow.com/comment/40818183
score: 4
has body: protected static String paramsAsString(Object[] args) { return Arrays.stream(args).map((o) -&gt; o != null &amp;&amp; o.getClass().isArray() ? ArrayUtils.toString(o) : o) .collect(Collectors.toList()).toString(); } unit test public void paramsAsString() throws Exception { String[] strings = {"1" , "2"}; int[] ints = {3,4}; int[] intsEmpty = {3,4}; Object[] args = {"aaa" ,"zzz" , ints , strings, intsEmpty, null}; String paramsAsString = paramsAsString(args); assertEquals("[aaa, zzz, {3,4}, {1,2}, {3,4}, null]", paramsAsString); } I'm just learning stream api. I wonder is there there any way to simplify this stream expression and remove the complex if?
has answer: http://stackoverflow.com/a/26055578
favorite count: 0
type: UnansweredQuestion
tagged with: java-8
tagged with: java-stream
has answer: http://stackoverflow.com/a/26055782
tagged with: java
has title: Is there any way to simplify this stream expression?

http://stackoverflow.com/comment/41049552
score: 1
comment on: http://stackoverflow.com/q/26180919
type: Comment
type: QuestionComment
has text: What value you wan to be stored for `421342342342342344.123`? Remember maximum allowed value is `99999.999`

http://stackoverflow.com/comment/40855869
type: Comment
type: QuestionComment
score: 0
has text: @BoristheSpider Thanks for the suggestion. I am quite new to stackoverflow, next time i will keep this kind of questions under code review.
comment on: http://stackoverflow.com/q/26073989

http://stackoverflow.com/comment/70796063
score: 1
type: AnswerComment
has text: The syntax is incorrect
type: Comment
comment on: http://stackoverflow.com/a/26139567

http://stackoverflow.com/q/26065648
tagged with: maven
has comment: http://stackoverflow.com/comment/40843379
has comment: http://stackoverflow.com/comment/40842589
has comment: http://stackoverflow.com/comment/40842767
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: Maven: Could not resolve archetype
type: Question
has comment: http://stackoverflow.com/comment/40839499
upvote count: 1
favorite count: 0
has body: I get this error when I try to create a webapp maven project. Here is the entire error message. Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories. Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\Osvaldo\.m2\repository) Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Users\Osvaldo\.m2\repository) Here is some workarounds I have tried to do: Delete C:\Users\XXXX\\.m2\repository and run MAVEN -> UPDATE MAVEN Edit the maven settings.xml unactivating any proxies. Above the part of the file: XXXX **false** http 172.20.100.5 8080 Doublecheck the reference of settings.xml at eclipse Window -> Preferences -> Maven -> User Settings Adding remote maven catalog manually Window -> Preferences -> Maven -> Archetypes
type: UnansweredQuestion

http://stackoverflow.com/q/26114012
linked to: http://stackoverflow.com/q/1493617
favorite count: 0
possible better answer: http://stackoverflow.com/a/26115358
has answer: http://stackoverflow.com/a/26115358
accepted answer: http://stackoverflow.com/a/26114093
tagged with: fingerprinting
has title: I am running a Tomcat server, I would like to pull the details of the machine from which the requests originate. Is this possible and how?
type: AnsweredQuestion
tagged with: tcp
tagged with: java
downvote count: 3
upvote count: 1
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/40979216
score: -2
has answer: http://stackoverflow.com/a/26114093
tagged with: tomcat
has body: This requirement is for a local server that collects information of all devices that connect to it in a closed organization. Need to pull details like OS Version, software versions, hardware properties.
answer count: 2

http://stackoverflow.com/comment/40932461
score: 0
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62170/discussion-between-anurag-sharma-and-greenisha).
comment on: http://stackoverflow.com/q/26055514

http://stackoverflow.com/a/26136692
downvote count: 0
has body: In other languages this would be called a "stack frame", but the Java Virtual Machine Specification uses just the term "frame". It is the segment of the call stack devoted to one invocation of a method, where that method keeps its state (local variables, parameters, etc.).
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26136504
answers question: http://stackoverflow.com/q/26136504
type: AcceptedAnswer

http://stackoverflow.com/comment/41132315
type: Comment
comment on: http://stackoverflow.com/q/26180897
type: QuestionComment
has text: That was "psuedo code" of the issue, my actual variable is a
score: 0

http://stackoverflow.com/q/26068095
tagged with: polymorphism
favorite count: 0
upvote count: 2
has body: When the following classes are separated into different packages it null-pointers: java.lang.NullPointerException: Cannot invoke method addPropertyChangeListener() on null object. Combining them into a single package, however, works. Package parents: package parents import groovy.beans.Bindable import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @Bindable class GrandParent&lt;T extends Parent&gt; implements PropertyChangeListener { String pets GrandParent() { this.addPropertyChangeListener(this) } @Override void propertyChange(PropertyChangeEvent evt) { println "prop change -&gt; $evt" } } class Parent extends GrandParent {} Package children package children import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import groovy.beans.Bindable import parents.* class Child extends Parent { @Bindable String brothers static main(args) { Child child = new Child() child.pets = "Leo, Sophie" child.brothers = "Douglas, Ted" } } Put them all together into one package/file (commenting out import parents.*) and you'll find it works, printing: &gt; prop change -&gt; java.beans.PropertyChangeEvent[propertyName=pets; oldValue=null; newValue=Leo, Sophie; propagationId=null; source=children.Child@7eceb95b] &gt; prop change -&gt; java.beans.PropertyChangeEvent[propertyName=brothers; oldValue=null; newValue=Douglas, Ted; propagationId=null; source=children.Child@7eceb95b] Why is that?
tagged with: propertychangelistener
has title: PropertyChangeListener and polymorphism inconsistencies (with packages)
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26179938
has comment: http://stackoverflow.com/comment/40944480
type: Question
has comment: http://stackoverflow.com/comment/40950832
tagged with: groovy
has comment: http://stackoverflow.com/comment/40852648
accepted answer: http://stackoverflow.com/a/26179938
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26193100
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/26193405
has body: take the following as an example: public class Person { private String name; private Achievements achievements; public Person(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Achievements getAchievments() { return achievements; } } and the achievements class: public class Achievements { public int amount() { ... } } if i would be using the class regularly, i would go like : Person p = new Person("John"); p.getAchievements().amount(); however, if i want to use the reflection API, how would i go about reaching to the amount(); step? i know how to reach to the getAchievements(); however i'm blocked from the rest. thanks
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/41071795
has title: How to accept Class return in reflection?
score: -1
tagged with: class
has comment: http://stackoverflow.com/comment/41071920
answer count: 1
has comment: http://stackoverflow.com/comment/41071917
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41071785

http://stackoverflow.com/a/36726355
type: Answer
has body: Please check your Antivirus/Malware. If you are using corporate developer machine please contact your administrator to remove that access protection rule. I had the same problem, my McAfee was blocking all the request. Blocked by port blocking rule C:\PROGRAM FILES\JAVA\JDK1.8.0_74\BIN\JAVAW.EXE Anti-virus Standard Protection:Prevent mass mailing worms from sending mail 0:0:0:0:0:ffff:4a7d:7e6d:587 found this in Access protection log and requested my admin to remove that rule. Try this might help you.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26087018
downvote count: 0

http://stackoverflow.com/comment/40915946
score: 1
has text: The problem was PreparedStatement's named parameter syntax conflicts with Oracle's :new syntax, and there is no way to escape named parameters in PreparedStatements. So you have use a Statement instead of PreparedStatement to subvert this little issue.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26080786

http://stackoverflow.com/a/26054226
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/26052330
answers question: http://stackoverflow.com/q/26052330
score: 3
has body: Try something like this... public void setGradientColor(int endColor, int startColor) { GradientDrawable gradient = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {endColor, startColor}); gradient.setShape(GradientDrawable.RECTANGLE); gradient.setCornerRadius(10.f); btnNext.setBackgroundDrawable(gradient); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26053570
downvote count: 0
upvote count: 2
has body: Here is simple example: import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; public class TestFrame extends JFrame { private JLabel lbl; private JTree tree; public TestFrame() { init(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } private void init() { tree = new JTree(); tree.getSelectionModel().addTreeSelectionListener(getListener()); lbl = new JLabel("empty"); add(new JScrollPane(tree)); add(lbl,BorderLayout.EAST); } private TreeSelectionListener getListener() { return new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); lbl.setText(node == null ? "empty" : node.toString()); } }; } public static void main(String args[]) { new TestFrame(); } } Read more in tutorial.
answers question: http://stackoverflow.com/q/26052903
type: Answer
score: 2

http://stackoverflow.com/comment/40864969
comment on: http://stackoverflow.com/q/26080354
type: Comment
type: QuestionComment
has text: try recursion with 10second time out. `Thread.sleep(10000)` or something like that. It is not necessary to use `scheduledExecutorService`. Also make sure you do not start that in the UI thread. Try `class MyAsyncClass extends AsyncTask<Void, Void, Void> { }` then `new RetreivePicture().execute();`
score: 0

http://stackoverflow.com/comment/40909539
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26104767
score: 0
has text: Well, you're using else if logic, only one if statement would get executed ever.

http://stackoverflow.com/a/26076353
answers question: http://stackoverflow.com/q/26076322
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: I think your issue is right here: while((line = br.readLine()) != null) { if(count == 0) { count++; continue; } players.add(br.readLine()); } You're reading a new line each time, even though you already read one. You want this: while((line = br.readLine()) != null) { if(count == 0) { count++; continue; } players.add(line); //The important change is here. }
accepted answer of: http://stackoverflow.com/q/26076322

http://stackoverflow.com/q/26161381
has comment: http://stackoverflow.com/comment/41015909
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26161600
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41015761
has body: I am trying to implement the Quicksort method written in java on Rosettacode.org. http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Java However, I do not know how to add elements to a LinkedList of type E in order to use the method. public static &lt;E extends Comparable&lt;? super E&gt;&gt; void main(String[] args) { List&lt;E&gt; list = new LinkedList&lt;E&gt;(); list.add(1); } I get the following error when I try to compile: QuickSort.java:12: error: no suitable method found for add(int) list.add(1); ^ method List.add(int,E) is not applicable (actual and formal argument lists differ in length) method List.add(E) is not applicable (actual argument int cannot be converted to E by method invocation conversion) method Collection.add(E) is not applicable (actual argument int cannot be converted to E by method invocation conversion) where E is a type-variable: E extends Comparable&lt;? super E&gt; declared in method &lt;E&gt;main(String[]) 1 error make: *** [c] Error 1
has answer: http://stackoverflow.com/a/26161508
possible better answer: http://stackoverflow.com/a/26161508
accepted answer: http://stackoverflow.com/a/26161600
has comment: http://stackoverflow.com/comment/41013380
has title: How to create Java List of Type E extends Comparable<? super E>
type: AnsweredQuestion

http://stackoverflow.com/q/26077872
has answer: http://stackoverflow.com/a/26077941
has answer: http://stackoverflow.com/a/26079383
type: Question
tagged with: java
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26077941
tagged with: bufferedreader
has title: BufferedReader readLine returns strange characters
has body: I'm trying to read JSON data from a URL and I'm getting a very strange behaviour. I have a ExpandableListView, and every item has a button to recover online data. The first time you click the button, it works perfectly, but any attempt subsequent fails. In these attempts, the method readLine returns weird characters: ��������������Y�o�F�W&lt;��2e=�P��Hω/͹���mKr)nEr�ݥ%��ޙ!)R�[��w������&lt;����Le:O��i��&amp;N�9!�D�T�171�&lt;�ej���e��Wք*��8�0��n�R���,��/`(+�D�%�D����'���"�� I can't understand why it only works the very first time. Even weirder is the fact that it happens on the physical devices, but not on the emulator. My code is: public static String readContents(String url) { HttpURLConnection con = getConnection(url); if (con==null) return null; try { StringBuilder sb = new StringBuilder(8192); String tmp; BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF8")); while((tmp = br.readLine()) != null) sb.append(tmp).append("\n"); br.close(); return sb.toString(); } catch(IOException e) { Log.d("READ FAILED", e.toString()); return null; } }
accepted answer: http://stackoverflow.com/a/26079383
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/40902915
score: 0
has text: There are 2 lines between the print that works and the one that doesn't work. Use the debugger to check which line is hanging.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26100995

http://stackoverflow.com/a/26052223
has comment: http://stackoverflow.com/comment/40813236
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26052179
has body: You will have to modify your constructor of Door class like public Door(String name, String state) { this.name=name; this.state=state; } Actually name and state are not getting initialized. Also see this What is the meaning of "this" in Java? Modified Code Snippet: public class Door { // Create instance variables of type String private String name; private String state; // Declare method 'open' and 'close' public void open() { state = "open"; } public void close() { state = "closed"; } // Add a constructor for the Door class public Door(String name, String state) { this.name=name; this.state=state; } // Create an accessor of 'state' public String getState() { return state; //<<<<<<<----------also make an Edit here } // Set the state public void setState(String newState) { state = newState; } }
type: Answer
has comment: http://stackoverflow.com/comment/40813225
downvote count: 0

http://stackoverflow.com/comment/40895242
type: Comment
type: QuestionComment
has text: Do u hv any value in datadao? Varaible.?show stack trace
comment on: http://stackoverflow.com/q/26094396
score: 0

http://stackoverflow.com/q/26179609
answer count: 1
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26179651
type: AnsweredQuestion
type: Question
has body: Hello every one I trying to build a basic program of finding the area and perimeter of a triangle. I am pretty new to eclipse. The compiler doesn't run or show errors for this program but runs the program which was previously run. The code of my program is : import java.util.Scanner; public class Solution { public static void main() { Scanner input=new Scanner(System.in); double b,h,o,t; System.out.println("Enter the length of base"); b=input.nextDouble(); System.out.println("Enter the length of heigth"); h=input.nextDouble(); System.out.println("Enter the length of sideOne"); o=input.nextDouble(); System.out.println("Enter the length of sideTwo"); t=input.nextDouble(); input.close(); Attributes Val= new Attributes(); Val.setbase(b); Val.setheight(h); Val.setsideOne(o); Val.setsideTwo(t); double result=Val.area(); System.out.println("the area of triangle is:"+result); result=Val.peri(); System.out.println("the perimeter of triangle is:"+result); } } The other class is public class Attributes { private double base,height,sideOne,sideTwo; public double area() { double area=this.base*this.height/2; return area; } public double peri() { double peri=base+sideOne+sideTwo; return peri; } public double getbase() { return this.base; } public double getheight() { return this.height; } public double getsideOne() { return this.sideOne; } public double getsideTwo() { return this.sideTwo; } public void setbase(double base) { this.base=base; } public void setheight(double height) { this.height=height; } public void setsideOne(double sideOne) { this.sideOne=sideOne; } public void setsideTwo(double sideTwo) { this.sideTwo=sideTwo; } } Could you help me with the issue and suggest me if any errors are present in the program. Thanks in advance. :)
has title: Not even a error nor the program is running in eclipse
has comment: http://stackoverflow.com/comment/41047140
has comment: http://stackoverflow.com/comment/41047746
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26179651

http://stackoverflow.com/comment/40796758
score: 1
has text: You're setting the values of the `mileage2` to a counter variable. This will return a constant result based on the counter's iteration, not based on the average of the entries.. Consider using a `List<Double>` to store the results of all `mileage1.getMpg()` calls, then use that list to find the average.
comment on: http://stackoverflow.com/q/26043037
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26079889
type: Question
tagged with: testing
upvote count: 1
has answer: http://stackoverflow.com/a/26079945
possible better answer: http://stackoverflow.com/a/26126030
has answer: http://stackoverflow.com/a/26126030
has body: I have been staring at this code for quite some time now and I really can't figure out how and what to do for its JUnit testing. static void printList(OrderedIntList list) { System.out.print("["); for (int i = 0; i &lt; list.orderedIntegerList.length; i++) { System.out.print(list.orderedIntegerList[i]); if (i != list.orderedIntegerList.length - 1) { System.out.print(", "); } } System.out.println("]"); } This code is from a utility class called orderedIntList, which is an array list.
favorite count: 0
answer count: 3
tagged with: junit
has title: How can I JUnit test "printlist"?
has answer: http://stackoverflow.com/a/26168561
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40865733
accepted answer: http://stackoverflow.com/a/26079945

http://stackoverflow.com/a/76902768
type: Answer
has body: Part of methods are deprecated in RecyclerView. So relevant for use is viewHolder.getAbsoluteAdapterPosition() or viewHolder.getBindingAdapterPosition() simplified code snippet inside any click listener or callback: val adapterPosition = viewHolder.getBindingAdapterPosition() items.removeAt(adapterPosition) notifyItemRemoved(adapterPosition)
score: 0
answers question: http://stackoverflow.com/q/26076965

extglob
tags question: http://stackoverflow.com/q/26042753
type: Tag
tag name: extglob

http://stackoverflow.com/a/26114605
type: Answer
has body: Do not use get() to call the AsyncTask, it hangs your UI. So call your AsyncTask like, String userName = txtusername.getText().toString().trim(); new validateusername().execute(userName); // pass the String from EditText, as you cannot interact with UI in doInBackground Modify your AsyncTask like public class validateusername extends AsyncTask&lt;String,Void,String&gt; { @Override protected String doInBackground(String... arg0) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(URL); List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;(); pairs.add(new BasicNameValuePair("username",arg0[0])); // arg0[0] is the username passed from AsyncTask call try { httppost.setEntity(new UrlEncodedFormEntity(pairs)); response = httpclient.execute(httppost); result=responsetostring.getResponseBody(response); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } @Override protected void onPostExecute(String result1) { try { jsonobj=new JSONObject(result); job2=jsonobj.getJSONObject("server_message"); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { finalresult=job2.getString("username_availability_message"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(finalresult.equals("exist")){ txtusername.setError("Username exsists!"); isUsernameValid=false; } else if(finalresult.equals("available")) { isUsernameValid=true; } if(txtfullname.getText().toString().trim().length()==0) { txtfullname.requestFocus(); txtfullname.setError("Field required"); isallValid=false; } if(txtdob.getText().toString().trim().length()==0) { txtdob.requestFocus(); txtdob.setError("Field required"); isallValid=false; } if(txtoccupation.getText().toString().trim().length()==0) { txtoccupation.requestFocus(); txtoccupation.setError("Field requ…
score: 0
answers question: http://stackoverflow.com/q/26114468

http://stackoverflow.com/q/26123520
favorite count: 0
has comment: http://stackoverflow.com/comment/40943361
score: -3
has title: Trying to create a program that sums up two items in an array
has answer: http://stackoverflow.com/a/26123912
downvote count: 3
has comment: http://stackoverflow.com/comment/40943430
has comment: http://stackoverflow.com/comment/40943410
has comment: http://stackoverflow.com/comment/40943431
type: AnsweredQuestion
has body: Hello Stack Overflow Community, I'm trying to write a program that will take the numbers inputted (by the user) in an array and sum up two numbers in opposite order. For example, the array has 10 entries, so it's the 1st + 10th, then the 2nd + 9th, each putting the sum on a new line. I have a current program for starts but I can't get the method or array needed. I tried to create a 2nd array that has the initial input in reverse order so that I can sum the entries but when I try to print the list I get an error. Here is the code: I am a very beginner coder so any help with what the code would look like would be highly appreciated! import java.text.*; // general package for formatting import java.util.Scanner; // for scanner import javax.swing.*; public class ArraySummation { public static void main(String[] args) { String input; int number, j = 0; int[] arr, arr2; Scanner keyboard = new Scanner(System.in); System.out.print("How many numbers do you want to enter?"); number = keyboard.nextInt(); arr = new int[number]; for (int index = 0; index &lt; arr.length; index++) { System.out.print("Enter number: "); arr[index] = keyboard.nextInt(); } arr2 = new int[arr.length]; for (int i = arr.length - 1; i &gt;= 0; i--) { arr2[j++] = arr[i]; } System.out.println(arr); System.out.println(arr2); } }
has comment: http://stackoverflow.com/comment/40943290
tagged with: java
has answer: http://stackoverflow.com/a/26123744
accepted answer: http://stackoverflow.com/a/26123744
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26123912
upvote count: 0
tagged with: arrays

http://stackoverflow.com/q/26043037
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26043448
upvote count: 1
has title: Java MPG calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/40796758
possible better answer: http://stackoverflow.com/a/26043448
type: AnsweredQuestion
has body: I've finished most of the code for a simple MPG calculator. My main issue right now is at the end of the program I need it to calculate the average MPG of all of the miles the user decides to enter in. I'm getting some number, but it isn't the correct one. If you could beseech your knowledge on me, that would be amazing. Please let me know if there are other problems as well, I'm up to whatever criticism. import java.util.Scanner; public class GasMileage { public static void main(String[] args) { GasMileage mileage1 = new GasMileage(); GasMileage mileage2 = new GasMileage(); Scanner input = new Scanner(System.in); System.out.println("Welcome to the MPG calculator!"); double counterM; double counterG; double mileage; double gallons; double mpg; double average; String repeat = "yes"; while (repeat.equals("Yes") || repeat.equals("yes") || repeat.equals("y") || repeat.equals("Y")) { System.out.println("Enter miles driven: "); mileage = input.nextDouble(); counterM = mileage++; mileage1.setMilesDriven(mileage); mileage2.setMilesDriven(counterM); System.out.println("Enter gallons used: "); gallons = input.nextDouble(); counterG = gallons++; mileage1.setGallonsUsed(gallons); mileage2.setGallonsUsed(counterG); mileage1.setMpg(mileage, gallons); mileage2.setMpg(counterM, counterG); mpg = mileage1.getMpg(); System.out.println("Your mpg is: " + mpg); System.out.println("repeat? "); repeat=input.next(); } average = mileage2.getMpg(); System.out.println("Your total average mpg is: " + average); } double milesDriven; double gallonsUsed; double mpg1; public void setMilesDriven(double Miles) { milesDriven = milesDriven + Miles; } public void setGallonsUsed(double Gallons) { gallonsUsed = gallonsUsed+Gallons; } public double getMilesDriven() { return milesDriven; } public double getGallonsUSed() { return gallonsUsed; } public void setMpg(double setM, double setG) { mpg1 = (setM) / setG; } public double getMpg() { return mpg1; } }
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26043395
accepted answer: http://stackoverflow.com/a/26043395

http://stackoverflow.com/a/26050514
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26050410
answers question: http://stackoverflow.com/q/26050410
downvote count: 0
type: AcceptedAnswer
score: 4
has body: maybe you can do it like this : private void CallMultipleToast(){ Thread t = new Thread(){ @Override public void run(){ try { for(i=0;i&lt;7;i++){ Toast("Message "+(i+1)); sleep(5000); } } catch (InterruptedException ex) { Log.i("error","thread"); } } }; t.start(); }
type: Answer

http://stackoverflow.com/comment/40817778
has text: @Shoaib What should i provide? It is a managed bean. retrieveAllCarsAssignedToManagers and retrieveAllCarType are two hql queries of return type List<Object>.The output the first query(retrieveAllCarsAssignedToManagers ) is use as parameter to the second query (retrieveAllCarType ) Hoe this help. Glad if u can help. Thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26054580
score: 0

http://stackoverflow.com/a/26078181
has body: Depends. Three solutions, none of which may be ideal: If your can use consecutive numbers as keys (you could add a second key if you already have another business id), generate a random key in Java and query by id. Try ORDER BY RAND() and get the first 60 results, but this is not portable since RAND or RANDOM are not part of the JPA spec. Select all records and use EntityManager.setFirstResult (random).setMaxResults (1) to scroll to a random row and repeat 60 times.
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26076973

http://stackoverflow.com/comment/41065602
has text: Thank you, I am trying this right now... I am new to swing and all this stuff, so sorry for the obvious questions :)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26189212
type: Comment

http://stackoverflow.com/a/26166672
accepted answer of: http://stackoverflow.com/q/26166639
type: Answer
answers question: http://stackoverflow.com/q/26166639
upvote count: 6
has comment: http://stackoverflow.com/comment/41024219
score: 6
has comment: http://stackoverflow.com/comment/41029929
has comment: http://stackoverflow.com/comment/41023944
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41023402
has body: Your local variable is hiding the instance variable Change JButton btnNew = new JButton("This is New Button"); to btnNew = new JButton("This is New Button"); EDIT According to your question as a comment... but it would be better to ask a new question or post your code at https://codereview.stackexchange.com/. What I mean is that your inner class ShowButtonHandler depends on the outer class TestButton, because it uses the outer class's field btnNew. class ShowButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { btnNew.setVisible(true); } } But this dependency is not necessary. The ShowButtonHandler only needs a reference to a JButton that it must set visible when an action is performed. So in a first step you can break the dependency to the outer class by simply pass the button as a constructor argument. class ShowButtonHandler implements ActionListener { private JButton btnNew; public ShowButtonHandler(JButton btnNew){ this.btnNew = btnNew; } public void actionPerformed(ActionEvent e) { btnNew.setVisible(true); } } Now you realize that the ShowButtonHandler could be more flexible to allow reuse. You take a look at the class hierarchy and you see that setVisible can be done for any JComponent. So you can make the class more general. class ShowComponentHandler implements ActionListener { private JComponent component; public ShowComponentHandler(JComponent component){ this.component = component; } public void actionPerformed(ActionEvent e) { component.setVisible(true); } } Since the ShowButtonHandler is now independent and has a more general API it can be placed in an own compilation unit (java file) and be re-used. In your TestButton class you can still use it ActionListener showComponentAction = new ShowComponentHandler(btnNew); btnShow.addActionListener(showComponentAction);

http://stackoverflow.com/comment/40942116
type: Comment
type: QuestionComment
has text: @nandeesh, the call is being made on the activity, look at the last part of the code snippet.
score: 0
comment on: http://stackoverflow.com/q/26114008

http://stackoverflow.com/comment/40920363
score: 2
type: QuestionComment
has text: the answer to this is in the javadoc for the class.
comment on: http://stackoverflow.com/q/26110579
type: Comment

http://stackoverflow.com/a/26209465
has body: I have had a bit of a look around for such a table and was unable to find one. The reference to UnsupportedAttributeTypeException doesn't really speak much for your question, and each of the model descriptions do not indicate the supported data types either. Those who have a good knowledge of the models would have a fair idea of what should and shouldn't work, but if you are unsure about the mechanics of these models and want to give them a go, the above messages can likely appear. Some data types can be converted to others to allow support for these models, such as NominalToBinary, but sometimes the models simply will not fit the data you would like to use. It would be nice as a reference to see the supported data types for the model, though the errors outlined above provide a meaningful (though perhaps not so elegant) response that the data is unsupported for the model. Sorry I couldn't help further.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26188613
has comment: http://stackoverflow.com/comment/41132711
answers question: http://stackoverflow.com/q/26188613
downvote count: 0
type: AcceptedAnswer
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41214896
has comment: http://stackoverflow.com/comment/41124874

http://stackoverflow.com/comment/40976684
score: 0
type: Comment
type: QuestionComment
has text: Okay I am confused, I am reproducing a pure Java function above. I want an equavalent in Joda. Not in terms of do my homework but I am not accounting for anything except for Years.
comment on: http://stackoverflow.com/q/26141695

http://stackoverflow.com/comment/41048201
type: Comment
has text: @greg-449 i concur with you.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26179913

http://stackoverflow.com/comment/41023250
has text: @njzk2 Thanks. I try to implement your suggests, then I will let you know.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26166440

http://stackoverflow.com/a/26616549
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42950344
has body: For those who are seeking a solution for this, I just figured out that I need to create a Data Connector Extension, as in this url
answers question: http://stackoverflow.com/q/26167954

http://stackoverflow.com/q/26042547
has comment: http://stackoverflow.com/comment/40795695
has comment: http://stackoverflow.com/comment/40796330
has title: Program worked fine, but now i cant spot the error
type: AnsweredQuestion
has body: I ran the program and it was working fine and i dont know what i did, but this is what i get in the dialog box. It should say April 5 not error5 Please enter a year to calculate Easter Sunday &gt;2015 error5 Can anyone spot where the error is from? and also another question is do i need all the case 1-12 and all the months? Or can i just get by with april since its the only month im using to calculate easter sunday. import java.util.Scanner; public class Easter { public static void main(String[] args) { System.out.print("Please enter a year to calculate Easter Sunday\n&gt;"); Scanner s = new Scanner(System.in); int inputted = getResult(s); while(inputted &lt;= 0) { System.out.print("Expected a positive year. Please try again:\n&gt;"); inputted = getResult(s); } System.out.println(getEasterSundayDate(inputted)); } private static int getResult(Scanner s) { while(!s.hasNextInt()) { System.out.print("Expected a valid year. Please try again:\n&gt;"); s.nextLine(); } return s.nextInt(); } public static String getEasterSundayDate(int year) { int a = year % 19, b = year / 100, c = year % 100, d = b / 4, e = b % 4, g = (8 * b + 13) / 25, h = (19 * a + b - d - g + 15) % 30, j = c / 4, k = c % 4, m = (a + 11 * h) / 319, r = (2 * e + 2 * j - k - h + m + 32) % 7, n = (h - m + r + 90) / 25, p = (h - m + r + n + 19) % 32; String result; switch(n) { case 1: result = "April "; break; default: result = "error"; } return result + p; } }
tagged with: java
has comment: http://stackoverflow.com/comment/40796112
has answer: http://stackoverflow.com/a/26043427
linked to: http://stackoverflow.com/q/26022233
has comment: http://stackoverflow.com/comment/40795867
type: Question
has comment: http://stackoverflow.com/comment/40795483
accepted answer: http://stackoverflow.com/a/26043427
has comment: http://stackoverflow.com/comment/40796108
score: 0
has comment: http://stackoverflow.com/comment/40795553
has comment: http://stackoverflow.com/comment/40795782
has comment: http://stackoverflow.com/comment/40795648
answer count: 1
has comment: http://stackoverflow.com/comment/40796724
has comment: http://stackoverflow.com/comment/40795841
has comment: http://stackoverflow.com/comment/40796051

http://stackoverflow.com/q/26162191
tagged with: substring
has answer: http://stackoverflow.com/a/26162345
answer count: 2
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/26162264
score: -1
has body: I have a list of strings of the format "The Url is http://m.gap.com/division.html?dn=gd5646" The output for the program is a list of urls with the word product in it. I have managed to obtain the urls using regex in java but I dont understand how to check if the word product is also present.
downvote count: 1
type: Question
has title: How to check if a word is present in a substring of a string using java Regex
tagged with: java

http://stackoverflow.com/q/26073425
tagged with: java
has answer: http://stackoverflow.com/a/26073497
tagged with: swing
type: Question
tagged with: ubuntu
answer count: 2
tagged with: bash
has comment: http://stackoverflow.com/comment/40853715
downvote count: 0
accepted answer: http://stackoverflow.com/a/26073455
favorite count: 0
has title: Executing Bash Script Returns Null In Java
tagged with: linux
has body: I'm using UBUNTU/LINUX I'm trying to build swing application for myself(this app need to work other platforms too) and i can not execute some commands on java. I tried to execute "java -version" Here is my code: Runtime run = Runtime.getRuntime(); Process p = run.exec("java -version"); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()))) { for (String output = br.readLine(); output != null; output = br.readLine()) { System.out.println(output); } } catch (IOException e) { System.out.println(e); } It returns blank page no output! However i can execute run.exec("ls") / or ("gedit") and so on... and I GET DATA Also i can execute internal programs that in my computer. Why i cant execute .sh files or built-in java commands and getting blank page?
has answer: http://stackoverflow.com/a/26073455
possible better answer: http://stackoverflow.com/a/26073497
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/26134896
has comment: http://stackoverflow.com/comment/40964321
type: Question
score: 9
upvote count: 9
has answer: http://stackoverflow.com/a/26135179
has comment: http://stackoverflow.com/comment/40964024
accepted answer: http://stackoverflow.com/a/26135179
has comment: http://stackoverflow.com/comment/135111244
answer count: 1
downvote count: 0
favorite count: 0
has body: Going through Herbert Schildt : The Complete Reference Chapter 10 Exception Handling Exception handling provides a powerful mechanism for controlling complex programs that have many dynamic run-time characteristics. It is important to think of try, throw, and catch as clean ways to handle errors and unusual boundary conditions in your program’s logic. Unlike some other languages in which error return codes are used to indicate failure, Java uses exceptions. Thus, when a method can fail, have it throw an exception. This is a cleaner way to handle failure modes. One last point: Java’s exception-handling statements should not be considered a general mechanism for nonlocal branching. If you do so, it will only confuse your code and make it hard to maintain. What does he mean by the term 'nonlocal branching'?
has title: Why Java’s exception-handling statements should not be considered a general mechanism for nonlocal branching?
tagged with: exception
has comment: http://stackoverflow.com/comment/40964396
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26046678
has comment: http://stackoverflow.com/comment/40807018
score: 8
type: Answer
has comment: http://stackoverflow.com/comment/40803575
accepted answer of: http://stackoverflow.com/q/26046608
downvote count: 0
has body: Use a StreamResult. It provides constructors to write to a File or an OutputStream: Example using File: transformer.transform(new StreamSource(agent), new StreamResult(file)); Example using FileOutputStream: FileOutputStream outputStream = new FileOutputStream(new File("outputfile.xml")); transformer.transform(new StreamSource(agent), new StreamResult(outputStream)); Example using ByteArrayOutputStream: ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); transformer.transform(new StreamSource(agent), new StreamResult(outputStream)); byte[] bytes = outputStream.toByteArray();`
answers question: http://stackoverflow.com/q/26046608
upvote count: 8
has comment: http://stackoverflow.com/comment/40803417
type: AcceptedAnswer

http://stackoverflow.com/q/26043258
has title: Inflate TextViews right of anohter TextView in a RelativeLayout not working Android
type: Question
has comment: http://stackoverflow.com/comment/40803741
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40797117
tagged with: arraylist
score: 0
has body: I'm trying to inflate a layout inside a layout and add several TextViews inside it. To do so, I have an arrayList of the titles I want for each textview and also I have an array of TextViews of the same size of the arrayList. Thing is, this code only inflates ONE TextView (the last one in the arrayList). public void inflatePeriodGradeRightOf() { AcademicStatusController.getInstance(this); Log.d(TAG, "type="+instanceType+" id= "+instanceId); ArrayList<Item> periodsInfo = AcademicStatusController .getPeriodsInfo(instanceType, instanceId); RelativeLayout llDisplayData = (RelativeLayout) findViewById(R.id.help_relative_layout_for_periods); // Params to add some new rules RelativeLayout.LayoutParams relativeLayoutParams; relativeLayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); TextView tvtxt; TextView[] textViews = new TextView[periodsInfo.size()]; int i = 0; for (Item info : periodsInfo) { // Inflate the view of the period View customView = inflater.inflate( R.layout.activity_academic_status_period_layout, null); textViews[i] = new TextView(this); // Add the first textView and then add the others right of the last // one PeriodItem item = (PeriodItem) info; if (periodsInfo.get(0) == info) { // Set the text to the TextView. textViews[i].setText(item.getName()); textViews[i].setId(i+1); llDisplayData.addView(customView); } else { // Set the text to the TextView. textViews[i].setText(item.getName()) textViews[i].setId(i+1); relativeLayoutParams.addRule(RelativeLayout.RIGHT_OF, textViews[i-1].getId()); textViews[i].setLayoutParams(relativeLayoutParams); llDisplayData.addView(customView, relativeLayoutParams); } i++; } } My "main" layout which is where I'm supposed to add the TextViews looks like this: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="m…
has comment: http://stackoverflow.com/comment/40797305
answer count: 1
has comment: http://stackoverflow.com/comment/40797240
tagged with: android
has answer: http://stackoverflow.com/a/26048237
accepted answer: http://stackoverflow.com/a/26048237
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40797997
has comment: http://stackoverflow.com/comment/40797189

http://stackoverflow.com/comment/40944023
type: Comment
comment on: http://stackoverflow.com/q/26123895
score: 0
type: QuestionComment
has text: Define not working, what is your output? It's throwing an exception?

http://stackoverflow.com/q/26072926
accepted answer: http://stackoverflow.com/a/26073335
tagged with: network-programming
has comment: http://stackoverflow.com/comment/40851461
answer count: 1
tagged with: bytebuffer
has answer: http://stackoverflow.com/a/26073335
score: 0
has body: I'm writing a server/client program that clients send text message to server.I have used non-blocking I/O (NIO API) but messages on the server do not display correctly.this is my code on server: private JTextArea displayArea; private int numBytes; private ByteBuffer buffer; /*... some code is here ...*/ displayArea = new JTextArea(); add(new JScrollPane(displayArea), BorderLayout.CENTER); setSize(400, 500); setVisible(true); /*... some code is here ...*/ buffer = ByteBuffer.allocate(20); buffer.clear(); displayArea.append("reading data..."); do{ numBytes = socketChannel.read(buffer); }while(numBytes == -1); displayArea.append("\nData read."); buffer.flip(); int usedBytes = buffer.position(); byte[] bufferArray = buffer.array(); String message = new String(bufferArray, 0, usedBytes); displayArea.append("\n"+message); And this is a piece of client code: byte[] byteData = message.getBytes(); buffer.put(byteData); socketChannel.write(buffer); buffer.clear(); In run time when a client send message to server , space characters or a piece of message is shown.
has title: Sending message using non-blocking I/O in java(NIO API)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40851508
has comment: http://stackoverflow.com/comment/40851200
tagged with: nio
type: Question

http://stackoverflow.com/comment/44548480
has text: Also, notice that the question mention the column type as 'timestamp without time zone'; so I would expect to get back a timestamp without time zone when I read it from the db (at least, by default). Basically, if you read the timestamp from the db then you write it back to the db AS-IS, you actually shift it... not nice.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28084905
type: Comment

http://stackoverflow.com/a/26050373
type: Answer
answers question: http://stackoverflow.com/q/26050317
has body: easiest way to do that would be to create an array of Teacher and then inside your while loop, put a for loop that loops through all your Teacher objects and checks the room number. or even better, make an array of just room numbers and loop through that. also, you probably want to instantiate the scanner outside the while loop, then do while(scan.hasNextInt()){... so it would be something like Scanner scan = new Scanner(System.in); Teacher[] teachears... while (scan.hasNextInt()) { input = scan.nextInt(); boolean isARoom = false; for(Teacher teach : teachers){ if(input == teach.getRoom()) { isARoom = true; } } if(isARoom) System,out.println("Yes"); else System,out.println("No"); }
score: 0

http://stackoverflow.com/q/26076117
accepted answer: http://stackoverflow.com/a/26076159
has comment: http://stackoverflow.com/comment/40856948
score: 0
tagged with: java
answer count: 1
tagged with: .class-file
has comment: http://stackoverflow.com/comment/40856878
tagged with: decompiling
tagged with: eclipse
has title: converting .class into .java
has answer: http://stackoverflow.com/a/26076159
has comment: http://stackoverflow.com/comment/40856920
type: AnsweredQuestion
type: Question
tagged with: reverse-engineering
has comment: http://stackoverflow.com/comment/40856876
has body: I deleted a Java project from my hard disk in an attempt to do some refactoring with Eclipse. Luckily I found a recent version of an Executable Jar File and decrompressed it into a bunch of .class files. I've read some 'decompiling' threads on SO and tried showmycode.com, but I was hoping for more. Isn't it possible to convert .class files into the .java files that made them, comments included - nothing changed? Or find the in the .jar file? What are my best options if not? Other answers on the topic seem outdated. Do I need to download software?

http://stackoverflow.com/comment/40950966
type: Comment
has text: It depends on the use case. Take a look at [jasypt](http://www.jasypt.org/) to get some things out of the box. Then, you can choose to store encrypted stuff in files, database, etc.
type: AnswerComment
comment on: http://stackoverflow.com/a/26124020
score: 0

http://stackoverflow.com/q/26100245
answer count: 0
has comment: http://stackoverflow.com/comment/40901412
tagged with: java
tagged with: criteriaquery
type: Question
has body: I have an array of ids, long[] ids, and I want to retrieve a List of entities that have the ids from the id array using CriteriaQuery. I tried to achieve this with the following code: for (int i = 0; i &lt; orderIds.length; i++) { criteriaQuery.select(root); criteriaQuery.where(criteriaBuilder.equal(path,orderIds[i])); List&lt;E&gt;certificates=super.entityManager.createQuery(criteriaQuery).getResultList(); map.put(orderIds[i], certificates); } This code returns a Map, but I want to retrieve a list of all the entities E that have the ids among the orderIds list. How can I do it? Thank you!
has title: Retrieving a list of entites based on an array of ids
score: 0
upvote count: 1
tagged with: jpa
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40900939

http://stackoverflow.com/comment/40972186
type: QuestionComment
has text: A save doesn't do anything if the object is already a hibernate managed instance. You are modifying a managed instance so as soon as the method ends (and I assume you have transactions setup) the method will do a commit on the transaction and the updates (yes updates) will be flushed and committed to the database. You could remove the save and it would still do the same.
comment on: http://stackoverflow.com/q/26139347
score: 0
type: Comment

http://stackoverflow.com/comment/40831118
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26061753
has text: You should be able to find plenty of good examples and code bases online. Do a little research! I like to keep PreAuthorize annotations at the service layer for a number of reasons.

http://stackoverflow.com/a/26158134
has body: you are not supposed to call mRecorder.start(); when mRecorder.prepare(); fails. this is what caused the Illegal State Exception to be thrown. Not all devices support all the encoding formats. try changing these mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); and mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); change the format and Encoder to a file format and encoding format your s3 device supports. for a start, change your encoding setting to default settings as follows and try if it works. mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
type: Answer
answers question: http://stackoverflow.com/q/26156451
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41008543
downvote count: 0

http://stackoverflow.com/comment/40936096
type: Comment
has text: Instead of method I think you should more concentrate on call of method and add null check before using the result of method.
type: QuestionComment
comment on: http://stackoverflow.com/q/26119951
score: 0

http://stackoverflow.com/comment/41132703
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26155043
has text: @MadProgrammer I'll accept that as an answer then Mad. i.e. The method is to open the existing JAR - copy what you need to a new jar, and clean up accordingly.
type: QuestionComment

http://stackoverflow.com/a/26187416
has body: Turns out this is pretty easy to do using Gson, especially with the JsonReader.getPath() method introduced in 2.3. static void parseJson(String json) throws IOException { JsonReader reader = new JsonReader(new StringReader(json)); reader.setLenient(true); while (true) { JsonToken token = reader.peek(); switch (token) { case BEGIN_ARRAY: reader.beginArray(); break; case END_ARRAY: reader.endArray(); break; case BEGIN_OBJECT: reader.beginObject(); break; case END_OBJECT: reader.endObject(); break; case NAME: reader.nextName(); break; case STRING: String s = reader.nextString(); print(reader.getPath(), quote(s)); break; case NUMBER: String n = reader.nextString(); print(reader.getPath(), n); break; case BOOLEAN: boolean b = reader.nextBoolean(); print(reader.getPath(), b); break; case NULL: reader.nextNull(); break; case END_DOCUMENT: return; } } } static private void print(String path, Object value) { path = path.substring(2); path = PATTERN.matcher(path).replaceAll(""); System.out.println(path + ": " + value); } static private String quote(String s) { return new StringBuilder() .append('"') .append(s) .append('"') .toString(); } static final String REGEX = "\\[[0-9]+\\]"; static final Pattern PATTERN = Pattern.compile(REGEX);
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26183948
answers question: http://stackoverflow.com/q/26183948
type: Answer

http://stackoverflow.com/q/26189852
tagged with: import
has title: failing to import external library in java project?
has comment: http://stackoverflow.com/comment/41066496
type: Question
has comment: http://stackoverflow.com/comment/41066428
tagged with: java
score: 0
has body: Here is a screenshot of netbeans Here, I have imported three jar libraries algs4.jar, stdlib.jar and acm.jar. Netbeans is importing acm finely but not importing algs4.jar and stdlib.jar. As you can see in line 3 there is no error but in line 4 it is showing error in importing, even in line 5 it is not showing algs4 and stdlib? What is going wrong here? update: here are some more screenshots. Here i have expanded the stdlib.jar. As you can see there is a .java file name AcyclicLP.java(first one) in that .jar.
tagged with: jar
has comment: http://stackoverflow.com/comment/41066731
linked to: http://stackoverflow.com/q/2193226
has comment: http://stackoverflow.com/comment/41066387
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2193226
tagged with: netbeans
answer count: 0
has comment: http://stackoverflow.com/comment/41066836
has comment: http://stackoverflow.com/comment/41066703

http://stackoverflow.com/q/26079354
has comment: http://stackoverflow.com/comment/40870036
has comment: http://stackoverflow.com/comment/40869635
type: Question
tagged with: java
tagged with: post
score: 0
has body: URL url = new URL("https://www.google.com/speech-api/v2/recognize?output=json&amp;lang=en-us&amp;key=mykey"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "audio/x-flac; rate=16000"); conn.setUseCaches(false); conn.setDoOutput(true); conn.setDoInput(true); conn.connect(); DataOutputStream wr = new DataOutputStream(conn.getOutputStream()); wr.write(bytearray); wr.flush(); wr.close(); InputStream stream = conn.getInputStream(); //throws io exception so basically I'm trying to send bytearray over httpurlconnection java.io.IOException: Error writing to server at last line.
has comment: http://stackoverflow.com/comment/40869840
has title: Error writing to server using Google API
has comment: http://stackoverflow.com/comment/40869948
tagged with: httpurlconnection
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41064895
type: Comment
has text: Wow duh. I was just testing out the new version of eclipse and thought this was a bug. Thanks. I can get back to my program now with the new eclipse :D
comment on: http://stackoverflow.com/a/26188927
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40838698
has text: I just want the user to view the file. I cannot even call my compiled html help file. The files are saved in my src folder within my project folder. Like I said everything works fine when I use netbeans, but once packaged into a jar file, nothing happens. When I click the button to open the file, nothing happens
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26065782
score: 0

http://stackoverflow.com/comment/44183052
score: 0
type: AnswerComment
type: Comment
has text: http://stackoverflow.com/questions/27063605/jcs-how-to-access-cache-in-two-different-applications-running-in-same-server/27891067#27891067
comment on: http://stackoverflow.com/a/26143005

http://stackoverflow.com/a/26059187
type: Answer
answers question: http://stackoverflow.com/q/26059061
score: 0
has body: You cannot simply cast char to boolean, but you can compare it to 'y' and 'n' public static boolean charToBool(char c) { // c = Character.toLowerCase(c); switch (c) { case 'y': return true; case 'n': return false; default: throw new IllegalArgumentException("Must be either 'y' or 'n'."); } }

http://stackoverflow.com/comment/41119299
comment on: http://stackoverflow.com/a/26156954
score: 1
type: AnswerComment
has text: I'm afraid your suffering from diminished expectations. If highly variable workloads are a feature/constraint of your system, your developers need to come up with an architecture to handle it and not dump the problem on the ops guys. Your system can't do any back pressure and just fails with OOMs if the workload is higher than the current max memory allows?
type: Comment

http://stackoverflow.com/comment/40936362
type: QuestionComment
has text: Yes, I posted the answer below :)
comment on: http://stackoverflow.com/q/26118587
score: 0
type: Comment

http://stackoverflow.com/a/26159571
has body: Since your container is a relative layout, you can make your inner imageView to align to the outer imageView, and put top margin and left margin. x and y are the coords of the point you want to put the image in, some_x and some_y is the size of innerView ImageView outerView = (ImageView) findViewById(R.id.outer_image_view); ImageView innerView = (ImageView) findViewById(R.id.inner_image_view); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(some_x, some_y) rlp.addRule(RelativeLayout.ALIGN_LEFT, R.id.outer_image_view); rlp.addRule(RelativeLayout.ALIGN_TOP, R.id.outer_image_view); rlp.leftMargin = x; rlp.topMargin = y; innerView.setLayoutParams(rlp);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26158927

http://stackoverflow.com/q/26096830
downvote count: 0
favorite count: 0
has title: ucanaccess is overloading the system, What to do?
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/26098270
tagged with: ucanaccess
tagged with: java
tagged with: mysql
answer count: 1
has body: The idea behind my app is to banish client's direct access to my database (which is in .mdb format) by downloading the whole .mdb file to the client side , recording changes done by them and uploading those changes once per day for each client. The issue i have is while using ucanaccess it seems that it loads the whole database each time getDatabase2() is called. in the console this what i get infinite times until the app has loaded. (And that will take alot of time). Is there anyway to make ucanaccess do the bridging stuff only (just the transaction )? or maybe i am using the wrong approche?? The .mdb file is 50Mo size with at max 80-100k entries. I am using windows XP, Eclipse, Java 7. the code for getDataBase is as follows private static Connection getDatabase2() throws Exception{ String url="jdbc:ucanaccess:////Jv1kbafap001/teams/Medic/database.mdb;memory=false"; String user="admin"; String pass=""; return DriverManager.getConnection(url,user,pass); }
has answer: http://stackoverflow.com/a/26098270
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26221786
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41150510
accepted answer of: http://stackoverflow.com/q/26145425
has comment: http://stackoverflow.com/comment/41150470
type: Answer
has comment: http://stackoverflow.com/comment/41125892
downvote count: 0
score: 1
has body: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // To quit the whole GUI. or dialog.dispose(); // After user clicks cancel. But as the cancel button is not explicitly created by you, you cannot call dialog.dispose() directly. BUT you still can. with 3 extra lines of code. to call dialog.dispose(), add a window listener(extend java.awt.event.WindowAdapter) on your dialog. and override the windowClosing() method. and write dialog.dispose() in its body. Snippet: dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent event) { dialog.dispose(); } } );
has comment: http://stackoverflow.com/comment/41126592
has comment: http://stackoverflow.com/comment/41136378
has comment: http://stackoverflow.com/comment/41150614
has comment: http://stackoverflow.com/comment/41150274
answers question: http://stackoverflow.com/q/26145425

http://stackoverflow.com/q/26072665
has body: Is there an array that I can reference the fields of an object from? The objects fields are of type String, String, String and int. Is it possible to reference these through an array?
favorite count: 0
has comment: http://stackoverflow.com/comment/40850714
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26072700
has answer: http://stackoverflow.com/a/26072722
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26072691
score: -2
has title: How can I reference the fields of an object in an array?
linked to: http://stackoverflow.com/q/1200621
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/40850728
has comment: http://stackoverflow.com/comment/40850910
has answer: http://stackoverflow.com/a/26072785
answer count: 4

http://stackoverflow.com/a/26092737
downvote count: 0
score: 5
has body: It's the documented behavior of the GridLayout class. Did you read the docs? When both the number of rows and the number of columns have been set to non-zero values, either by a constructor or by the setRows and setColumns methods, the number of columns specified is ignored. Instead, the number of columns is determined from the specified number of rows and the total number of components in the layout. So, for example, if three rows and two columns have been specified and nine components are added to the layout, they will be displayed as three rows of three columns. Specifying the number of columns affects the layout only when the number of rows is set to zero. "Specifying the number of columns affects the layout only when the number of rows is set to zero." Therefore, if you want to hold the number of columns constant, specify 0 for the rows: frame.setLayout(new GridLayout(0, 2));
answers question: http://stackoverflow.com/q/26092495
upvote count: 5
type: Answer

http://stackoverflow.com/comment/40957165
comment on: http://stackoverflow.com/q/26130608
type: QuestionComment
has text: How can it die with an Exception on line 44, and then complete the method successfully?
type: Comment
score: 0

spring-mvc
tags question: http://stackoverflow.com/q/26105693
tags question: http://stackoverflow.com/q/26187732
tags question: http://stackoverflow.com/q/26169515
tags question: http://stackoverflow.com/q/26106179
tags question: http://stackoverflow.com/q/26136283
tags question: http://stackoverflow.com/q/26108271
tags question: http://stackoverflow.com/q/26159336
tags question: http://stackoverflow.com/q/26112884
tags question: http://stackoverflow.com/q/26109203
tags question: http://stackoverflow.com/q/26186382
tags question: http://stackoverflow.com/q/26095029
tags question: http://stackoverflow.com/q/26115011
tags question: http://stackoverflow.com/q/26039862
tags question: http://stackoverflow.com/q/26179940
tags question: http://stackoverflow.com/q/26149822
tags question: http://stackoverflow.com/q/26066049
tags question: http://stackoverflow.com/q/26083654
tags question: http://stackoverflow.com/q/26110136
tags question: http://stackoverflow.com/q/26071072
tags question: http://stackoverflow.com/q/26174451
tags question: http://stackoverflow.com/q/26139407
tags question: http://stackoverflow.com/q/26053908
tags question: http://stackoverflow.com/q/26103642
tags question: http://stackoverflow.com/q/26162610
tags question: http://stackoverflow.com/q/26118099
tags question: http://stackoverflow.com/q/26112783
tags question: http://stackoverflow.com/q/26047903
tags question: http://stackoverflow.com/q/26148637
tags question: http://stackoverflow.com/q/26077915
tags question: http://stackoverflow.com/q/26181188
tags question: http://stackoverflow.com/q/26157804
tags question: http://stackoverflow.com/q/26154091
tags question: http://stackoverflow.com/q/26102916
tags question: http://stackoverflow.com/q/26111679
tags question: http://stackoverflow.com/q/26107317
tags question: http://stackoverflow.com/q/26058100
tag name: spring-mvc
tags question: http://stackoverflow.com/q/26119170
tags question: http://stackoverflow.com/q/26186464
tags question: http://stackoverflow.com/q/26080860
tags question: http://stackoverflow.com/q/26191230
tags question: http://stackoverflow.com/q/26174649
tags question: http://stackoverflow.com/q/26151673
tags question: http://stackoverflow.com/q/26175179
tags question: http://stackoverflow.com/q/26149784
tags question: http://stackoverflow.com/q/26085353
tags question: http://stackoverflow.com/q/26192854
tags question: http://stackoverflow.com/q/26121149
tags question: http://stackoverflow.com/q/26118315
tags question: http://stackoverflow.com/q/26176797
tags question: http://stackoverflow.com/q/26147123
tags question: http://stackoverflow.com/q/26095937
tags question: http://stackoverflow.com/q/26184714
tags question: http://stackoverflow.com/q/26075304
tags question: http://stackoverflow.com/q/26050047
tags question: http://stackoverflow.com/q/26052094
tags question: http://stackoverflow.com/q/26049810
tags question: http://stackoverflow.com/q/26045882
type: Tag
tags question: http://stackoverflow.com/q/26163737
tags question: http://stackoverflow.com/q/26138381
tags question: http://stackoverflow.com/q/26101420
tags question: http://stackoverflow.com/q/26128826
tags question: http://stackoverflow.com/q/26100992
tags question: http://stackoverflow.com/q/26165370
tags question: http://stackoverflow.com/q/26061240
tags question: http://stackoverflow.com/q/26072554
tags question: http://stackoverflow.com/q/26183966
tags question: http://stackoverflow.com/q/26060473
tags question: http://stackoverflow.com/q/26080364
tags question: http://stackoverflow.com/q/26102236
tags question: http://stackoverflow.com/q/26094987
tags question: http://stackoverflow.com/q/26155075
tags question: http://stackoverflow.com/q/26134331
tags question: http://stackoverflow.com/q/26069626
tags question: http://stackoverflow.com/q/26134846
tags question: http://stackoverflow.com/q/26126840
tags question: http://stackoverflow.com/q/26164353
tags question: http://stackoverflow.com/q/26035784
tags question: http://stackoverflow.com/q/26146049

http://stackoverflow.com/comment/40940337
has text: I made you a picture. @Jonny5 :)
type: Comment
score: 3
comment on: http://stackoverflow.com/a/26121532
type: AnswerComment

http://stackoverflow.com/a/26112443
has body: Before you can do anything, you need to know the offset of the mouse click from the corner of the shape, this will allow you to drag the object so it doesn't suddenly "jump" to your current mouse position... @Override public void mousePressed(MouseEvent e) { //... for (Shape shape : myShapes) { //... this.point = e.getPoint(); int deltaX = point.x - shape.getBounds().x; int deltaY = point.y - shape.getBounds().y; offset = new Point(deltaX, deltaY); //... } } } Then, you would calculate the delta of change, between the current mouse position and the offset. Because you're applying a translate, you also need to subtract the shape's current location, as the translation is based on the shape's current location and we only want to apply the amount of change @Override public void mouseDragged(MouseEvent e) { if (pressed) { int index = myShapes.indexOf(clickedShape); myShapes.remove(index); int deltaX = e.getPoint().x - offset.x; int deltaY = e.getPoint().y - offset.y; clickedShape = new Path2D.Double(clickedShape, AffineTransform.getTranslateInstance( deltaX - clickedShape.getBounds().x, deltaY - clickedShape.getBounds().y)); myShapes.add(index, clickedShape); point = e.getPoint(); repaint(); } } Now, having said all that, don't do this... protected void paintComponent(Graphics g) { //... this.setOpaque(true); this.setBackground(Color.WHITE); Changing the state of the component from within the paint method can setup a infinite loop of repaint requests, which can chock your system. Also, the changes you make won't be applied to the current graphics context, as these properties are generally applied by the paint method... And a working copy.... import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent;…
type: Answer
has comment: http://stackoverflow.com/comment/40960176
has comment: http://stackoverflow.com/comment/40960688
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26108351
answers question: http://stackoverflow.com/q/26108351
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/26139762
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40972734
has comment: http://stackoverflow.com/comment/40973269
has comment: http://stackoverflow.com/comment/40974309
type: Question
has comment: http://stackoverflow.com/comment/40973801
tagged with: resize
has comment: http://stackoverflow.com/comment/40973672
has comment: http://stackoverflow.com/comment/40973472
has comment: http://stackoverflow.com/comment/40972830
has comment: http://stackoverflow.com/comment/40974249
has comment: http://stackoverflow.com/comment/40972861
has comment: http://stackoverflow.com/comment/40974204
answer count: 1
has answer: http://stackoverflow.com/a/26141849
has comment: http://stackoverflow.com/comment/40972849
has comment: http://stackoverflow.com/comment/40972945
has comment: http://stackoverflow.com/comment/40972906
tagged with: jlabel
has title: Reserve space for empty JLabel
tagged with: pack
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40973736
tagged with: swing
linked to: http://stackoverflow.com/q/6810581
has body: I have a JLabel for an error output. This is empty in the beginning and can be filled by some actions. But when it's empty it won't be noticed when I pack() my JFrame. So when my error label gets content, I need to repack my frame to make it visible (and that also resizes the frame what I want to avoid). At the moment I use lError.settext(" "); // set text to space as buffer content but I'm not happy with this solution. Is there another cleaner way to reach my result? Edit: I reached what I wanted by editing the size of the panel around my label with setPreferredSize(), but I still have this space buffer. pError.setPreferredSize(new Dimension(pError.getPreferredSize().width, new JLabel(" ").getPreferredSize().height));

http://stackoverflow.com/q/26050423
has comment: http://stackoverflow.com/comment/40810380
has comment: http://stackoverflow.com/comment/40810580
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: rx-java
has answer: http://stackoverflow.com/a/26055456
has comment: http://stackoverflow.com/comment/40810352
score: 2
has body: I need to create an Observable&lt;T&gt; from a BehaviorSubject&lt;Observable&lt;T&gt;&gt;. The created observable should only emit items once and then call onComplete(). Is there a way to do this? Thanks! Edit private BehaviorSubject&lt;Observable&lt;T&gt;&gt; subject = BehaviorSubject.create(); public Observable&lt;T&gt; getObservable(){ //return the subject as Observable&lt;T&gt; which emits once and call onComplete() }
tagged with: java
has answer: http://stackoverflow.com/a/60447968
has title: How to create Observable that emits items once and then onComplete from BehaviorSubject?
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/q/26143894
has answer: http://stackoverflow.com/a/43138039
has answer: http://stackoverflow.com/a/28108630
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/28261336
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/37482597
favorite count: 0
has comment: http://stackoverflow.com/comment/40980680
type: Question
has answer: http://stackoverflow.com/a/38058170
has answer: http://stackoverflow.com/a/40175564
upvote count: 6
answer count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/40981013
has comment: http://stackoverflow.com/comment/40982358
has body: I am unable to start Tomcat 8.0 64-bit server. I have catalina.bat run also. I am getting the below message. 01-Oct-2014 10:22:11.415 SEVERE [main] org.apache.catalina.startup.Bootstrap.ini tClassLoaders Class loader creation threw exception java.io.IOException: The filename, directory name, or volume label syntax is incorrect at java.io.WinNTFileSystem.canonicalize0(Native Method) at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428) at java.io.File.getCanonicalPath(File.java:618) at java.io.File.getCanonicalFile(File.java:643) at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:165) at org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:201) at org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:146) at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:256) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Could you please advise?
has title: Tomcat 8.0 64-bit server not starting and getting error from Catalina.bat
has comment: http://stackoverflow.com/comment/40984839

http://stackoverflow.com/q/26191432
score: 3
answer count: 1
tagged with: generics
favorite count: 0
has body: The intention is to allow any two types of classes to be "matched," provided they follow an interface. That is, if a class U is matchable to V, it implements the following interface public interface Matchable&lt;U, V&gt; and can be matched with public class Matcher&lt;U extends Matchable&lt;U, V&gt;, V extends Matchable&lt;V, U&gt;&gt; For one case, I wanted to match two classes that have very similar properties, so I created a basic parent class for them to inherit from: public abstract class MatchingPairItem&lt;T&gt; implements Matchable&lt;? extends MatchingPairItem&lt;T&gt;, T&gt; public class ClassA extends MatchingPairItem&lt;ClassB&gt; public class ClassB extends MatchingPairItem&lt;ClassA&gt; But I am obviously missing something with the generic typing, receiving multiple errors, for example: type argument ClassA is not within bounds of type-variable U Matcher&lt;ClassA, ClassB&gt; matcher = new Matcher&lt;ClassA, ClassB&gt;(); ^ where U,V are type-variables: U extends Matchable&lt;U,V&gt; declared in class Matcher V extends Matchable&lt;V,U&gt; declared in class Matcher Can anyone point me in the right direction?
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26191493
downvote count: 0
has title: "Multi-level" generics, with subclassing and interfaces
accepted answer: http://stackoverflow.com/a/26191493

http://stackoverflow.com/a/26270396
answers question: http://stackoverflow.com/q/26178488
upvote count: 1
has body: You need to register your app as a Native application at Azure AD portal. You don't need client secret for native app.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/40857228
has text: yeah - kind of pointless ... i was seduced to ask why an DB is used anyway to remote-compile code... but thanks to your answer i didn't have to ^^
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26076288
score: 0

http://stackoverflow.com/comment/40953185
type: AnswerComment
score: 0
has text: Dude that loop is for that to ask them for another input until the guess correctly or enter an invalid input. If they guess wrong you keep asking them to guess. Please read this http://stackoverflow.com/a/25940409/1085186 hope this clears out doubts.
type: Comment
comment on: http://stackoverflow.com/a/26127697

http://stackoverflow.com/a/26112928
has comment: http://stackoverflow.com/comment/40924879
downvote count: 2
has comment: http://stackoverflow.com/comment/40924850
has comment: http://stackoverflow.com/comment/40924718
answers question: http://stackoverflow.com/q/26112860
has comment: http://stackoverflow.com/comment/40924864
score: 0
has comment: http://stackoverflow.com/comment/40924613
type: Answer
has body: Try this : public static void main(String[] args) throws IOException { String id = "kick"; File file = new File(id + ".txt"); FileWriter fileWrite = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWrite); File folder = new File("C:\\Users\\kick\\Documents\\NetBeansProjects\\JavaApplication191"); // the list of files at specified folder File[] listOfFiles = folder.listFiles(); // go through the list of files to see if you can find file was named kick for (int i = 0; i &lt; listOfFiles.length; i++) { // gives you access to each elements of listofFiles array name String filename = listOfFiles[i].getName(); if (filename.startsWith("kick")) { System.out.println("found"); } else{ System.out.println("not found'); } } }
upvote count: 2

http://stackoverflow.com/q/26064689
tagged with: java-8
accepted answer: http://stackoverflow.com/a/26065463
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26091074
tagged with: java
upvote count: 10
has body: I am reading a very large (500mb) file with Files.lines(...). It reads a part of the file but at some point it breaks with java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1 I think the file has lines with different charsets. Is there a way to skip these broken lines? I know that the stream returned is backed by a Reader and with the reader I know how to skip, but don't know how to get the Reader from the stream to set it up as I like. List&lt;String&gt; lines = new ArrayList&lt;&gt;(); try (Stream&lt;String&gt; stream = Files.lines(Paths.get(getClass().getClassLoader().getResource("bigtest.txt").toURI()), Charset.forName("UTF-8"))) { stream .filter(s -&gt; s.substring(0, 2).equalsIgnoreCase("aa")) .forEach(lines::add); } catch (final IOException e) { // catch }
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26065463
score: 10
has title: Files.lines to skip broken lines in Java8
favorite count: 0
tagged with: java-stream
tagged with: file
has answer: http://stackoverflow.com/a/26091074

gmail
type: Tag
tag name: gmail
tags question: http://stackoverflow.com/q/26086468

http://stackoverflow.com/q/26177749
upvote count: 102
has answer: http://stackoverflow.com/a/59780141
answer count: 10
linked to: http://stackoverflow.com/q/218608
has comment: http://stackoverflow.com/comment/73829302
score: 102
linked to: http://stackoverflow.com/q/883136
has title: How can I append a query parameter to an existing URL?
has answer: http://stackoverflow.com/a/74950389
accepted answer: http://stackoverflow.com/a/26177982
has answer: http://stackoverflow.com/a/78611444
has comment: http://stackoverflow.com/comment/41113555
has answer: http://stackoverflow.com/a/26178003
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37062788
has comment: http://stackoverflow.com/comment/41043565
has answer: http://stackoverflow.com/a/76272460
tagged with: java
has body: I'd like to append key-value pair as a query parameter to an existing URL. While I could do this by checking for the existence of whether the URL has a query part or a fragment part and doing the append by jumping though a bunch of if-clauses but I was wondering if there was clean way if doing this through the Apache Commons libraries or something equivalent. http://example.com would be http://example.com?name=John http://example.com#fragment would be http://example.com?name=John#fragment http://example.com?email=john.doe@email.com would be http://example.com?email=john.doe@email.com&amp;name=John http://example.com?email=john.doe@email.com#fragment would be http://example.com?email=john.doe@email.com&amp;name=John#fragment I've run this scenario many times before and I'd like to do this without breaking the URL in any way.
has answer: http://stackoverflow.com/a/54520002
possible better answer: http://stackoverflow.com/a/37062788
type: Question
downvote count: 0
tagged with: url
has answer: http://stackoverflow.com/a/26177982
favorite count: 0
has answer: http://stackoverflow.com/a/63723801
has answer: http://stackoverflow.com/a/53225089

http://stackoverflow.com/comment/40995012
score: 0
type: AnswerComment
type: Comment
has text: The methods that you mention are now static methods on EntitySearcher.
comment on: http://stackoverflow.com/a/26148179

http://stackoverflow.com/q/26083062
tagged with: date
type: Question
tagged with: locale
answer count: 1
downvote count: 0
score: 1
has body: I try to parse string (russian locale) "01 августа 2014, пятница. 20:00 МСК" to java.util.Date. I try this code: String dateString = "01 августа 2014, пятница. 20:00 МСК" Locale rusLocale = new Locale.Builder().setLanguage("ru").setScript("Cyrl").build(); String pattern = "dd MMMM yyyy, EEEE. HH:mm z" Date date = SimpleDateFormat(pattern, rusLocale).parse(dateString) With month and weekday this code work fine, but when I try to parse string with timezone name МСК I get java.text.ParseException: Unparseable date. When I change MCK to MSK "01 августа 2014, пятница. 20:00 MSK" code also work fine. So we can parse strings month and weekday, but can't do it with timezone or "MCK" is just not valid?
accepted answer: http://stackoverflow.com/a/26085504
favorite count: 0
has comment: http://stackoverflow.com/comment/40876502
tagged with: timezone
has title: Parsing string to date with timezone in national format
linked to: http://stackoverflow.com/q/26076595
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26085504
tagged with: simpledateformat
tagged with: java

http://stackoverflow.com/comment/41046222
comment on: http://stackoverflow.com/q/26178887
has text: Since you're using a HashMap, you would use setString()
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26163915
has comment: http://stackoverflow.com/comment/41018686
score: 3
accepted answer of: http://stackoverflow.com/q/26163809
type: Answer
answers question: http://stackoverflow.com/q/26163809
has comment: http://stackoverflow.com/comment/41018286
upvote count: 3
has body: You use a Path to register a file located by that Path to a WatchService. If an event occurs, it will be enqueued in the WatchService and you can retrieve it with take(). take() has no idea about the actual Path. Yes, a WatchService will only report events for those Paths registered with it. You can use the WatchKey returned by the register method to compare against the WatchKey returned by take(). You can also, obviously, do all the things described in the javadoc.
has comment: http://stackoverflow.com/comment/41018659
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41018159

http://stackoverflow.com/a/26188830
has body: Java 8 lambdas and Map.forEach make bkail's answer more concise: outerMap.forEach((letter, nestedMap) -&gt; { //... nestedMap.forEach((name, student) -&gt; { //... }); //... });
answers question: http://stackoverflow.com/q/26188532
has comment: http://stackoverflow.com/comment/127997121
upvote count: 14
score: 14
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40818069
comment on: http://stackoverflow.com/q/26054325
score: 0
type: Comment
type: QuestionComment
has text: You could try look at the [Collections Trail](http://docs.oracle.com/javase/tutorial/collections/)

http://stackoverflow.com/q/26074214
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26074248
upvote count: 3
accepted answer: http://stackoverflow.com/a/26074248
has body: import java.util.ArrayList; public class Test { public static void main (String[] args){ ArrayList&lt;String[]&gt; a = new ArrayList&lt;String[]&gt;(); a.add(new String[]{"one", "abc"}); a.add(new String[]{"two", "def"}); if(a.contains(new String[]{"one", "abc"})){ System.out.println(true); }else{ System.out.println(false); } } } Console said "false." I have an ArrayList and I can't check whether it contains a particular String array. How to do and why?
type: Question
score: 3
tagged with: java
answer count: 1
tagged with: arrays
downvote count: 0
has title: JAVA ArrayList : How to know whether it contains a String array or not?
favorite count: 0
tagged with: arraylist

http://stackoverflow.com/a/26100818
has comment: http://stackoverflow.com/comment/50865230
answers question: http://stackoverflow.com/q/26100352
type: Answer
downvote count: 0
score: 1
has body: Although String is not a primitive data type directly (although Char is), it works some ways as primitive data types. So, if you use final keyword for this type, it will make it constant. final String[] ARRAY = new String[]{"Word1", "Word2"}; But for non primitive type, the final keyword doesn't make the the object properties final, it just make the reference to the object final. Think of type Bird. Say, it has properties like leg. Public class Bird{ int leg=2; setLegs(int legs){ this.legs=legs}; } Now, if you initialize a Bird, say Parrot with keyword final, by default it will have property like leg=2. Now, the reference is final (Parrot will always refer to type Bird) but you will be still be able to change the properties of this object, like: final Bird Parrot = new Bird(); Parrot.setlegs(3); will change the leg number to 3. If you want to keep the leg numbers also final, then you need to use it for leg variable also, like: Public class Bird{ final int leg=2; setLegs(int legs){ this.legs=legs}; } Anyway, I own self don't appreciate playing with bird legs, just for example!
upvote count: 1

http://stackoverflow.com/q/26133054
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26595961
tagged with: oozie
has body: I'm running a test hbase java program via oozie java action. The following error is encountered : Failing Oozie Launcher, Main class [HbaseTest], main() threw exception, org/apache/hadoop/hbase/HBaseConfiguration java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration at HbaseTest.main(HbaseTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:495) at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:417) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332) at org.apache.hadoop.mapred.Child$4.run(Child.java:268) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.Child.main(Child.java:262) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 14 more The program runs correctly from command line : java -cp `hbase classpath` HbaseTest Is there a way I can pass output of 'hbase classpath' to the oozie java action. I dont want to copy hbase jars to workflow's lib directory as that will be a maintenance overhead. Following is the java action from workflow.xml : ${jobTracker} ${nameNode} mapred.job.q…
upvote count: 6
type: AnsweredQuestion
tagged with: hbase
score: 6
type: Question
has answer: http://stackoverflow.com/a/26595961
tagged with: java
tagged with: hadoop
has title: Oozie Java Action : Passing Hbase classpath

http://stackoverflow.com/a/27699415
type: Answer
has comment: http://stackoverflow.com/comment/44973739
upvote count: 9
has body: It's a bug from apache httpclient, version 4.4 beta 1 has this bug, but version 4.3.6 works fine for me. If you are using maven, use following in pom: org.apache.httpcomponents httpclient 4.3.6 And don't update it to 4.4 before they fix this bug.
has comment: http://stackoverflow.com/comment/45178929
score: 9
downvote count: 0
answers question: http://stackoverflow.com/q/26187341
has comment: http://stackoverflow.com/comment/44982987

thumbnails
tags question: http://stackoverflow.com/q/26115851
tag name: thumbnails
tags question: http://stackoverflow.com/q/26118799
type: Tag

string
tags question: http://stackoverflow.com/q/26076542
tags question: http://stackoverflow.com/q/26075462
tags question: http://stackoverflow.com/q/26057609
tags question: http://stackoverflow.com/q/26107189
tags question: http://stackoverflow.com/q/26147835
tags question: http://stackoverflow.com/q/26106783
tags question: http://stackoverflow.com/q/26088634
tags question: http://stackoverflow.com/q/26149289
tags question: http://stackoverflow.com/q/26176802
tags question: http://stackoverflow.com/q/26087708
tags question: http://stackoverflow.com/q/26158910
tags question: http://stackoverflow.com/q/26079731
tags question: http://stackoverflow.com/q/26185434
tags question: http://stackoverflow.com/q/26141488
tags question: http://stackoverflow.com/q/26047364
tags question: http://stackoverflow.com/q/26126639
tags question: http://stackoverflow.com/q/26152101
tags question: http://stackoverflow.com/q/26154108
tags question: http://stackoverflow.com/q/26187676
tags question: http://stackoverflow.com/q/26114581
tags question: http://stackoverflow.com/q/26082968
tags question: http://stackoverflow.com/q/26151920
tags question: http://stackoverflow.com/q/26075658
tags question: http://stackoverflow.com/q/26131721
tags question: http://stackoverflow.com/q/26090906
tags question: http://stackoverflow.com/q/26045011
tags question: http://stackoverflow.com/q/26098359
tags question: http://stackoverflow.com/q/26040636
tags question: http://stackoverflow.com/q/26107608
tags question: http://stackoverflow.com/q/26184734
tags question: http://stackoverflow.com/q/26083383
tags question: http://stackoverflow.com/q/26128835
tags question: http://stackoverflow.com/q/26087681
tags question: http://stackoverflow.com/q/26044048
tags question: http://stackoverflow.com/q/26138162
tags question: http://stackoverflow.com/q/26078259
tags question: http://stackoverflow.com/q/26189346
tag name: string
tags question: http://stackoverflow.com/q/26113035
tags question: http://stackoverflow.com/q/26146054
tags question: http://stackoverflow.com/q/26162763
tags question: http://stackoverflow.com/q/26090590
tags question: http://stackoverflow.com/q/26176290
tags question: http://stackoverflow.com/q/26079775
tags question: http://stackoverflow.com/q/26180049
tags question: http://stackoverflow.com/q/26168232
tags question: http://stackoverflow.com/q/26148591
tags question: http://stackoverflow.com/q/26084412
type: Tag
tags question: http://stackoverflow.com/q/26133085
tags question: http://stackoverflow.com/q/26079952
tags question: http://stackoverflow.com/q/26057243
tags question: http://stackoverflow.com/q/26134529
tags question: http://stackoverflow.com/q/26150035
tags question: http://stackoverflow.com/q/26067017
tags question: http://stackoverflow.com/q/26092585
tags question: http://stackoverflow.com/q/26173878
tags question: http://stackoverflow.com/q/26128341
tags question: http://stackoverflow.com/q/26134013
tags question: http://stackoverflow.com/q/26141629
tags question: http://stackoverflow.com/q/26188871
tags question: http://stackoverflow.com/q/26098604
tags question: http://stackoverflow.com/q/26080643
tags question: http://stackoverflow.com/q/26126863
tags question: http://stackoverflow.com/q/26171851
tags question: http://stackoverflow.com/q/26167357
tags question: http://stackoverflow.com/q/26116017
tags question: http://stackoverflow.com/q/26099642
tags question: http://stackoverflow.com/q/26059239
tags question: http://stackoverflow.com/q/26040577
tags question: http://stackoverflow.com/q/26066622
tags question: http://stackoverflow.com/q/26137784
tags question: http://stackoverflow.com/q/26183932
tags question: http://stackoverflow.com/q/26161447
tags question: http://stackoverflow.com/q/26194174
tags question: http://stackoverflow.com/q/26077641
tags question: http://stackoverflow.com/q/26089403
tags question: http://stackoverflow.com/q/26068347
tags question: http://stackoverflow.com/q/26178096
tags question: http://stackoverflow.com/q/26158430

http://stackoverflow.com/comment/40909502
has text: No arrays guys. That's how I'm asked to do it. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26104767

http://stackoverflow.com/comment/40965770
type: Comment
has text: This doesn't answer the question at all
type: AnswerComment
comment on: http://stackoverflow.com/a/26133961
score: 0

http://stackoverflow.com/comment/41014333
type: AnswerComment
comment on: http://stackoverflow.com/a/26141849
score: 0
has text: I also played with those methods, but I wasn't able to get a cleaner result than the one in my latest edit.
type: Comment

http://stackoverflow.com/comment/44052269
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26172320
has text: Any solution for this? I am getting the same error? Is allowFiltering() allowed via the Jdbc driver?
score: 0

http://stackoverflow.com/a/26102267
accepted answer of: http://stackoverflow.com/q/26101934
answers question: http://stackoverflow.com/q/26101934
score: 0
type: AcceptedAnswer
has body: The simplest way to check would be as follows: for (int i = 0; i &lt; lengde; ) { int readInt = keyboard.nextInt(); boolean found = false; for(int index=0; index &lt; i; index++) { intFromArray = myArray[index]; // Get element from array if(readInt == intFromArray) { found = true; // Number already in array break; } } // Number not found in the array. Add it to the array. if(!found) { myArray[i] = readInt; i++; } else { System.out.println("Found in array. Try again..."); } } You might want to allow a certain number of tries only, otherwise it will loop indefinitely.
has comment: http://stackoverflow.com/comment/40930838
has comment: http://stackoverflow.com/comment/40905328
type: Answer

http://stackoverflow.com/a/26172301
answers question: http://stackoverflow.com/q/26172083
has body: You only new one Random instance to generate two random int values, you could use printf() to get formatted output and if and else if to sum your dice. Something like, Random die = new Random(); // &lt;-- only need one. // The number of sides to the die. int sides = 6; // Variables to count the results int rolled2 = 0; int rolled3 = 0; int rolled4 = 0; int rolled5 = 0; int rolled6 = 0; // throw the dice the number of times requested for (int i = 1; i &lt;= numberOfTimes; i++) { int toss1 = 1 + die.nextInt(sides); int toss2 = 1 + die.nextInt(sides); int throwOfDice = toss1 + toss2; System.out.printf("%d + %d = %d%n", toss1, toss2, throwOfDice); if (throwOfDice == 2) { rolled2++; } else if (throwOfDice == 3) { rolled3++; } else if (throwOfDice == 4) { rolled4++; } else if (throwOfDice == 5) { rolled5++; } else if (throwOfDice == 6) { rolled6++; } } System.out.printf("2 = %d, 3 = %d, 4 = %d, 5 = %d, 6 = %d%n", rolled2, rolled3, rolled4, rolled5, rolled6);
type: Answer
score: 0

http://stackoverflow.com/a/26155361
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26155075
upvote count: 1
has body: It turned out it's because of the view of my advanced rest client.

http://stackoverflow.com/a/37966649
has comment: http://stackoverflow.com/comment/76690163
has comment: http://stackoverflow.com/comment/104229249
has comment: http://stackoverflow.com/comment/81810772
score: 139
has comment: http://stackoverflow.com/comment/104230272
has comment: http://stackoverflow.com/comment/81811193
has comment: http://stackoverflow.com/comment/98655864
type: Answer
answers question: http://stackoverflow.com/q/26147044
has comment: http://stackoverflow.com/comment/74704144
downvote count: 0
has comment: http://stackoverflow.com/comment/74683260
has body: For my scheduler, I am using it to fire at 6 am every day and my cron notation is: 0 0 6 * * * If you want 1:01:am then set it to 0 1 1 * * * Complete code for the scheduler @Scheduled(cron="0 1 1 * * *") public void doScheduledWork() { //complete scheduled work } ** VERY IMPORTANT To be sure about the firing time correctness of your scheduler, you have to set zone value like this (I am in Istanbul): @Scheduled(cron="0 1 1 * * *", zone="Europe/Istanbul") public void doScheduledWork() { //complete scheduled work } You can find the complete time zone values from here. Note: My Spring framework version is: 4.0.7.RELEASE
upvote count: 139
has comment: http://stackoverflow.com/comment/76740170

http://stackoverflow.com/q/26090572
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/26094328
type: Question
upvote count: 1
answer count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/26094328
has body: My jsp page can access a bean with the following: &lt;jsp:useBean id="myBean" type="myPackage.beans.MyBean" scope="session" /&gt; If I change the scope to "request" tomcat throws an exception: javax.servlet.ServletException: java.lang.InstantiationException: bean myBean not found within scope But I access my jsp page by forwarding from a servlet as follows: RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/MyJsp.jsp"); dispatcher.forward(request, response); I thought that the above forward would result in MyJsp.jsp inheriting the original servlet's request object, so myBean should be available (its created and then stored using session.setAttribute("myBean", myBean) in the original servlet). Is this not correct - why does the request scope fail while the session scope request succeeds?
downvote count: 0
has title: MVC - request-based data sharing fails, session based data sharing succeeds

http://stackoverflow.com/comment/40994437
has text: What do you mean by "determine"? What is the required output in this example?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26151215

http://stackoverflow.com/a/26161337
upvote count: 1
type: Answer
downvote count: 0
has body: What about this version: public class TopicThirteen { public static void main(String[] args){ String msg = ""; int num =0; int counter; //for loop that gets the 5 numbers from the user for(counter = 0; counter &lt; 5; counter++){ try{ Integer.parseInt(JOptionPane.showInputDialog("Enter number "+(counter+1))); }catch(Exception e){ num++; JOptionPane.showMessageDialog(null,"Error "+e); } } msg = num + " invalid input(s)"; //displays the number in words if with in range JOptionPane.showMessageDialog(null,msg); } } As you said you don't have to catch the user input but the user input errors.
score: 1
answers question: http://stackoverflow.com/q/26161019

http://stackoverflow.com/comment/40900949
comment on: http://stackoverflow.com/a/26100120
score: 0
type: AnswerComment
has text: -16 = F0 hex, -97 = 256 - 97 = 159 = 160 - 1 = hex A0 - 1 = 9F. so it is okay.
type: Comment

http://stackoverflow.com/q/26148435
possible better answer: http://stackoverflow.com/a/26148536
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to "reset" iteration through an Enumeration list
answer count: 3
has answer: http://stackoverflow.com/a/26148646
downvote count: 0
has answer: http://stackoverflow.com/a/26148528
favorite count: 0
tagged with: enumeration
has body: Enumeration&lt;NetworkInterface&gt; nets = NetworkInterface.getNetworkInterfaces(); out.print("List of all network interfaces on this machine:\n"); for (NetworkInterface netint : Collections.list(nets)) { out.printf("name:%s (%s)\n", netint.getName(), netint.getDisplayName()); } I'm doing an assignment that requires me to list a bunch of information using NetworkInterface, but I'm not very familiar with Enumeration, so I'm having trouble. I went through some javadocs and managed to get this far. The problem is that I need to be able to go through the list multiple times. For example, I was wanting to use another for loop to cycle through and list all interfaces that were currently up. Something like this: for (NetworkInterface netint : Collections.list(nets)) { if (netint.isUp()) { out.printf("name:%s (%s)\n", netint.getName(), netint.getDisplayName()); } } However, any time I use a for loop after the first one I'm not getting any output. I have a feeling this has to do with my lack of understanding. I can't seem to find an explanation anywhere.
accepted answer: http://stackoverflow.com/a/26148528
has answer: http://stackoverflow.com/a/26148536
type: AnsweredQuestion

http://stackoverflow.com/a/54086885
answers question: http://stackoverflow.com/q/26190959
downvote count: 0
type: Answer
has body: In The Top of your class where you have imported the iterator class import javax.swing.text.html.HTMLDocument.Iterator; in place of this import below class import java.util.Iterator; it will solve your problem
score: 1
upvote count: 1

http://stackoverflow.com/comment/40894500
score: 0
type: AnswerComment
type: Comment
has text: the variables in the main method (and the ones in inputBirthday) remain undeclared.
comment on: http://stackoverflow.com/a/26096470

http://stackoverflow.com/q/26114581
has comment: http://stackoverflow.com/comment/40927007
type: Question
possible better answer: http://stackoverflow.com/a/26114729
has comment: http://stackoverflow.com/comment/40927021
score: -2
has comment: http://stackoverflow.com/comment/40926996
has answer: http://stackoverflow.com/a/26114729
has comment: http://stackoverflow.com/comment/40926907
tagged with: java
has comment: http://stackoverflow.com/comment/40927141
linked to: http://stackoverflow.com/q/816142
has body: I'm getting a response from an URL which I'm storing to a string. The Response is in JSON format and it's about 1800 lines. When I use a String to read the data, around 800 lines it comes like this.. {"carrierFsCode":"UA","flightNumber":"935","se... Initially I though String might not be able to handle it and I tried to use StringBuffer setting a minimumcapacity and all but I'm getting the same problem. This is the part where I'm having the problem. String str = ""; while (null != (str = br.readLine())) { temp = str; } Any suggestions why this is happening. PS: The URL is fine. When I try to store it to a file I get the entire JSON.
accepted answer: http://stackoverflow.com/a/26114752
answer count: 2
has comment: http://stackoverflow.com/comment/40927043
upvote count: 0
has comment: http://stackoverflow.com/comment/40926998
tagged with: string
has comment: http://stackoverflow.com/comment/40926970
has title: Is there a size for String?
favorite count: 0
has comment: http://stackoverflow.com/comment/40926883
has comment: http://stackoverflow.com/comment/40926987
has comment: http://stackoverflow.com/comment/40926879
has comment: http://stackoverflow.com/comment/40927001
has comment: http://stackoverflow.com/comment/40926990
has comment: http://stackoverflow.com/comment/40926870
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26114752
has comment: http://stackoverflow.com/comment/40927140
downvote count: 2

http://stackoverflow.com/comment/40942955
type: Comment
comment on: http://stackoverflow.com/q/26122975
type: QuestionComment
score: 0
has text: The `for each` loop is meant to be the simpler way.

http://stackoverflow.com/q/26078171
type: Question
has comment: http://stackoverflow.com/comment/40860850
answer count: 2
has comment: http://stackoverflow.com/comment/40860765
tagged with: instance-variables
has answer: http://stackoverflow.com/a/26078287
tagged with: constructor
has answer: http://stackoverflow.com/a/26078285
type: UnansweredQuestion
has body: I am in an Introduction to Programming class for Roane State Community College. I have read the entire chapter 3 chapter, taken the quize, and passed. So, now I am beyond frustrated after many hours of attempting to create an Employee class file with 3 different instance variables that will then be initialized by an Employee Constructor. The three variables are as such: first name (String type variable) last name (String type variable) monthly salary (double type floating variable) The instructor provided us with some "signatures of the constructor and the methods for your reference:" public Employee(String fName, String lName, double empSalary ) public void setFirstName( String fName ) public void setLastName( String lName ) public void setSalary(double empSalary ) public String getFirstName() public String getLastName() public double getSalary() So, I have driven myself insane twice, and am once again at my wits end as I have manipulated my code, and replaced variables such as int with variations that I thought could possible yield a correct result, then changed them back, all the while consulting the Internet, threads on this site, and my textbook. Here's my code in its "Vanilla Format" before I've added any form of alternatives to its code: /************************************************** File: 9-27.java Author: Steven Dorsey Date: Sept. 2014 Description: This is an Employee Class File **************************************************/ //Initiation the Class file first iirc public class Employee { int FirstName, LastName, Salary; //Instance variables // main method begins program execution public static void main( String[] args ) { // should introduce and initialize the constructor Employee public Employee( String fName, String lName, double empSalary ) { FirstName = fName; LastName = lName; Salary = empSalary; } // Below: the set and get methods public void setFirstName( int fName ) // set the First Name { FirstName = fName; } public void setLastName( int l…
has comment: http://stackoverflow.com/comment/40860806
has title: Programming Assignment; Constructor -> Invalid Start of Expression + SemiColon Obsession
score: 0
tagged with: java

http://stackoverflow.com/comment/40790653
type: Comment
has text: I am not using Gson library .never used it before
comment on: http://stackoverflow.com/q/26039819
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40977096
type: QuestionComment
has text: Add returns the same results. I understand the calendar is reacting normally, but in my specific case i'd like the date to not span beyond the actual next month, even if it means returns a different day of the month.
comment on: http://stackoverflow.com/q/26141994
score: 0
type: Comment

http://stackoverflow.com/a/26113216
has comment: http://stackoverflow.com/comment/40924886
has comment: http://stackoverflow.com/comment/41145349
has comment: http://stackoverflow.com/comment/40924571
accepted answer of: http://stackoverflow.com/q/26113186
has comment: http://stackoverflow.com/comment/40924764
has comment: http://stackoverflow.com/comment/40925004
upvote count: 1
answers question: http://stackoverflow.com/q/26113186
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40925054
has comment: http://stackoverflow.com/comment/40927864
has body: You're creating back-to-back new instances of Random in your loop. Just create one (outside the loop!), and ask it for random numbers when you need new values. Think of it as being like digging a well - you don't dig a new well each time you want a drink of water, you dig one well and go back to it for as many drinks as you need.
has comment: http://stackoverflow.com/comment/40924949
has comment: http://stackoverflow.com/comment/40924721
type: Answer
has comment: http://stackoverflow.com/comment/40924711
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40924890
has comment: http://stackoverflow.com/comment/40924759

http://stackoverflow.com/comment/41009792
has text: It's probably easier to do this in Java (using `replaceAll()`) after you have received the data from the JPA call.
comment on: http://stackoverflow.com/q/26159402
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26151759
has comment: http://stackoverflow.com/comment/40999565
has body: I have a JTable that is sorted and filtered using a RowSorter and updates in a real time manner. I have an issue when users are trying to create a selection interval with either the mouse (click + drag over rows) or via the keyboard (SHIFT + arrow down multiple times). The selection interval start and end get corrupted as soon as a table-model update event occurs. I have discovered that if a table is sorted and there is more than one selected row the selection model fires multiple list selection events that clear then recreate the selection on every table model update. If multiple rows are selected one at a time - all is well. What the user selected remain selected. If however the user tries to create a selection-interval by clicking and dragging the mouse down over multiple rows - the rows get selected correctly until a table model update event fires. The selection then starts building from the currently selected row. I've attached a small demo application. Try selecting multiple rows using the mouse - every second the selection will get corrupted.... This seems to be a bug (or unwanted behavior) in the Java classes. I'm hoping someone can provide a creative solution/work-around. public class TableTest extends JFrame { private static final long serialVersionUID = 1L; public TableTest() { super("Table Selection Problem"); setBounds(50, 50, 800, 600); setDefaultCloseOperation(EXIT_ON_CLOSE); // Create a table model final DefaultTableModel tableModel = new DefaultTableModel(40,10); // Create table row sorter sorted on column 1 TableRowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(tableModel); sorter.setSortsOnUpdates(true); sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(1,SortOrder.DESCENDING))); // Create a table and bind the sorter JTable table = new JTable(tableModel); table.setRowSorter(sorter); // Bind a list selection listener, this doesn't do anything besides showing the selection change(s) on every table model update table.getS…
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: JTable selection interval issues with sorted table
has answer: http://stackoverflow.com/a/26152915
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40999424
has comment: http://stackoverflow.com/comment/40998584
answer count: 1
tagged with: rowsorter
tagged with: selection
has comment: http://stackoverflow.com/comment/40999539
has comment: http://stackoverflow.com/comment/40999481
type: UnansweredQuestion
tagged with: jtable

http://stackoverflow.com/comment/40783187
score: 0
type: Comment
type: QuestionComment
has text: Inside a browser i.e. Firefox it works pretty well also inside the eclipse browser. I just tried to add an element
comment on: http://stackoverflow.com/q/26034288

http://stackoverflow.com/a/26130268
answers question: http://stackoverflow.com/q/26130142
score: 1
upvote count: 1
has body: Your code looks way more complex than it needs to be, and I would try to simplify it greatly. Some suggestions: Get rid of all the JInternalFrames and use JPanels instead. Create a JPanel, say called drawingPanel, that has its paintComponent(Graphics g) overridden and perhaps its getPreferredSize() overridden, place this JPanel BorderLayout.CENTER in your main GUI. In the paintComponent method, have the logic to draw the circles and the crosshairs based on fields of your class. When a JSlider moves, have its ChangeListener change the state of the corresponding field, and then have it call repaint() on the drawing panel so that it will draw the changes. When the show button is pressed, have it change the state of a boolean variable and then call repaint(). Have the drawingPanel use the boolean in its paintComponent method to decide whether or not to draw the filled circle. Have the drawingPanel draw the lines in its paintComponent method based on the value returned by the JSliders. Again you're calling repaint in the JSlider's listeners, so the lines will move. Do not add and remove components on button clicks since this adds unnecessary complexity which makes things much harder to code. Don't move the center component or any component. Just use the fixed drawingPanel JPanel and move the location of the circle and the lines that it draws. Since this is homework, I'm going to avoid posting code as the coding should be up to you. Much luck!
type: Answer
downvote count: 0

http://stackoverflow.com/q/26127407
has comment: http://stackoverflow.com/comment/40950405
has answer: http://stackoverflow.com/a/26127474
type: AnsweredQuestion
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/40950408
type: Question
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26127474
tagged with: java
has body: I have an ArrayList consisting of several ArrayLists, all containing String elements. That is; ArrayList&lt;ArrayList&lt;String&gt;&gt; myListCollection = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); Now, is there a way to convert myListCollection to an ArrayList containing only String elements? Thanks! EDIT I have written several methods that for adding Strings to a list. Each list is then added to a "superlist", of the type: ArrayList&lt;ArrayList&lt;String&gt;&gt; Seeing as this now is a collection of lists, which in turn contain single String elements, I was wondering if it would be possible to change my "superlist" into a list containing all the String elements, as opposed to a list containing other list elements with String elements. For instance, retrieving an element from the "superlist" gives me an entire list, whereas I would like access to single elements. I think I can use a nested for-loop to retrieve an element within a sublist, with the following code: for(int i = 0; i &lt; superlist.size(); i++) { for(int j = 0; j &lt; superlist.get(i).size(); j++) { System.out.println(superlist.get(i).get(j)); } } Is this proper/correct/decent code?
has title: Convert ArrayList<ArrayList<String>> "back" to ArrayList<String>
upvote count: 0
tagged with: arrays
tagged with: arraylist

http://stackoverflow.com/q/26182222
has title: Reading an input file in java
type: UnansweredQuestion
has body: My input file: /home/gcj/finals I want to have each character after / My approach: StringTokenizer sr = new StringTokenizer(br.readLine()); String s = sr.nextToken("/"); while(s != null){ System.out.println(s); s = sr.nextToken("/"); } Output: gcj finals Exception in thread "main" java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(Unknown Source) at java.util.StringTokenizer.nextToken(Unknown Source) at jobs.TestClass.main(TestClass.java:118) Please Help me out. OR if there any better method.
has answer: http://stackoverflow.com/a/26182273
answer count: 4
has comment: http://stackoverflow.com/comment/41052080
type: Question
has answer: http://stackoverflow.com/a/26182293
has answer: http://stackoverflow.com/a/26182261
linked to: http://stackoverflow.com/q/26157632
tagged with: java
has answer: http://stackoverflow.com/a/26182304
score: 0

http://stackoverflow.com/a/26155810
upvote count: 2
type: Answer
score: 2
has body: You have to escape special characters you want to print, because the compiler doesn't know, if your " means print " or start/stop a String. Same goes for \. To escape a character, simply write a \ infront of it. So: " becomes \" \ becomes \\ You can read more about characters and escaping in the Java Tutorials from Oracle.
downvote count: 0
answers question: http://stackoverflow.com/q/26155742

http://stackoverflow.com/comment/40926073
score: 0
type: Comment
type: QuestionComment
has text: well - i must confess... i puzzeled by your code^^ totally^^ could you eventually split that code into some more methods to point out what you do? or maybe you provide some comments to explain what you do in this or that codeblock? i really don't want to offense you, but even after reading it twice and thrice i don't get it^^ another point is that this question had quite some visitors but NOONE dared to answer, maybe because the reason above - no offense, really!!
comment on: http://stackoverflow.com/q/26113533

http://stackoverflow.com/comment/40853912
has text: @VisruthCV i have pointed out the exception ouccrrring at which line number. Error is not about the response sending back but is raised inside method. And it has nothing to do with struts version .I am able send certain amount of data but when i exceed it gives me the error
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26074351

http://stackoverflow.com/comment/40992605
type: Comment
score: 0
has text: @Tro So you are using Java 7. Consider updating your Java to 8, so you could be able to use many awesome features like default methods (`thenComparing` is one of them). To be able to use them in your IDEs you will have to use their newest versions like Eclipse 4.4 (Lina), NetBeans8, IntelliJ IDEA 13.
type: AnswerComment
comment on: http://stackoverflow.com/a/26149840

http://stackoverflow.com/comment/41005997
type: AnswerComment
type: Comment
has text: Thank you for your edited advice @Thomas; I will have to take a closer look at it tomorrow (it's very late here). And also thank you for the note about Java code conventions. Honestly, I started with my C# code and was editing it, so I missed some case conventions that my IDE didn't catch.
score: 0
comment on: http://stackoverflow.com/a/26157237

http://stackoverflow.com/q/26078658
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40865298
tagged with: java
tagged with: selenium
has title: Webdriver - Page Object model using page factory, web page withh too many links - Best Practice
has body: Webdriver - In page Object model using page factory, i have around 25 links in a page. Should i create a variable for each of these links or is there a better way to handle this.
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/26095155
tagged with: pageobjects
score: 0

http://stackoverflow.com/a/26061498
has body: One way to go would be to use generics: class Base&lt;T&gt; { protected T a; Base(T a) { this.a = a; } } class Daugher&lt;L, R&gt; extends Base&lt;Pair&lt;L, R&gt;&gt; { Daugher (Pair&lt;L, R&gt; a) { super (a); } }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26061413
answers question: http://stackoverflow.com/q/26061413
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer

encryption
tags question: http://stackoverflow.com/q/26189346
tags question: http://stackoverflow.com/q/26191442
tags question: http://stackoverflow.com/q/26071473
tags question: http://stackoverflow.com/q/26058823
tags question: http://stackoverflow.com/q/26114325
tags question: http://stackoverflow.com/q/26117104
tags question: http://stackoverflow.com/q/26180405
tag name: encryption
tags question: http://stackoverflow.com/q/26145693
tags question: http://stackoverflow.com/q/26182593
tags question: http://stackoverflow.com/q/26151172
tags question: http://stackoverflow.com/q/26160561
tags question: http://stackoverflow.com/q/26166279
tags question: http://stackoverflow.com/q/26116689
tags question: http://stackoverflow.com/q/26186377
tags question: http://stackoverflow.com/q/26068460
tags question: http://stackoverflow.com/q/26129867
tags question: http://stackoverflow.com/q/26097641
tags question: http://stackoverflow.com/q/26151428
type: Tag

http://stackoverflow.com/comment/40852010
comment on: http://stackoverflow.com/a/26073339
score: 0
has text: Great..It worked.. Can you please elaborate this one "use of @Transactional on the dao's implementation code means that Spring will create a JDK proxy for it".
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40952556
has text: @DarbininkaiBroliai you can set them to an array or something. Check edits. Just one of the ways to do it
type: Comment
comment on: http://stackoverflow.com/a/26128369
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41008836
comment on: http://stackoverflow.com/a/26159168
score: 0
type: Comment
has text: I did that and it said, "Cannot resolve symbol support" at the import statement.
type: AnswerComment

http://stackoverflow.com/comment/40925321
score: 0
type: Comment
type: AnswerComment
has text: @KickButtowski you can write a code and check yourself is there any difference with `(x,x)`,http://ideone.com/tzWxsr
comment on: http://stackoverflow.com/a/26113655

http://stackoverflow.com/comment/42791034
type: AnswerComment
comment on: http://stackoverflow.com/a/26119745
score: 0
type: Comment
has text: hie @Palak ! can you tell me how to add class path for JDBC in jar system properties ! because i don't know how to do that ! Even links will help ! Thanks a lot in advance .

http://stackoverflow.com/a/26064939
type: Answer
answers question: http://stackoverflow.com/q/26064522
score: 0
has body: This should work - ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("TrackedLocation"); query.whereEqualTo("imei", helpUtils.getDeviceIDEqualsIMEI()); query.setLimit(1000); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { @Override public void done(List&lt;ParseObject&gt; dataList, ParseException e) {} }); Source : Not able to retrieve array from parse.com

http://stackoverflow.com/q/26116141
favorite count: 0
has title: Why can't I catch the exception more than one time?
has comment: http://stackoverflow.com/comment/40929786
tagged with: language-lawyer
has comment: http://stackoverflow.com/comment/40929891
tagged with: exception
has comment: http://stackoverflow.com/comment/40929927
has comment: http://stackoverflow.com/comment/40929871
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26116207
has comment: http://stackoverflow.com/comment/40930071
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26116183
has body: JLS 8, 14.20: A try statement executes a block. If a value is thrown and the try statement has one or more catch clauses that can catch it, then control will be transferred to the first such catch clause. It looks like I may have for instance two catch clauses for the same exception type. But when I try this I'll receive compile-time error. public static void main (String[] args) throws java.lang.Exception { try{ } catch(RuntimeException ioe){ } catch(NumberFormatException e){ //Already caught } } IDEONE Could you explain it using JLS?
has answer: http://stackoverflow.com/a/26116279
possible better answer: http://stackoverflow.com/a/26116183
linked to: http://stackoverflow.com/q/25624317
has answer: http://stackoverflow.com/a/26116207
has answer: http://stackoverflow.com/a/26116186
downvote count: 0
has comment: http://stackoverflow.com/comment/40929758

http://stackoverflow.com/q/26067818
answer count: 1
has comment: http://stackoverflow.com/comment/40842300
tagged with: sockets
has title: Java Sockets - Messages between many clients
has answer: http://stackoverflow.com/a/26068250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40842812
tagged with: java
has comment: http://stackoverflow.com/comment/40842310
type: Question
tagged with: ipc
has comment: http://stackoverflow.com/comment/40842319
accepted answer: http://stackoverflow.com/a/26068250
score: 0
has body: So the problem is I have fifteen clients which need to be able to communicate between each other. My question is how should this be done? Clearly one way is to simply make the clients also servers, but that means 120 unique connections necessary to fully connect the fifteen clients. I'd rather not do this as it seems messy. Current solution: Each new connection has the server spin off a separate thread for listening to it. Each client has a separate thread monitoring the channel for incoming information. Server acts as a message router: Process 1 needs to send a message to Process 2 and sends a message to the server indicating intended recipient, sender, and message. Upon receiving the message the server passes message to Process 2. The listening thread detects it and passes it to the process. So on for each message between the clients. This seems clunky. Is there a better methodology/package to use for this?

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/26038715
type: Tag
tags question: http://stackoverflow.com/q/26083655
tags question: http://stackoverflow.com/q/26105184

http://stackoverflow.com/comment/40895683
score: 0
type: Comment
has text: version of mysql connector/j?
comment on: http://stackoverflow.com/a/26096359
type: AnswerComment

alfresco
tags question: http://stackoverflow.com/q/26167169
type: Tag
tag name: alfresco

http://stackoverflow.com/comment/41021230
type: AnswerComment
type: Comment
has text: yesss i did not notice i was wrong to import the datasource! that solves the error! thanks
score: 0
comment on: http://stackoverflow.com/a/26165480

http://stackoverflow.com/a/26089459
answers question: http://stackoverflow.com/q/26089364
type: Answer
accepted answer of: http://stackoverflow.com/q/26089364
has body: From Wikipedia: A Java applet is a small application which is written in Java and delivered to users in the form of bytecode. The user launches the Java applet from a web page, and the applet is then executed within a Java Virtual Machine (JVM) in a process separate from the web browser itself. Applets are used to provide interactive features to web applications that cannot be provided by HTML alone. They can capture mouse input and also have controls like buttons or check boxes. In response to user actions, an applet can change the provided graphic content. This makes applets well-suited for demonstration, visualization, and teaching. A servlet is a Java programming language class used to extend the capabilities of a server. Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers. Servlets are the Java counterpart to other dynamic Web content technologies such as PHP and ASP.NET. In other words, a Servlet is an object that receives a request and generates a response based on that request.
upvote count: 4
downvote count: 0
type: AcceptedAnswer
score: 4

http://stackoverflow.com/q/26112902
answer count: 2
linked to: http://stackoverflow.com/q/17218971
downvote count: 0
tagged with: bufferedreader
favorite count: 0
has answer: http://stackoverflow.com/a/26113324
score: 2
accepted answer: http://stackoverflow.com/a/26113324
upvote count: 2
has comment: http://stackoverflow.com/comment/40924155
has body: I'm stuck on writing to a specific line using File, BufferedReader, &amp; BufferedWriter. What I'm trying to achieve is getting my text files total line count (-3) &amp; writing to that line. Currently it just erases the whole file &amp; nothing is written. Image of what I'm doing: (In Image) line 25 is blank &amp; 26 doesn't contain a doc. it contains "}" &amp; My code: package com.tests.writer; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.swing.JFrame; public class NewWriter { static Integer tableCount; static File file; static FileWriter fw; static FileReader fr; static BufferedWriter bw; static BufferedReader br; public static void main(String[] args) { JFrame frame = new JFrame("Test {New Writer}"); frame.setBounds(500, 500, 500, 500); frame.setVisible(true); frame.setResizable(false); frame.setAutoRequestFocus(true); try { startApplication(); } catch (IOException e) { e.printStackTrace(); } } private static void startApplication () throws IOException { writeToFile (); } private static void writeToFile () throws IOException { Integer lineTCount = 0; file = new File("Tables.txt"); if (file.exists()) { fw = new FileWriter(file.getAbsolutePath(), true); fr = new FileReader(file.getAbsolutePath()); bw = new BufferedWriter(fw); br = new BufferedReader(fr); for (String line = br.readLine(); line != null; line = br.readLine()) { lineTCount++; System.out.println(lineTCount); } System.out.println(lineTCount); bw.write("Test Text to insert"); System.out.println("done"); System.exit(0); } else { file.createNewFile(); System.out.println("New File = " + file.toString()); writeToFile(); } } } If there is an easier way of doing this, I'm open to all idea's as I'm still not familiar with Java.io &amp; If anyone can tell me this is correct. I may have to add the whole file to a list, add the new text then re-write the file.
type: Question
type: AnsweredQuestion
tagged with: bufferedwriter
has title: Java get line total then write to specific line
linked to: http://stackoverflow.com/q/12893350
possible better answer: http://stackoverflow.com/a/26112952
tagged with: java
has answer: http://stackoverflow.com/a/26112952

http://stackoverflow.com/comment/42299752
comment on: http://stackoverflow.com/a/26143348
has text: Thanks, @dic19. Your answer was very clear and concise. It didn't explicitly detail how to set a JFrame size & location with that Preferences data, but I was able to figure it out on my own in about an hour. (I'm a slow learner.) Thank you again; you're awesome!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26186578
possible better answer: http://stackoverflow.com/a/26186617
has answer: http://stackoverflow.com/a/26186617
type: Question
tagged with: java
has title: nested parantheses in function definitions
has answer: http://stackoverflow.com/a/26186623
score: 0
has answer: http://stackoverflow.com/a/26186770
has body: I am learning java and first program i am making is Hello World. I was able to print it but then i tried to play with it. According to me the below program should not compile but it is compiling and printing Hello World. class Hello { // main: generate some output public static void main(String args[]){ System.out.print(("Hello World")); } } But if i do same thing with main method it is giving me multiple error while compiling. class Hello { // main: generate some output public static void main((String args[])){ System.out.print((("Hello World"))); } } Here are some of the compile errors for second program: Hello.java:5: error: ';' expected public static void main((String args[])){ ^ Hello.java:6: error: illegal start of type System.out.print((("Hello World"))); ^ Hello.java:6: error: ';' expected System.out.print((("Hello World"))); Can someone explain me why first program is compiled successfully and second one gave error?
has comment: http://stackoverflow.com/comment/41060503
answer count: 4
has answer: http://stackoverflow.com/a/26186638
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26186770

http://stackoverflow.com/comment/41000034
has text: But static methods can't be abstract. That is essentially how my entire dilemma began. I would like to keep my method static becuase it's independent of a class instance; in fact, it is used to generate a list of instances.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26154270

http://stackoverflow.com/comment/41021563
comment on: http://stackoverflow.com/q/26165506
type: Comment
type: QuestionComment
has text: What is the problem?
score: 1

http://stackoverflow.com/comment/41080152
score: 0
type: Comment
has text: The code works fine for me. Post your [SSCCE](http://sscce.org/) that demonstrates the problem.
comment on: http://stackoverflow.com/a/26194266
type: AnswerComment

http://stackoverflow.com/q/26037816
score: 0
tagged with: java
has body: This question is maybe a weird one, but my employer has asked me to find out and thus I will. In our application we use an external REST api to search for some data. This REST api has the possibility of delivering many types of data, but it is only possible to look up one type of data at a time. For example city names and street names. In our app we force the users to choose what data type to look for as they search, but now our users don't want to do this. So if they search for example 'los' they want the result to contain both "Los Angeles" and 'Losing Street'. For this to be possible for us right now, we would have to do two separate searches in the REST API and merge the results. So instead my employer has read about Solr and is adamant that it is possible to index the REST API so that we use Solr to search for what we want in one search request. I am not so sure. Is it possible, and is it feasible?
answer count: 3
has comment: http://stackoverflow.com/comment/40885534
has answer: http://stackoverflow.com/a/26038085
has answer: http://stackoverflow.com/a/26046467
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26163197
tagged with: search
tagged with: rest
linked to: http://stackoverflow.com/q/8294337
type: Question
tagged with: solr
has title: Indexing external rest api with solr, possible?
tagged with: indexing

http://stackoverflow.com/comment/40887680
comment on: http://stackoverflow.com/a/26089136
has text: @Diedre: No, there's nothing magical about arrays, but it happens because you are passing a **reference** type as a parameter, and you will want to study up on what that means. While each object will have its own array variable, both of those variables will be referencing the same array object. This concept is **very** important and underlies much of Java programming.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40913408
comment on: http://stackoverflow.com/a/26106792
type: Comment
has text: but I guess it's down to OP to look at parametrized tests and see for himself
score: 0
type: AnswerComment

heap-memory
tags question: http://stackoverflow.com/q/26114452
tag name: heap-memory
tags question: http://stackoverflow.com/q/26035839
type: Tag
tags question: http://stackoverflow.com/q/26117977
tags question: http://stackoverflow.com/q/26110244
tags question: http://stackoverflow.com/q/26143275

http://stackoverflow.com/comment/41017799
score: 0
type: Comment
type: QuestionComment
has text: @chiastic-security "What happens if you Ctrl-Shift-F to format it?" - He said it was blank. Why would you reformat a file that contains nothing but a blank line?
comment on: http://stackoverflow.com/q/26163693

http://stackoverflow.com/q/26097213
has comment: http://stackoverflow.com/comment/40898597
tagged with: javafx-2
tagged with: fxml
has body: In Android There is a ListView Like This How Can This be acheived in Java FX, Any links, suggestion or Custom Components ? I goggled and did not find any? however the closely related is Accordion but it does not suit look and feel. it should b like a LIST with evenly sized cells. any Help? I am using JavaFx 2. Edit: As suggested in comments that tree view can help me. Ok. But i tried to use tree view and i also read this blog post http://myjavafx.blogspot.com/2012/03/treeview-with-data-source.html but how can I customize the one row. i mean how can i map or bind the data from my Alerts POJO to different labels and image views . e.g some thing like TreeView<Alerts> tv = new TreeView<>(new Alerts("Incedent Name","Alerts Title", "Short Message","Sender",new Date(),new Image("titleImage.png"), typeColor)); and all these value mapped to corresponding Labels and Images to in a single row. As There is no Expandable List right now offered by JavaFX so I think this approach. can any body have suggestions or sample mapping code etc.
upvote count: 3
type: UnansweredQuestion
has title: Expandable List in javafx like android
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40902847
has comment: http://stackoverflow.com/comment/52386307
has comment: http://stackoverflow.com/comment/40898126
has answer: http://stackoverflow.com/a/26102291
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40898059
favorite count: 0
has comment: http://stackoverflow.com/comment/40900556

http://stackoverflow.com/a/31604438
upvote count: 2
answers question: http://stackoverflow.com/q/26116948
downvote count: 0
has body: you can change Edit color Underline in EditText specifying it in styles.xml. In your app theme styles.xml add the following. @color/primary_text_color
type: Answer
score: 2

http://stackoverflow.com/comment/40782283
type: Comment
type: QuestionComment
has text: Why is the answer 20 if he should find out the numbers? 101 seems like a valid number. Or should he find out how many numbers from the range?
comment on: http://stackoverflow.com/q/26034862
score: 0

http://stackoverflow.com/comment/40989527
type: AnswerComment
comment on: http://stackoverflow.com/a/26148646
score: 0
type: Comment
has text: a) You can't get an iterator from the `NetworkInterface` class. b) you can't reset an iterator either!

http://stackoverflow.com/comment/40860646
score: 0
comment on: http://stackoverflow.com/q/26078064
has text: Your code has 3 `{` but 4 `}`. Copy & Paste error?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/72366583
score: 0
type: AnswerComment
type: Comment
has text: Could you explain, why it should be in one of submodules? Not in all or in the parent?
comment on: http://stackoverflow.com/a/28645755

http://stackoverflow.com/comment/40881286
comment on: http://stackoverflow.com/a/26086062
type: AnswerComment
type: Comment
score: 0
has text: Thank you, sir! :) I copied the webdefault.xml (with that class name) from the jetty.jar in my repository, probably not the proper one. Not exactly what I wanted but it has worked. Thanks again

http://stackoverflow.com/a/26036881
score: 1
upvote count: 1
has body: In Java == compares whether the two references refers to the same object. It does not check whether the content of the string is equal. As already stated, use String.equals(otherString) instead
answers question: http://stackoverflow.com/q/26036813
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40992184
comment on: http://stackoverflow.com/a/26149846
score: 0
type: AnswerComment
type: Comment
has text: @user3795356: when a thread acquires a lock it prevents any other thread from taking that lock.

http://stackoverflow.com/comment/40793292
score: 0
type: Comment
type: QuestionComment
has text: I don't understand. Do you want the `Field` instance for the `myAttribute` field from the class `AbstractSomething`?
comment on: http://stackoverflow.com/q/26041433

http://stackoverflow.com/comment/41005458
comment on: http://stackoverflow.com/a/26157206
score: 0
type: Comment
has text: That's not what the op asked. So I'm sorry you inform you that this is not wrong whatsoever.
type: AnswerComment

http://stackoverflow.com/comment/40995342
comment on: http://stackoverflow.com/a/26151620
type: AnswerComment
has text: Well I get what you are trying to guide me. But I don't want to merge the two documents and filter them using XSLT. I also edited the question, as I was trying a test the functionality looking for the solutions online. I think it is possible, but I don't know how to do it. The error I am getting I have added it to the question.
score: 0
type: Comment

http://stackoverflow.com/q/26097760
has comment: http://stackoverflow.com/comment/40897166
type: Question
has title: How to unmarshall SOAP XML to Java Object
score: 18
upvote count: 18
has answer: http://stackoverflow.com/a/26098116
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/19395400
favorite count: 0
duplicate of: http://stackoverflow.com/q/19395400
has body: while trying to unmarshall my soap XML to JAXB object am getting the following error. We are getting error that expected element is none. Should anything specific be done while unmarshalling the SOAP XML. javax.xml.bind.JAXBContext jaxbContext = (javax.xml.bind.JAXBContext) JAXBContext.newInstance(Class.forName(requestName)); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(SoapXmlString); reqInfo = unmarshaller.unmarshal(reader); Am getting the following error : javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Envelope"). Expected elements are (none) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement and here is the sample XML &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://example.com/v2"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;v2:createSession&gt; &lt;v2:client&gt; &lt;!--Optional:--&gt; &lt;v2:name&gt;?&lt;/v2:name&gt; &lt;!--Optional:--&gt; &lt;v2:clientId&gt;?&lt;/v2:clientId&gt; &lt;!--Optional:--&gt; &lt;v2:requestId&gt;?&lt;/v2:requestId&gt; &lt;/v2:client&gt; &lt;!--Optional:--&gt; &lt;v2:oldSessionId&gt;?&lt;/v2:oldSessionId&gt; &lt;!--Optional:--&gt; &lt;v2:clientIp&gt;?&lt;/v2:clientIp&gt; &lt;!--Optional:--&gt; &lt;v2:clientIpStatus&gt;?&lt;/v2:clientIpStatus&gt; &lt;!--Optional:--&gt; &lt;v2:superBYOBFlow&gt;?&lt;/v2:superBYOBFlow&gt; &lt;!--Optional:--&gt; &lt;v2:FlowParams&gt;?&lt;/v2:FlowParams&gt; &lt;!--Optional:--&gt; &lt;v2:deviceInfo&gt;?&lt;/v2:deviceInfo&gt; &lt;/v2:c…
has comment: http://stackoverflow.com/comment/51022427
tagged with: soap
has comment: http://stackoverflow.com/comment/40897246
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26098116
has comment: http://stackoverflow.com/comment/40897133
tagged with: java
tagged with: jaxb

http://stackoverflow.com/q/26176802
tagged with: immutability
upvote count: 3
has comment: http://stackoverflow.com/comment/41044467
has comment: http://stackoverflow.com/comment/41042776
has comment: http://stackoverflow.com/comment/41041830
has comment: http://stackoverflow.com/comment/41041799
has answer: http://stackoverflow.com/a/26176881
has answer: http://stackoverflow.com/a/26176864
tagged with: java
answer count: 5
linked to: http://stackoverflow.com/q/11700320
has answer: http://stackoverflow.com/a/26176876
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41042522
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/41044237
accepted answer: http://stackoverflow.com/a/26176881
favorite count: 0
has answer: http://stackoverflow.com/a/26176903
type: Question
score: 3
has body: static final String = "something"; I was wondering if such a declaration has some kind real sense in Java. I've found it thousands of time within the code but studying and playing with strings I've learnt that does not matter how many times you declare a String object: if some class before yours declared this string this is pooled and reused (I'm talking about String created without explicit constructor invocation) public class StringCompare { private void toCompare(String h) { String x = "hello"; System.out.println( x == h); } public void compare() { String h = "hello"; toCompare(h); } } This code, in fact, prints true when calling compare so the 2 variables are referencing the same object. Said that a final variable can't be redefined, the static word is completely useless in this case. Am I missing the point? Couple of more things: 1 - Why explicit call to String constructor won't cause the String to be pooled? Same code above using a new String("hello") print false. 2 - Is the pooling behaviour reserved to Strings? There are some other immutable objects (like BigInteger) but I think these are not pooled ... why? Thanks, Carlo
has title: static final String = "something" -- does the static make sense?
has answer: http://stackoverflow.com/a/26176867
has comment: http://stackoverflow.com/comment/41041845
tagged with: object-pooling
possible better answer: http://stackoverflow.com/a/26176903

http://stackoverflow.com/comment/71479232
comment on: http://stackoverflow.com/a/26185595
score: 0
type: AnswerComment
type: Comment
has text: @User9527 I have just run it.. works. This code `final Integer integer = new Integer(3); System.out.println(integer); p1(integer); System.out.println(integer);` prints 3 and 2.

http://stackoverflow.com/comment/40976187
type: QuestionComment
score: 2
has text: Or you can use `abstract` class in instead of `interface A`
comment on: http://stackoverflow.com/q/26141605
type: Comment

http://stackoverflow.com/q/26048995
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26049406
tagged with: tostring
score: 2
downvote count: 0
has body: I'd like to know how to format toString: I tried using printf and string.format but it wants me to change String and int to Object[] I want it to look like this: (Spaces) Book1______Author1________850 Book23_____Author2424_____250 class Book { private String title,author; private int numberOfPages; Book() { } public Book(String title, String author, int pages) { this.title = title; this.author = author; this.numberOfPages = pages; } public String toString() { return(title + "%63s") + "\t" + (author + "%63s") + "\t" + numberOfPages; // It actually works but makes the "%63s" appear :o } }
tagged with: java
has comment: http://stackoverflow.com/comment/40807789
has comment: http://stackoverflow.com/comment/40807588
type: Question
tagged with: format
has answer: http://stackoverflow.com/a/26049167
upvote count: 2
has answer: http://stackoverflow.com/a/26049120
answer count: 3
has comment: http://stackoverflow.com/comment/40807699
has title: Formatting toString Java

http://stackoverflow.com/a/26113738
type: Answer
has comment: http://stackoverflow.com/comment/40926101
upvote count: 2
downvote count: 3
answers question: http://stackoverflow.com/q/26113576
has body: This will cause a NullPointerException No it won't, unless 'map' is null. because the HashCode of the x and y are different No they aren't.
has comment: http://stackoverflow.com/comment/40931555
score: -1
has comment: http://stackoverflow.com/comment/40926600
has comment: http://stackoverflow.com/comment/40926777

http://stackoverflow.com/a/26068978
answers question: http://stackoverflow.com/q/26068809
type: Answer
has body: The folder that holds the class file (.) is not on the classpath. Add another :. to the classpath: java -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar:. Crawler arg0 arg1
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26068809
upvote count: 2

http://stackoverflow.com/comment/40830743
type: Comment
type: AnswerComment
has text: Let me see if I got you; I need to kill my parent JFrame to kill it's panel sons otherwise they will not be collected, is that it?
score: 0
comment on: http://stackoverflow.com/a/26061742

http://stackoverflow.com/comment/40990792
has text: See http://stackoverflow.com/questions/18530112/how-to-create-files-under-web-inf
comment on: http://stackoverflow.com/q/26149080
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26091042
linked to: http://stackoverflow.com/q/22579554
has body: I am trying to create buttons dynamically in a loop from an array. I keep getting java NullPointerException error even after I read and followed the instructions on this post where someone had a similar problem and was advised to allocate the elements within his array. I did that but am still getting the same error. Can someone please show me where am going wrong? Here is my code: @Override protected void onMain_SavePersonAction(final Component c, ActionEvent event) { // declares an array of integers final String[] anArray; // allocates memory for 8 values anArray = new String[]{"100","200","400","500","600","700","800","900"}; Button[] button = new Button[anArray.length]; for (int i = 0; i &lt; anArray.length; i++) { button[i].setIcon(fetchResourceFile().getImage("personIcon.png")); button[i].setText("Member: "+i); button[i].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { findName().setText("Firstname "); findVorname().setText("Secondname "); findFamMname().setText("Firstname Secondname" ); findFamMname().setIcon(fetchResourceFile().getImage("personIcon.png")); findFamMname2().setText("Firstname Secondname "); findFamMname2().setIcon(fetchResourceFile().getImage("personIcon.png")); findDeleteMember().setVisible(true); c.getComponentForm().revalidate(); c.getComponentForm().repaint(); } }); findFamilyMembers().addComponent(button[i]); } c.getComponentForm().revalidate(); c.getComponentForm().repaint(); }
tagged with: java
has answer: http://stackoverflow.com/a/26091111
type: Question
has comment: http://stackoverflow.com/comment/40890159
has title: Codename one giving java NullPointerException error when creating dynamic buttons from an array loop
tagged with: arrays
score: 0
tagged with: codenameone
answer count: 1
tagged with: button
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40884840

http://stackoverflow.com/comment/41031128
has text: Can someone confirm if my code as a whole is correct, or are you guys able to spot something wrong. Recall, I am still learning these things on my own pretty much. I appreciate your input.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26170786

http://stackoverflow.com/a/26075278
score: 0
has comment: http://stackoverflow.com/comment/40855253
type: Answer
answers question: http://stackoverflow.com/q/26074992
has comment: http://stackoverflow.com/comment/40855500
has body: I've had a similar(in terms of what I had to tackle) when doing a 2D game using my own engine. LWJGL's blend functions always have a few issues and there aren't really that many concrete answers for them as it really boils down to your code and how you placed things. I presume you're using SlickUtil, and to that I would say write your own (or of course search around) your own methods for this. Util's methods were always somewhat wonky with blending. Removing alpha shouldn't have changed much in terms of getting what you want The only time I explicitly enable GL_BLEND is when rendering lights(always presuming you're doing 3D) and when I would render textures I suggest not removing glClearColor, that doesn't directly affect your situation as long as you put it in the correct place Like I said this bug/problem could be due to quite a few things that I can't quite pin-point from what you've posted. My suggestions are: Organise the whole project well to be able to point bugs out quickly Make alot of stuff generic ASAP(Doesn't matter if you just want to quickly write something) Avoid SlickUtil, it's great and I LOVE it but it does get it's issues Sorry I can't help too much but tracking down your issue from the jumbled up code you posted is a bit difficult. I'll keep my eye on this question in case I may be of help in the future.

http://stackoverflow.com/a/26165217
answers question: http://stackoverflow.com/q/26148071
type: Answer
score: 0
has body: You must not use MediaView as the root node, because it doesn't extend from Parent. Try to wrap your MediaView inside a Pane. For example : <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.media.*?> <?import javafx.scene.layout.AnchorPane?> <MediaView fx:id="astrolabe_intro"/> N.B. You might also want to define different reference name for your MediaView and MediaPlayer. In the above example you have defined fx:id of MediaView and ref for MediaPlayer as astrolabe_intro A simple example of MediaView/MediaPlayer is here and FXML is here
has comment: http://stackoverflow.com/comment/41032615
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41032655
accepted answer of: http://stackoverflow.com/q/26148071

http://stackoverflow.com/q/26121334
has answer: http://stackoverflow.com/a/26121435
has comment: http://stackoverflow.com/comment/40938796
type: Question
linked to: http://stackoverflow.com/q/94361
has answer: http://stackoverflow.com/a/26121341
has answer: http://stackoverflow.com/a/26121418
accepted answer: http://stackoverflow.com/a/26121418
tagged with: java
downvote count: 4
answer count: 3
has title: what does the @Override does in Java?
favorite count: 0
possible better answer: http://stackoverflow.com/a/26121341
has body: i wonder what does the @Override does in Java? My program runs properly without it. Netbeans put a yellow line in my method suggesting to use @Override. But even if i ignore the suggestion, my program runs without any error. Well, i'm just curious. thanks for any reply.
duplicate of: http://stackoverflow.com/q/94361
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40939502
upvote count: 1

http://stackoverflow.com/q/26057895
has comment: http://stackoverflow.com/comment/40848685
tagged with: listview
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26938939
tagged with: adapter
type: UnansweredQuestion
tagged with: android
has body: I have a class which retrives data from my database and displays it in a listview using simple adapter public class ViewExs extends ListActivity { // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; productsList; // url to get all products list private static String url_all_products = "http://www.lamia.byethost18.com/get_all_ex.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCTS = "products"; private static final String TAG_PID = "ID_exercise"; private static final String TAG_NAME = "ID_exercise"; // products JSONArray JSONArray products = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_exs); // Hashmap for ListView productsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Loading products in Background Thread new LoadAllProducts().execute(); // Get listview ListView lv = getListView(); // on seleting single product // launching Edit Product Screen lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent i = new Intent(getApplicationContext(), EditProductActivity.class); startActivity(i); /* // getting values from selected ListItem String pid = ((TextView) view.findViewById(R.id.pid)).getText() .toString(); // Starting new intent Intent in = new Intent(getApplicationContext(), EditProductActivity.class); // sending pid to next activity in.putExtra(TAG_PID, pid); // starting new activity and expecting some response back startActivityForResult(in, 100);*/ } }); } // Response from Edit Product Activity @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // if result code 100 if (resultCode == …
tagged with: java
has answer: http://stackoverflow.com/a/26058715
tagged with: eclipse
has answer: http://stackoverflow.com/a/26058154
has title: from simple list adapter to custom array adapter
type: Question
has comment: http://stackoverflow.com/comment/40823256

http://stackoverflow.com/comment/40943699
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26123065
type: AnswerComment
has text: Still does not work. If I do that I get another error. I will post it as an answer below. Any idea?

http://stackoverflow.com/comment/40962180
has text: i^m glad that helped out, but to be fair, @RyPope had the same idea ^^ so we were **both** right ^^
score: 0
comment on: http://stackoverflow.com/q/26128820
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26069978
type: UnansweredQuestion
tagged with: scala
has title: How can I inspect a SearchRequestObject to what its query, filter, and aggs parameters are?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26079008
type: Question
score: 0
answer count: 1
tagged with: elasticsearch
has body: I'm developing an application based upon Elasticsearch. I need to be able to to construct a SearchRequestBuilder object from a JSON string. I can do that ok using the setSource method and passing a full JSON query object as parameter. So far so good. An example: (Obs.: I'm using the Java API from Scala). var builder = client.java.prepareSearch("logindex*") .setSource(""" { "query": { "filtered": { "query": { "query_string": { "query": ":mimeType:text\\/html" } }, "filter": { "range": { "datetime": { "gte": "2014-09-18T00:56:00", "lte": "2014-09-29T00:56:00" } } } } } }""") But I also really need to be able to "inspect" the object created in that manner and see what its query is, for example (so I can make sure that the user isn't trying to access something he/she shouldn't be and so on). Ideally I would like to have methods like getQueryBuilder and the like. // i know I can manipulate the previously created object like this: builder.addAggregation(...) // but can I also perhaps ask questions to the object? // for instance var query = builder.getQueryBuilder //or something like this // and then find out what type of query it is and maybe turn it into a filtered query // so I can limit what the users can view. I was hopeful that SearchRequestBuilder#internalBuilder could be what I was looking for but I couldn't get any useful info from it. I hope that I managed to get my point across and that I made myself understood.

http://stackoverflow.com/a/26097142
has comment: http://stackoverflow.com/comment/40895825
has comment: http://stackoverflow.com/comment/40898496
type: Answer
has body: There are several issues here: Your named queries should use entities not tables. If you want native queries you should use NamedNativeQuery instead. You don't need to supply the entity name when fetching the query. Change this: Query query = session.getNamedQuery("hibernate_tut_emp.Employee.FindCountOfNames"); to: Query query = session.getNamedQuery("FindCountOfNames");
has comment: http://stackoverflow.com/comment/40898554
downvote count: 0
has comment: http://stackoverflow.com/comment/40896605
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40896019
accepted answer of: http://stackoverflow.com/q/26084031
upvote count: 5
answers question: http://stackoverflow.com/q/26084031

http://stackoverflow.com/a/26181906
accepted answer of: http://stackoverflow.com/q/26179574
type: AcceptedAnswer
has body: Here's how I'd do it. I hope it clarifies the stopping condition and the recursion. As you can see, static methods are not an issue: import java.util.ArrayList; import java.util.List; /** * Demo of recursion * User: mduffy * Date: 10/3/2014 * Time: 10:56 AM * @link http://stackoverflow.com/questions/26179574/recursive-method-not-properly-executing?noredirect=1#comment41047653_26179574 */ public class RecursionDemo { public static void main(String[] args) { List&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;(); for (String arg : args) { values.add(Integer.valueOf(arg)); } System.out.println(String.format("input values : %s", values)); System.out.println(String.format("iterative sum: %d", getSumUsingIteration(values))); System.out.println(String.format("recursive sum: %d", getSumUsingRecursion(values))); } public static int getSumUsingIteration(List&lt;Integer&gt; values) { int sum = 0; if (values != null) { for (int value : values) { sum += value; } } return sum; } public static int getSumUsingRecursion(List&lt;Integer&gt; values) { if ((values == null) || (values.size() == 0)) { return 0; } else { if (values.size() == 1) { // This is the stopping condition return values.get(0); } else { return values.get(0) + getSumUsingRecursion(values.subList(1, values.size())); // Here is recursion } } } } Here is the case I used to test it: input values : [1, 2, 3, 4, 5, 6] iterative sum: 21 recursive sum: 21 Process finished with exit code 0
type: Answer
answers question: http://stackoverflow.com/q/26179574
score: 0

http://stackoverflow.com/a/26103594
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26103018
has body: According to Tomcat DOCU, you need add the block in your web.xml Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the <Context> configurartion for the web application. jdbc/tomcatDataSource javax.sql.DataSource Container
type: Answer
has comment: http://stackoverflow.com/comment/40907926
has comment: http://stackoverflow.com/comment/40907831
upvote count: 5
answers question: http://stackoverflow.com/q/26103018
has comment: http://stackoverflow.com/comment/40907540

http://stackoverflow.com/q/26056342
tagged with: java
accepted answer: http://stackoverflow.com/a/26190085
type: Question
tagged with: jsoup
downvote count: 0
has body: The Question how to extract Text from HTML using Java has been viewed and duplicated a zillion times: Text Extraction from HTML Java Thanks to the answers found on Stackoverflow my current state of affairs is that I am using JSoup org.jsoup jsoup 1.7.3 and this piece or code: // parse the html from the givne string Document doc = Jsoup.parse(html); // loop over children elements of the body tag for (Element el:doc.select("body").select("*")) { // loop over all textnodes of these children for (TextNode textNode:el.textNodes()) { // make sure there is some text other than whitespace if (textNode.text().trim().length()>0) { // show: // the original node name // the name of the subnode witht the text // the text System.out.println(el.nodeName()+"."+textNode.nodeName()+":"+textNode.text()); } } } Now I'd also like to show the line number and the original html source code the textNode at hand came from. I doubt JSoup can do this (e.g. see) and trying a work around like: int pos = html.indexOf(textNode.outerHtml()); does not reliably find the original html. So I assume I might have to switch to another Library or approach. Jericho-html: is it possible to extract text with reference to positions in source file? has an answer that says "Jericho can do it" as the link above also points out. But the pointer to real working code is missing. Whith Jericho I got as far as: Source htmlSource=new Source(html); boolean bodyFound=false; // loop over all elements for (net.htmlparser.jericho.Element el:htmlSource.getAllElements()) { if (el.getName().equals("body")) { bodyFound=true; } if (bodyFound) { TagType tagType = el.getStartTag().getTagType(); if (tagType==StartTagType.NORMAL) { String text=el.getTextExtractor().toString(); if (!text.trim().equals("")) { int cpos = el.getBegin(); System.out.println(el.getName()+"("+tagType.toString()+") line "+ htmlSource.getRow(cpos)+":"+text); } } // if } // if } // for Which is pretty good already since it will give you output like: body(norma…
answer count: 2
linked to: http://stackoverflow.com/q/5579392
tagged with: http://stackoverflow.com/tag/html
possible better answer: http://stackoverflow.com/a/26117188
linked to: http://stackoverflow.com/q/20215002
favorite count: 0
has answer: http://stackoverflow.com/a/26117188
has answer: http://stackoverflow.com/a/26190085
upvote count: 2
tagged with: html-parsing
linked to: http://stackoverflow.com/q/1386107
has title: Text Extraction from HTML using Java including source line number and code
score: 2
type: AnsweredQuestion
tagged with: jericho-html-parser

soap
tags question: http://stackoverflow.com/q/26097760
tags question: http://stackoverflow.com/q/26134348
tags question: http://stackoverflow.com/q/26065326
type: Tag
tags question: http://stackoverflow.com/q/26124260
tags question: http://stackoverflow.com/q/26115937
tags question: http://stackoverflow.com/q/26067552
tags question: http://stackoverflow.com/q/26063634
tags question: http://stackoverflow.com/q/26095881
tags question: http://stackoverflow.com/q/26121406
tags question: http://stackoverflow.com/q/26142508
tags question: http://stackoverflow.com/q/26178774
tags question: http://stackoverflow.com/q/26064658
tags question: http://stackoverflow.com/q/26149131
tags question: http://stackoverflow.com/q/26076107
tags question: http://stackoverflow.com/q/26141432
tags question: http://stackoverflow.com/q/26079848
tags question: http://stackoverflow.com/q/26041535
tags question: http://stackoverflow.com/q/26042804
tags question: http://stackoverflow.com/q/26187657
tag name: soap
tags question: http://stackoverflow.com/q/26111865
tags question: http://stackoverflow.com/q/26098840
tags question: http://stackoverflow.com/q/26153361
tags question: http://stackoverflow.com/q/26060322
tags question: http://stackoverflow.com/q/26039927

http://stackoverflow.com/comment/41247190
comment on: http://stackoverflow.com/a/26266969
has text: @foobar: With my code you don't need casting. Did the new examples clarify that? By the way, which one looks better: `Integer a = new ConversationA().query(new RequestA(), Integer.class);` or `new RequestA().execute().getResult()`?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/48446501
score: 1
has text: How do you customise where the Output Files get generated? They seem to be generated automatically in the OS Simulator or some folder like that. Can you show me your OutputFiles Rules? Thanks.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27593129

http://stackoverflow.com/comment/44694337
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26163068
has text: Great answer! But don't foget to add Ghostscript to the list of dependencies.

http://stackoverflow.com/q/26127934
type: Question
has answer: http://stackoverflow.com/a/26128017
has body: Instance of is considered to be a bad practice in java. But I don't know how to avoid it in such situation. Let's say I have an abstract class ArtObject and there are some subclasses such as Painting, Engraving, etc. And I have a class Museum which contains an ArrayList of ArtObjects. For example, I'd like to print information about all Painting objects in the Museum. Should I do something like this?: public void printAllPaintingsInfo() { for (int i = 0; i &lt; artObjects.size(); i++) { if (artObjects.get(i) instanceof Painting) { System.out.println(artObjects.get(i)); } } } Or a better approach exists?
has answer: http://stackoverflow.com/a/26128025
answer count: 6
has answer: http://stackoverflow.com/a/26128242
possible better answer: http://stackoverflow.com/a/26128017
tagged with: oop
upvote count: 2
tagged with: java
has title: Instanceof correct usage in java
has comment: http://stackoverflow.com/comment/40951508
has answer: http://stackoverflow.com/a/26128670
has answer: http://stackoverflow.com/a/26128060
linked to: http://stackoverflow.com/q/2790144
has comment: http://stackoverflow.com/comment/40951540
accepted answer: http://stackoverflow.com/a/26128670
has comment: http://stackoverflow.com/comment/40951426
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40957009
favorite count: 0
tagged with: instanceof
has comment: http://stackoverflow.com/comment/40951593
has answer: http://stackoverflow.com/a/26128070
has comment: http://stackoverflow.com/comment/40951592

http://stackoverflow.com/q/26082535
tagged with: netty
has answer: http://stackoverflow.com/a/26356065
type: AnsweredQuestion
has title: Network responses got buffer overwritten in stress?
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26355287
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/26355287
score: -1
has body: i've been debugging this issue hardly for two days. And i cannot find an answer after quite a lot searches in/outside stackoverflow. I'm writing a client for customized key/value server. The protocol is simple. If the client send "GET 1 12\r\nkey1\r\nkey2\r\n" the server may replay "0 1 16\r\nvalue1\r\nvalue2\r\n" In the response, first line says the length of body is 16 bytes, and for the next 16 bytes, it contains to values for the two keys. They're seperated by "\r\n". The problem is that, in stress testing, sometime I see from my client ,the response message looks malformed. It looks like the buffer is overwritten. e.g. send "GET 1 12\r\nkey1\r\nkey2\r\n" for 10k times, In response buffer i might see "0 1 16\r\nvalue1\r\nval0 1 16" It looks like value2 here is partially overwritten by the next response. The server has been working there for long time, and I assume it works well. I also use tcpdump and prove it's correct. So the bug should be in client. I followed the Netty Telnet example here, and did small modification. After DelimiterBasedFrameDecoder, a handler parses the lines one by one and assembles the response. I thought it could be related with multi-thread. But even I set thread number to 1, the problem repros. So do I use Netty in an incorrect way? ==================== Update: After more investigation, I found it's not related with Netty. Even with a simple java NIO program, it could repro. It seems it's related with buffer overflow. From tcpdump, I can see the packages from remote server is correct. So I capture every ByteBuffer, and print it out when bug happens. (I deliberately set the buffer size to a small number - 1k.) with this code: protected void onRead(ByteBuffer buf) throws Exception { buf.mark(); int l = buf.limit(); int p = buf.position(); byte[] bytes = new byte[l - p]; buf.get(bytes, p, l - p); String v = new String( bytes, Charset.forName("UTF-8") ); buffers.addFirst(v); if (buffers.size() &gt; 30) { buffers.removeLast(); } buf.reset()…
downvote count: 1
favorite count: 0
upvote count: 0
possible better answer: http://stackoverflow.com/a/26356065

http://stackoverflow.com/comment/41033414
comment on: http://stackoverflow.com/a/26170421
type: AnswerComment
has text: Thanks so much. It was never detrimental to my program, but I've definitely been scratching my head at it for a while. I really appreciate the clarification.
score: 0
type: Comment

http://stackoverflow.com/q/26091613
type: Question
has body: First of all the title might not be the best. Feel free to edit. The problem: Assuming there is this json (quotation is missing, I know): { meta: { code: 200 }, response: { suggestedFilters: { }, suggestedRadius: 922, headerLocation: "New York", headerFullLocation: "New York", headerLocationGranularity: "city", totalResults: 246, groups: [ { type: "Recommended Places", name: "recommended", items: [ { // item I care }, { // item I care } ] } ] } } Is it necessary to pass the whole path in the POJO? For example now my class is: @JsonIgnoreProperties(ignoreUnknown = true) public class MyVenueResponse { private VenueResponse response; public VenueResponse getResponse() { return response; } public class VenueResponse{ private List&lt;VenueGroup&gt; groups; public List&lt;VenueGroup&gt; getGroups() { return groups; } } public class VenueGroup { private ArrayList&lt;GroupItems&gt; items; public ArrayList&lt;GroupItems&gt; getItems() { return items; } } } I really do not care about all the medium classes but only about the public ArrayList&lt;GroupItems&gt; getItems(). Is there a way to "shortcut" the process and tell Jackson to skip the "response" and start from the groups object or doesn't know how to map it? Note that I use databind like: objectMapper.readValue(body.charStream(), MyVenueResponse.class); // where body is a ResponseBody from OKHttp
accepted answer: http://stackoverflow.com/a/26104141
tagged with: jackson
has answer: http://stackoverflow.com/a/26104141
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson get directly nested list as POJO

http://stackoverflow.com/comment/40831141
type: QuestionComment
comment on: http://stackoverflow.com/q/26061971
score: 0
has text: What kind of error are you getting?
type: Comment

http://stackoverflow.com/q/26191830
has comment: http://stackoverflow.com/comment/41073530
accepted answer: http://stackoverflow.com/a/26328064
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26328064
score: -1
tagged with: eclipse
has title: Java Error - net.ucanaccess.jdbc.UcanaccessSQLException: malformed string: '
type: Question
answer count: 1
downvote count: 1
tagged with: osx-yosemite
has comment: http://stackoverflow.com/comment/41069725
has body: I have an error using uCanaccess to retrieve my database which I have saved in my desktop. My code is below: package Week11Package; import java.util.Scanner; import java.sql.*; public class dbTest1 { static Scanner input = new Scanner (System.in); static String url; static Connection aConnection; static Statement aStatement; static boolean gotIt = false; public static void main(String[] args) { dbTest1.initialize(); } public static void initialize() { //establish the DB connection. url = "jdbc:odbc:MS Access Database;DBQ=.//Teams.accdb"; try { //load the jdbc - odbc bridge for Windows Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); //create a connection instance aConnection = DriverManager.getConnection("jdbc:ucanaccess:///Users/Vince/Desktop/Teams.accdb"); //create statement object instance for this connection aStatement = aConnection.createStatement(); String sqlQuery = "SELECT PlayerID, PlayerName, TeamID " + "FROM PLAYER"+"'"; ResultSet rs = aStatement.executeQuery (sqlQuery); gotIt = rs.next(); if (gotIt) { System.out.println("Connected to DB &amp; found Data!!!"); System.out.println("Which Player ID are you looking for?"); String stringpID = input.next(); boolean found = false; while(gotIt){ //extract the data String pID = rs.getString (1); if (pID.equals(stringpID)) found = true; String pName = rs.getString (2); String tID = rs.getString (3); System.out.println(pID+" " +pName+ " "+tID); gotIt = rs.next(); } if (found) System.out.println("The player ws found"); } aStatement.close(); aConnection.close(); } catch (ClassNotFoundException e) { System.err.println(e); } catch (SQLException e) { System.err.println(e); } } } I would appreciate any advice to fix this error. Thanks, Vince
favorite count: 0
tagged with: ucanaccess
upvote count: 0

http://stackoverflow.com/a/26080731
type: Answer
answers question: http://stackoverflow.com/q/26080707
has comment: http://stackoverflow.com/comment/40865638
accepted answer of: http://stackoverflow.com/q/26080707
has body: You would use an Ellipse2D and give it symmetric parameters. e.g.., circ.append(new Ellipse2D.Double(x, y, w, h), true); // where w == h To see all the classes that inherit from java.awt.Shape please check out its API.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40985253
type: Comment
score: 0
type: AnswerComment
has text: @user3098769 - it will work.... because the second element is not a list, because you added the content with `addAll` and not `add`
comment on: http://stackoverflow.com/a/26146374

http://stackoverflow.com/q/26184830
tagged with: java
has body: I want to program two buttons. One should recognize my voice and the other one should use the text-to-speech function. When I speak, the text goes to text2 and the tts is meant take this text. When I write the code separately (VoiceRecognition in one Project, TTs in another), it works. But I wanted to join these two functions, but when I start the program it crashes right away. private Button btnSpeak; private Button btnHear; private EditText txtText; private TextToSpeech tts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tts = new TextToSpeech(this, this); // Button for VoiceRecognition btnHear = (Button)findViewById(R.id.button1); // OnClickListener for btnHear btnHear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "de-DE"); try { startActivityForResult(i, REQUEST_OK); } catch (Exception e) { //Toast.makeText(...); } } }); tts = new TextToSpeech(this, this); // Button for TTS btnSpeak = (Button) findViewById(R.id.button2); txtText = (EditText) findViewById(R.id.text2); // button on click event btnSpeak.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { speakOut(); } }); } Log: 10-03 20:54:58.188: E/AndroidRuntime(9280): FATAL EXCEPTION: main 10-03 20:54:58.188: E/AndroidRuntime(9280): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.logos_daswortgottes/com.example.logos_daswortgottes.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button 10-03 20:54:58.188: E/AndroidRuntime(9280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) 10-03 20:54:58.188: E/AndroidRuntime(9280): at android.app.ActivityThread.handleLaunchActivity(ActivityTh…
has answer: http://stackoverflow.com/a/26185219
type: Question
has comment: http://stackoverflow.com/comment/41057107
has title: Two onClickListeners. Can't start program
score: 0
has comment: http://stackoverflow.com/comment/41057494
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41057071

http://stackoverflow.com/q/26142864
answer count: 5
tagged with: datetime
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/134252517
has comment: http://stackoverflow.com/comment/134270038
has comment: http://stackoverflow.com/comment/40990552
upvote count: 144
has answer: http://stackoverflow.com/a/38052128
accepted answer: http://stackoverflow.com/a/26142960
has title: How to get UTC+0 date in Java 8?
tagged with: java
has comment: http://stackoverflow.com/comment/136158479
type: Question
score: 144
has comment: http://stackoverflow.com/comment/77663356
linked to: http://stackoverflow.com/q/38922754
tagged with: java-time
has body: I have problems with Date class in Java. Date class returns local machine date but i need UTC-0. I have googled and found great solution for JavaScript but for Java nothing useful. How to get UTC+0 date in Java 8?
has answer: http://stackoverflow.com/a/64681852
has answer: http://stackoverflow.com/a/26142960
possible better answer: http://stackoverflow.com/a/38061562
downvote count: 0
has answer: http://stackoverflow.com/a/38061562
has answer: http://stackoverflow.com/a/26142967
linked to: http://stackoverflow.com/q/45350095
favorite count: 0

http://stackoverflow.com/comment/40898952
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26099031
score: 0
has text: yes.. it works.. thanks.. i thought there would be some formatting specially for that..

http://stackoverflow.com/q/26034859
has body: I'm working in a smartgwt project that uses Hibernate. I have a User entity with his DataSource and the DataSource is configured to know about the entity. So anytime I use the DataSource to load Users in the client, the the DataSource uses Hibernate to serialize the Users entities he founds. My problem is that the records I get in the client has a password attribute... of course the password should never be sent to the client! I'm thinking on 2 solutions but until now I could not solve my problem successfully. 1 - I guess it would be possible to configure the Hibernate entity to not serialize the password property but I did not found how. 2 - I also guess that has to be possible to configure the DataSource to ignore that field but no idea how.
tagged with: smartgwt
type: AnsweredQuestion
has title: How to avoid serialization of entity property in Hibernate
accepted answer: http://stackoverflow.com/a/26035036
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26035200
has answer: http://stackoverflow.com/a/26035200
tagged with: entity
score: 0
has answer: http://stackoverflow.com/a/26035036

http://stackoverflow.com/a/26164631
answers question: http://stackoverflow.com/q/26164545
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41019484
upvote count: 2
has body: To check whether a String starts with a vowel, you can use regular expressions. For instance: String[] input = {"abc", "def", "ghi"}; for (String s: input) { System.out.printf("\"%s\" starts with a vowel? %b%n", s, s.matches("(?i)^[aeiouy].*$")); } Output "abc" starts with a vowel? true "def" starts with a vowel? false "ghi" starts with a vowel? false In your case... The method startsWith only takes a literal, so it's not what you want. Instead, you could use a constant Pattern in your class, such as: static final Pattern STARTS_WITH_VOWEL = Pattern.compile("^[aeiouy]", Pattern.CASE_INSENSITIVE); Then in your loop, you could use: if (STARTS_WITH_VOWEL.matcher(s).find()) { ... }
has comment: http://stackoverflow.com/comment/41019340
has comment: http://stackoverflow.com/comment/41019403
has comment: http://stackoverflow.com/comment/41019431
downvote count: 0
has comment: http://stackoverflow.com/comment/41019438

http://stackoverflow.com/comment/41057082
type: Comment
has text: i updated my question above, of course it wont compile that way, i just wanted to make clear to get from 1 to 4 in the outcome, sorry for confusing.
comment on: http://stackoverflow.com/a/26184777
type: AnswerComment
score: 0

http://stackoverflow.com/q/26150075
has comment: http://stackoverflow.com/comment/41182889
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26253162
tagged with: activiti
type: Question
tagged with: java
tagged with: bpmn
tagged with: eclipse
score: 0
has body: I'm new in Activiti and I have some questions. My project is developed in java With Spring , and I installed the Activiti Designer . I drew a process in designer, with service task, and I implements a class that implements JavaDelegate. The problem is that doesn't worked and this doesn't give error. I don't installed a Activiti database. Does it important or mandatory? Someone help me , or someone recommended a very good tutorial .
has title: Activiti Designer Integrate in Spring Java
answer count: 1

http://stackoverflow.com/comment/40935939
has text: That works, but it is quite an ugly syntax. Isn't there another way? What do you mean by "registering the namespace"? Can I set a default namespace for the XPathEvaluator? I assume this is what the XPathNSResolver is for, but I don't understand how to use it.
type: Comment
comment on: http://stackoverflow.com/a/26115994
score: 1
type: AnswerComment

http://stackoverflow.com/a/26117775
answers question: http://stackoverflow.com/q/26117714
type: Answer
has comment: http://stackoverflow.com/comment/40932454
downvote count: 0
score: 1
has body: tail will do the job: java -cp stanford-ner.jar edu.stanford.nlp.ie.NERServer -port 9191 -client &lt; input.txt | tail -n +2 &gt; r.txt
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26117714
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40932437

http://stackoverflow.com/comment/40785669
comment on: http://stackoverflow.com/q/26037366
score: 0
type: Comment
type: QuestionComment
has text: I'm doubt that SO working this way, but here is Code review, ask for moving (flag your question), much luck

http://stackoverflow.com/comment/40920400
score: 0
has text: Ok sorry about that first time using this. I have added all my classes. Ive been working on this for days now and can't seem to figure out why its printing the way it is.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26110683

http://stackoverflow.com/comment/40998809
type: QuestionComment
has text: Thank you that worked. But if I click the circle button again the app closes. I want to be able to fill the screen with circles. Do I need to put my ondraw method in a loop?
score: 0
comment on: http://stackoverflow.com/q/26152547
type: Comment

http://stackoverflow.com/comment/41134028
has text: I've added more details to the end of my original question. Short answer is "No" given the parameters of the original StackOverflow question. Out-of-scope solutions may include things like client-side JavaScript. However, I don't see why this would be necessary. If `MyDTO` is a model object used throughout your application for other purposes, then `MyDTO` should probably not be used as the form-backing bean for this form. The form-backing bean between a view and a controller exists for a specific purpose, and should not affect the architecture for the rest of the application.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26202012
type: Comment

http://stackoverflow.com/q/26095510
answer count: 2
has body: What happens if I serialize a Map(or List) with a java version, and I try to deserialize it with other java version, where the serialVersionUID changed? I suppose it will fail. If you create a lib for others to use what will be the preferred way of serializing objects, using Java Objects like Map, List or using an array of self made objects? e.g. List&lt;MyObject&gt; or MyObject[]? Map&lt;String, MyObject&gt; or MyObject2[] (MyObject2 contains the key and MyObject)?
tagged with: serialization
has answer: http://stackoverflow.com/a/34622281
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40892925
has comment: http://stackoverflow.com/comment/40896406
accepted answer: http://stackoverflow.com/a/34622281
type: Question
possible better answer: http://stackoverflow.com/a/26096301
has answer: http://stackoverflow.com/a/26096301
tagged with: java
has title: Java Map/List serialization/deserialization with different java versions?
has comment: http://stackoverflow.com/comment/40893238
score: 0

http://stackoverflow.com/q/26187657
type: Question
tagged with: ws-addressing
has title: What options are available to implement long polling in Delphi with SOAP?
has comment: http://stackoverflow.com/comment/41063751
has answer: http://stackoverflow.com/a/26191619
tagged with: delphi
downvote count: 0
answer count: 1
favorite count: 0
has body: I have a Delphi enterprise application that acts as a client for a Java backend (SOAP, Axis2). Some of my requests take an indeterminate or especially large amount of time to complete, and I would like to implement a long polling solution for SOAP requests. To the best of my knowledge, I would typically use WS-Addressing for this. It seems, however, that the Delphi SOAP client (WCF) does not implement WS-Addressing. I am locked into Java and Delphi. I use Axis 2 components, such as lifecycles, but it would be possible for me to transition to another web service engine. I control both the server and client side. What are my options for implementing long polling in Delphi and Java?
type: UnansweredQuestion
score: 6
tagged with: delphi-xe2
tagged with: soap
upvote count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/41115780

http://stackoverflow.com/a/26177675
score: 0
type: Answer
has body: Following declaration seems to fix the problem: -keep @com.mycompany.myapp.MyAnnotation interface * { *; }
answers question: http://stackoverflow.com/q/26175379

http://stackoverflow.com/comment/41074690
score: 0
has text: When using telnet it works, the message is received
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26194468

http://stackoverflow.com/q/26132374
has comment: http://stackoverflow.com/comment/40959600
type: Question
tagged with: javascript
upvote count: 0
answer count: 1
tagged with: calculator
has comment: http://stackoverflow.com/comment/40959602
favorite count: 0
has comment: http://stackoverflow.com/comment/40959669
has title: Java Script Gross/Net Pay Calculator
score: -3
has body: Hey I have been having trouble getting the code for the calculate button to function with the code I have.For some reason it isn't displaying correctly. When I click the calculate button to figure out the gross pay and net pay, the button does not calculate the gross pay and net in the input boxes. After I enter the hours worked and pay rate. PLEASE HELP.... Gross Pay and Net Pay. Gross Pay and Net Pay. Hours: Rate: Gross: Net:
has answer: http://stackoverflow.com/a/26132423
type: AnsweredQuestion
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/26132423

http://stackoverflow.com/q/26070602
upvote count: 0
answer count: 1
has title: Building a Java Code for Grading Courses
favorite count: 0
has comment: http://stackoverflow.com/comment/40847276
linked to: http://stackoverflow.com/q/26047555
score: -3
has body: I'm needing a bit of help getting started with a code for my Java course (I had to miss this week and am rather helpless without what they learned) and would appreciate any input on what I'm doing. My goal is to create a code that calculates grades based on inputs. Here's what the final should look like running: Please enter the number of courses that you would like to calculate the Average Score, the Minimum Score and the Maximum Score: 2 Please enter the name of the course: CSC 201 Please enter a score for CSC 201 or type -1 to indicate that there is no more score for this course: *input various values here* The course name: CSC 201 Number of scores: 2 The average score: 80.0 The minimum score: 70 The maximum score: 90 I'm just... Not quite sure where to go. My base code's below, I just have no idea where to go beyond this, or even how to use Math.min and Math.max. Thanks for any help you can offer for ideas on how to go from here! import java.util.Scanner; public class GradeCalc { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter the number of courses that you would like to "); System.out.println("calculate the Average Score, the Minimum Score, and the Maximum Score: "); int status = input.nextInt(); // I am stuck here... // // > Math.min() // > Math.max() } }
type: UnansweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26070684
type: Question

http://stackoverflow.com/comment/40822570
type: Comment
type: QuestionComment
has text: There's nothing weird about it as it's in the *declaration* portion of the variable, even though it's on the right side, since you've not yet created Maps to go into that slot.
comment on: http://stackoverflow.com/q/26050250
score: 0

http://stackoverflow.com/comment/140109605
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26164155
type: Comment
has text: @Holger I like your second approach, but I'm a little confused about your implementation of `mapLeft` via `t -> (Either<T,R>)this`. This gives an "unchecked cast" warning. I would have used simply `r -> right(r)`. Is it that you want to avoid unnecessarily creating a new object? And the casting is fine, because at this place in the code the value is in the right side anyway only?

http://stackoverflow.com/comment/40960254
type: AnswerComment
has text: In running all the code directly on appengine, no VM, no localhost. What do you mean by "frontend" or "backend" ? In Permission, I've added 593689673236@developer.gserviceaccount.com but this email need validation and I don't have the access to that mail box.
type: Comment
comment on: http://stackoverflow.com/a/26109439
score: 0

http://stackoverflow.com/a/26155586
upvote count: 4
has comment: http://stackoverflow.com/comment/41007872
downvote count: 0
answers question: http://stackoverflow.com/q/26151636
score: 4
has comment: http://stackoverflow.com/comment/41276146
has comment: http://stackoverflow.com/comment/41009275
has body: I'm almost sure that your problem is caused because you are creating your DAO by hand with new keyword: @PostConstruct public void init() { dao = new XxxxDAOImpl(); } When you are doing such things, your ejb container cannot manage that object lifecycle and transaction boundaries. You should let the container to create and manage the dao (and inject it for you). In that way, you will gain a proper transaction propagation across all your EJB methods - and thus your problem will be solved. To achieve that, you can simply annotate your DAO class with @Stateless and inject it in your TransactionTestServiceImpl class with: @EJB private XxxxDAO dao; And then, of course, remove init and destroy methods. Personal advice Why to use a separate, additional dao layer at all? In Java EE world the most convenient option is to just use an EntityManager. Entity Manager plays role of dao very well in most use cases. Although JDBC in your example is good enough, JPA is (IMHO) simpler. Update This was a bad guess, see my other answer on this page with updates.
has comment: http://stackoverflow.com/comment/41006466
type: Answer

http://stackoverflow.com/comment/41006995
score: 0
has text: This is a correct code ? but i can't understand it
comment on: http://stackoverflow.com/q/26157987
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41010372
type: AnswerComment
has text: my BitSet will range over values 1 and 0 - not 0 and 30000. Is this what you mean?
comment on: http://stackoverflow.com/a/26153533
type: Comment
score: 0

http://stackoverflow.com/comment/41047796
score: 0
has text: When I see the running process in 'Task Manager' the memory used is not increasing linearly. So which means the created objects were garbage collected side by side? Will it really create a new object per iteration?
type: Comment
comment on: http://stackoverflow.com/a/26165715
type: AnswerComment

http://stackoverflow.com/q/26111846
tagged with: duplicate-detection
score: -1
has title: How do I get my code to find whether a number repeats in an array in Java?
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I've already written the code for this, but it didn't work. If it had worked, the run time complexity would have been very high. for (int collumnInput=0; collumnInput &lt; 3; collumnInput++) { for (int rowInput = 0; rowInput &lt; 3; rowInput++) { try { puzzleArray[collumnInput][rowInput] = scan.nextInt(); if ((puzzleArray[collumnInput][rowInput] &gt; 8) || (puzzleArray[collumnInput][rowInput] &lt; 0)) { System.out.println("Invalid 8-puzzle entered!"); System.exit(0); } for (int collumnCheck = 0; collumnCheck &lt; collumnInput; collumnCheck++)//code to check for duplicates starts here. { for (int rowCheck = 0; rowCheck &lt; rowInput; rowCheck++) { if (puzzleArray[collumnCheck][rowCheck]==puzzleArray[collumnInput][rowInput]) { System.out.println("Invalid 8-puzzle entered!"); System.exit(0); } } } } catch (java.util.InputMismatchException exception) { System.out.println("Invalid 8-puzzle entered!"); System.exit(0); } } } scan.close(); First of all, the code here runs, but doesn't detect duplicates in the array, so how do I fix that? The second thing is, is there a more resource efficient method of doing this? I have seen people use clone and copy methods, but I don't know if those are actually more resource efficient. Thanks.
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/26111903
type: Question
tagged with: arrays

http://stackoverflow.com/a/26123488
has comment: http://stackoverflow.com/comment/40943110
has body: You can run jconsole directly from your terminal by running the command jconsole. reena@IM-1500:~$ jconsole It will launch java monitoring console dialog.
downvote count: 0
answers question: http://stackoverflow.com/q/26123324
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/63774534

http://stackoverflow.com/comment/40944524
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26123833
has text: IS there any way I can stop it writing the same account more than once when it runs through the program again?
score: 0

jpa
tags question: http://stackoverflow.com/q/26139094
tags question: http://stackoverflow.com/q/26133663
tags question: http://stackoverflow.com/q/26119170
tags question: http://stackoverflow.com/q/26156323
tags question: http://stackoverflow.com/q/26068901
tags question: http://stackoverflow.com/q/26101870
tags question: http://stackoverflow.com/q/26035910
tags question: http://stackoverflow.com/q/26072855
tags question: http://stackoverflow.com/q/26076973
tags question: http://stackoverflow.com/q/26040636
tags question: http://stackoverflow.com/q/26054920
tags question: http://stackoverflow.com/q/26190252
tags question: http://stackoverflow.com/q/26058774
tags question: http://stackoverflow.com/q/26144104
tags question: http://stackoverflow.com/q/26046126
tags question: http://stackoverflow.com/q/26047486
tags question: http://stackoverflow.com/q/26135321
tags question: http://stackoverflow.com/q/26064262
tags question: http://stackoverflow.com/q/26122814
tags question: http://stackoverflow.com/q/26175870
tags question: http://stackoverflow.com/q/26062495
tags question: http://stackoverflow.com/q/26058953
tags question: http://stackoverflow.com/q/26054258
tags question: http://stackoverflow.com/q/26058826
tags question: http://stackoverflow.com/q/26046308
tags question: http://stackoverflow.com/q/26121496
tags question: http://stackoverflow.com/q/26142743
tags question: http://stackoverflow.com/q/26064437
tags question: http://stackoverflow.com/q/26157042
tags question: http://stackoverflow.com/q/26177946
tags question: http://stackoverflow.com/q/26069591
tags question: http://stackoverflow.com/q/26133717
tags question: http://stackoverflow.com/q/26098003
type: Tag
tags question: http://stackoverflow.com/q/26174411
tags question: http://stackoverflow.com/q/26065483
tags question: http://stackoverflow.com/q/26092608
tags question: http://stackoverflow.com/q/26069755
tags question: http://stackoverflow.com/q/26165188
tags question: http://stackoverflow.com/q/26176008
tags question: http://stackoverflow.com/q/26045966
tags question: http://stackoverflow.com/q/26173083
tags question: http://stackoverflow.com/q/26192256
tags question: http://stackoverflow.com/q/26086697
tags question: http://stackoverflow.com/q/26149569
tags question: http://stackoverflow.com/q/26132940
tags question: http://stackoverflow.com/q/26119357
tags question: http://stackoverflow.com/q/26106557
tags question: http://stackoverflow.com/q/26176800
tags question: http://stackoverflow.com/q/26100245
tags question: http://stackoverflow.com/q/26080274
tags question: http://stackoverflow.com/q/26103699
tags question: http://stackoverflow.com/q/26112494
tags question: http://stackoverflow.com/q/26084031
tags question: http://stackoverflow.com/q/26129860
tags question: http://stackoverflow.com/q/26061278
tags question: http://stackoverflow.com/q/26159402
tags question: http://stackoverflow.com/q/26113978
tags question: http://stackoverflow.com/q/26168069
tags question: http://stackoverflow.com/q/26120183
tags question: http://stackoverflow.com/q/26126413
tags question: http://stackoverflow.com/q/26103018
tag name: jpa
tags question: http://stackoverflow.com/q/26095026
tags question: http://stackoverflow.com/q/26162971
tags question: http://stackoverflow.com/q/26141625
tags question: http://stackoverflow.com/q/26146843
tags question: http://stackoverflow.com/q/26088234
tags question: http://stackoverflow.com/q/26118290
tags question: http://stackoverflow.com/q/26109041
tags question: http://stackoverflow.com/q/26154866
tags question: http://stackoverflow.com/q/26084657
tags question: http://stackoverflow.com/q/26122523
tags question: http://stackoverflow.com/q/26063219
tags question: http://stackoverflow.com/q/26069512
tags question: http://stackoverflow.com/q/26166616
tags question: http://stackoverflow.com/q/26148571
tags question: http://stackoverflow.com/q/26060940
tags question: http://stackoverflow.com/q/26037532
tags question: http://stackoverflow.com/q/26176727

spring
tags question: http://stackoverflow.com/q/26167874
tags question: http://stackoverflow.com/q/26131280
tags question: http://stackoverflow.com/q/26105693
tags question: http://stackoverflow.com/q/26080274
tags question: http://stackoverflow.com/q/26111050
tags question: http://stackoverflow.com/q/26125118
tags question: http://stackoverflow.com/q/26187732
tags question: http://stackoverflow.com/q/26110107
tags question: http://stackoverflow.com/q/26121297
tags question: http://stackoverflow.com/q/26040693
tags question: http://stackoverflow.com/q/26106179
tags question: http://stackoverflow.com/q/26077921
tags question: http://stackoverflow.com/q/26192418
tags question: http://stackoverflow.com/q/26106671
tags question: http://stackoverflow.com/q/26085027
tags question: http://stackoverflow.com/q/26159336
tags question: http://stackoverflow.com/q/26064951
tags question: http://stackoverflow.com/q/26158640
tags question: http://stackoverflow.com/q/26130148
tags question: http://stackoverflow.com/q/26064999
tags question: http://stackoverflow.com/q/26163316
tags question: http://stackoverflow.com/q/26163305
tags question: http://stackoverflow.com/q/26072397
tags question: http://stackoverflow.com/q/26110370
tags question: http://stackoverflow.com/q/26109203
tags question: http://stackoverflow.com/q/26186382
tags question: http://stackoverflow.com/q/26135928
tags question: http://stackoverflow.com/q/26095029
tags question: http://stackoverflow.com/q/26137897
tags question: http://stackoverflow.com/q/26137149
tags question: http://stackoverflow.com/q/26099434
tags question: http://stackoverflow.com/q/26120183
tags question: http://stackoverflow.com/q/26142508
tags question: http://stackoverflow.com/q/26126413
tags question: http://stackoverflow.com/q/26115011
tags question: http://stackoverflow.com/q/26151164
tags question: http://stackoverflow.com/q/26146843
tags question: http://stackoverflow.com/q/26098664
tags question: http://stackoverflow.com/q/26183209
tags question: http://stackoverflow.com/q/26039862
tags question: http://stackoverflow.com/q/26137932
tags question: http://stackoverflow.com/q/26179940
tags question: http://stackoverflow.com/q/26072501
tags question: http://stackoverflow.com/q/26053367
tags question: http://stackoverflow.com/q/26149822
tags question: http://stackoverflow.com/q/26040865
tags question: http://stackoverflow.com/q/26095464
tags question: http://stackoverflow.com/q/26174317
tags question: http://stackoverflow.com/q/26035114
tags question: http://stackoverflow.com/q/26066049
tags question: http://stackoverflow.com/q/26083654
tags question: http://stackoverflow.com/q/26120234
tags question: http://stackoverflow.com/q/26063219
tags question: http://stackoverflow.com/q/26054020
tags question: http://stackoverflow.com/q/26035402
tags question: http://stackoverflow.com/q/26082021
tags question: http://stackoverflow.com/q/26160076
tags question: http://stackoverflow.com/q/26065635
tags question: http://stackoverflow.com/q/26069512
tags question: http://stackoverflow.com/q/26110136
tags question: http://stackoverflow.com/q/26071072
tags question: http://stackoverflow.com/q/26161080
tags question: http://stackoverflow.com/q/26105376
tags question: http://stackoverflow.com/q/26174451
tags question: http://stackoverflow.com/q/26035129
tags question: http://stackoverflow.com/q/26132065
tags question: http://stackoverflow.com/q/26139407
tags question: http://stackoverflow.com/q/26053908
tags question: http://stackoverflow.com/q/26103642
tags question: http://stackoverflow.com/q/26140993
tags question: http://stackoverflow.com/q/26124694
type: Tag
tags question: http://stackoverflow.com/q/26125024
tags question: http://stackoverflow.com/q/26085885
tags question: http://stackoverflow.com/q/26055876
tags question: http://stackoverflow.com/q/26134879
tags question: http://stackoverflow.com/q/26123040
tags question: http://stackoverflow.com/q/26112783
tags question: http://stackoverflow.com/q/26047903
tags question: http://stackoverflow.com/q/26165126

http://stackoverflow.com/q/26077921
has answer: http://stackoverflow.com/a/44615354
type: Question
has answer: http://stackoverflow.com/a/28395247
accepted answer: http://stackoverflow.com/a/28395247
possible better answer: http://stackoverflow.com/a/44615354
tagged with: transactions
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41136993
has title: Rolling back transactions in cucumber-jvm tests
upvote count: 2
answer count: 2
favorite count: 0
tagged with: cucumber-jvm
has body: I am currently developing a REST web service using Spring, using Hibernate as the ORM and using cucumber to write acceptance tests. To be able to rollback transactions between scenarios, I have the following code which creates a transaction before each scenario and rollback after it. package com.orange.cainet.cucumber; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.DefaultTransactionDefinition; import cucumber.api.java.After; import cucumber.api.java.Before; @WebAppConfiguration @ContextConfiguration("classpath:applicationContext.xml") public class RollbackTransactionsBetweenScenarios { @Autowired PlatformTransactionManager transactionManager; TransactionStatus transaction; @Before public void beforeScenario(){ transaction = transactionManager.getTransaction(new DefaultTransactionDefinition()); } @After public void afterScenario(){ transactionManager.rollback(transaction); } } In the step definitions class, I use an autowired CrudRepository of my entity to create what is in the Given statements and assert what is in the then statements. I use MockMvc to mock the application context and use (post, get, ...) to send fake requests and keep the ResultActions as a field to use it in assertion. Until recently this was working good for me, the problem started when using the @Column(unique=true) to prevent duplication of one of the fields in the entity, and using DataIntegrityViolationException to know when if the entity I am about to save has a duplicated field try{ newUser = userRespoitory.save(newUser); } catch(DataIntegrityViolationException exception){ throw new UserNameAlreadyExistsException(); } the problem is that after the DataIntegrityViolationException i…
tagged with: spring
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/26143305
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26142907
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26142907
has body: {'code': '827h46fh38fjg623hd6che6fhw63hf6239k589'} is a python construct, it is not sent "as is" but used by the post method (unwrapped and form-encoded). instead of : nameValuePairs.add(new BasicNameValuePair("data", "{'code': '827h46fh38fjg623hd6che6fhw63hf6239k589'}")); you should do something like : nameValuePairs.add(new BasicNameValuePair("code", "827h46fh38fjg623hd6che6fhw63hf6239k589"));
type: Answer

http://stackoverflow.com/a/28142389
has body: First load these two jar files (JDBC driver): 1) tdgssconfig 2) terajdbc4 And then use below code to connect to the teradata server : Class.forName("com.teradata.jdbc.TeraDriver"); Connection con=DriverManager.getConnection(url,username,password);
type: Answer
answers question: http://stackoverflow.com/q/26118012
score: 0

http://stackoverflow.com/comment/40831986
score: 0
has text: @BorisPavlović How to create an in memory database?
type: Comment
comment on: http://stackoverflow.com/q/26062117
type: QuestionComment

http://stackoverflow.com/comment/41062060
type: Comment
comment on: http://stackoverflow.com/a/26169243
type: AnswerComment
score: 0
has text: I'm not using web.xml just to move towards the newer way of defining the webapp configuration. If there is no way to be able to achieve force redirect via configuration, I would rather add that snippet on web.xml. However is it possible to have web.xml conflict with the annotation configuration? Can you give me an example of how to have them both ?

http://stackoverflow.com/q/26045230
has comment: http://stackoverflow.com/comment/40800626
has comment: http://stackoverflow.com/comment/40801812
has title: "<identifier> expected" when creating class from template
has comment: http://stackoverflow.com/comment/40800572
score: 0
has comment: http://stackoverflow.com/comment/40801141
has comment: http://stackoverflow.com/comment/40800651
has comment: http://stackoverflow.com/comment/40800978
has comment: http://stackoverflow.com/comment/40800815
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have a bot I am creating that can take input from an IRC channel to create new classes for the bot to use when running. However, when it tries to compile the class, it results in an "identifier expected" error at the class name. However, if I type up a class which is identical to that created by the bot using the template, it compiles without issue. Below are the 3 methods used for this process: //Create basic command public static int writeBasicCommand(String trigger, String output, boolean edit) { int success = 0, existenceError = 1, unknownError = 2; try { String filePath = "C:/commands/" + trigger + ".java"; //Location for new class File file = new File(filePath); //Check if command exists if (file.exists()) { if(!edit) { return existenceError; } } else if(edit) { return existenceError; } //Grab and modify template String template = readFile("C:/template.txt"); String namedCom = template.replace("--COMMANDNAME--", trigger); String content = namedCom.replace("--COMMANDRESULT--", "\"" + output + "\""); //Write command WriteFile(content, file, false); if (Compile(filePath)==true) { System.out.println("Done"); return success; } else { return unknownError; } } catch (IOException e) { e.printStackTrace(); return unknownError; } } //Compile new commands public static boolean Compile(String fileToCompile) { System.setProperty("java.home", "C:\\Program Files\\Java\\jdk1.7.0_11"); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); int compilationResult = compiler.run(null, null, null, fileToCompile); if(compilationResult == 0) { System.out.println("Compilation is successful"); return true; } else { System.out.println("Compilation Failed"); if ((new File(fileToCompile).exists())) { new File(fileToCompile).delete(); } return false; } } //Write to a file public static boolean WriteFile(String fileContents, File destination, boolean append) { try { // if file doesnt exist, then create it if (!destination.exists()) { destination.createNewFile(); } FileWriter fw = …
type: Question

http://stackoverflow.com/comment/40796009
has text: I don't know the details of formal grammar theory, but if by "glob" you mean shell patterns where `*` matches any sequence of characters, `?` matches a single character, and `[...]` matches a character in a set, and those are the only wildcards available, then I don't think a regex can generally be converted to a glob. What glob would match the same sequences as the regex `(this|that)file`?
comment on: http://stackoverflow.com/q/26042753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/57577789
type: AcceptedAnswer
upvote count: 37
type: Answer
has comment: http://stackoverflow.com/comment/139040521
has body: The answers here are not complete! First off, let's check the documentation! void deleteInBatch(Iterable<T> entities) Deletes the given entities in a batch which means it will create a single Query. So the "delete[All]InBatch" methods will use a JPA Batch delete, like "DELETE FROM table [WHERE ...]". That may be WAY more efficient, but it has some caveats: This will not call any JPA/Hibernate lifecycle hooks you might have (@PreDelete) It will NOT CASCADE to other entities You have to clear your persistence context or just assume it is invalidated. That's because JPA will issue a bulk DELETE statement to the database, bypassing the cache etc. and thus can't know which entities were affected. See Hibernate Docs The actual code in Spring Data JPA And while I can't find a specific article here, I'd recommend everything Vlad Mihalcea has written, to gain a deeper understanding of JPA. TLDR: The "inBatch" methods use bulk DELETE statements, which can be drastically faster, but have some caveats bc. they bypass the JPA cache. You should really know how they work and when to use them to benefit.
downvote count: 0
has comment: http://stackoverflow.com/comment/139038815
answers question: http://stackoverflow.com/q/26142261
accepted answer of: http://stackoverflow.com/q/26142261
score: 37

http://stackoverflow.com/a/26128911
has comment: http://stackoverflow.com/comment/40953975
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40955293
has comment: http://stackoverflow.com/comment/40995715
has comment: http://stackoverflow.com/comment/40953825
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40953668
score: 1
has comment: http://stackoverflow.com/comment/40953586
has body: if you have the Uri to the image, you resolve it with content resolver: InputStream is = context.getContentResolver().openInputStream(uri); Don't forget to close the stream. (and check for null). context sometime is your activity or "this".
accepted answer of: http://stackoverflow.com/q/26127257
has comment: http://stackoverflow.com/comment/40953757
has comment: http://stackoverflow.com/comment/40953505
answers question: http://stackoverflow.com/q/26127257

http://stackoverflow.com/q/26089642
has answer: http://stackoverflow.com/a/26099471
tagged with: java
has comment: http://stackoverflow.com/comment/40882096
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40899847
has body: I have unexpectedly received a nullpoint exception error that I have been trying to resolve but have been unsuccesful. I have included the logcat below. 09-28 20:12:29.543: E/AndroidRuntime(3588): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 09-28 20:26:37.291: E/AndroidRuntime(3778): FATAL EXCEPTION: main 09-28 20:26:37.291: E/AndroidRuntime(3778): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dooba.beta/com.dooba.beta.MoodActivity}: java.lang.NullPointerException 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.app.ActivityThread.access$600(ActivityThread.java:141) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.os.Handler.dispatchMessage(Handler.java:99) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.os.Looper.loop(Looper.java:137) 09-28 20:26:37.291: E/AndroidRuntime(3778): at android.app.ActivityThread.main(ActivityThread.java:5103) 09-28 20:26:37.291: E/AndroidRuntime(3778): at java.lang.reflect.Method.invokeNative(Native Method) 09-28 20:26:37.291: E/AndroidRuntime(3778): at java.lang.reflect.Method.invoke(Method.java:525) 09-28 20:26:37.291: E/AndroidRuntime(3778): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 09-28 20:26:37.291: E/AndroidRuntime(3778): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 09-28 20:26:37.291: E/AndroidRuntime(3778): at dalvik.system.NativeStart.main(Native Method) 09-28 20:26:37.291: E/AndroidRuntime(3778): Caused by: java.lang.NullPointerException 09-28 20:26:37.291: E/AndroidRuntime(3778): at com.dooba.beta.MoodActivity.onCreate(MoodActivity.java:…
score: 0
has comment: http://stackoverflow.com/comment/40882137
has title: Nullpointexception - setImageBitmap
answer count: 1
tagged with: android-activity
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26141816
has comment: http://stackoverflow.com/comment/40985618
has comment: http://stackoverflow.com/comment/40977164
tagged with: spring
has body: I have Springform linked to the object (x = modelAttribute). All the fields keep its values after doing POST action. But the (Multi-Select) list (items) , doesn't keep its values. X Class : class x { String a; String b; List&lt;Y&gt; items; } JSP : &lt;form:form method="post" path="x" modelAttribute="role"&gt; &lt;form:input path="a" type="text" /&gt; &lt;form:input path="b" type="text" /&gt; &lt;form:options items="${mylist}" path="items" itemValue="id" itemLabel="name" /&gt; &lt;/form:form&gt; Controller : @RequestMapping(value = "/case/new", method = RequestMethod.GET) public String newRole(ModelMap model) { if(!model.containsAttribute("x")){ model.addAttribute("x", new X()); } return "/roles/newRole"; } @RequestMapping(value = "/case/new", method = RequestMethod.POST) public String doNewCase(@ModelAttribute("x") @Validated X x ,BindingResult bindingResult,ModelMap model) { if (bindingResult.hasErrors()) { if(!model.containsAttribute("x")){ model.addAttribute("x", new X()); } return "cases/newCase"; } caseService.addNewCase(x); return "cases/list"; } Any suggestion about how to keep values of items Multi-Select after posting ?
has title: Select after post values not kept
tagged with: model-view-controller
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40979628
has comment: http://stackoverflow.com/comment/40978194
type: Question
has comment: http://stackoverflow.com/comment/40978068
tagged with: jsp
score: 0
tagged with: spring-form
has comment: http://stackoverflow.com/comment/40976734
has comment: http://stackoverflow.com/comment/40977117
type: UnansweredQuestion

http://stackoverflow.com/comment/40792381
score: 0
type: Comment
type: QuestionComment
has text: More probably, maven did not put a `MANIFEST.MF` in the `META-INF` directory of the jar. Sadly enough, but the default plugins generate a *library* jar, not an *executable* one - and I'm not good enough at maven to give you a solution :-(
comment on: http://stackoverflow.com/q/26040366

http://stackoverflow.com/q/26158465
score: 0
possible better answer: http://stackoverflow.com/a/26207984
has body: I have a cache like class, something like this: class Cache { Map&lt;String, Object&gt; objects; Map&lt;String, List&lt;Object&gt;&gt; lists; //... List&lt;Object&gt; getFromLists(String key) { //... } Object getFromObjects(String key) { //... } void addObject(String key, Object value) { //... } //... } Now I am trying to write UTs to ensure the expected quality of the "cache" and I was wondering how to write them to ensure the structure works also when I have concurrent access. What I've tried so far, was to start multiple threads, some writing others reading and checking the content of the queue. I would appreciate other suggestions, maybe some tools?!
accepted answer: http://stackoverflow.com/a/26530560
has title: Write UT for concurrent access of collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41007412
tagged with: java
tagged with: unit-testing
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26530560
tagged with: junit4
has comment: http://stackoverflow.com/comment/41009293
has answer: http://stackoverflow.com/a/26207984

http://stackoverflow.com/q/26183269
has answer: http://stackoverflow.com/a/26183462
tagged with: regex
answer count: 4
has title: Splitting by java regular expression
has answer: http://stackoverflow.com/a/26183320
downvote count: 0
has comment: http://stackoverflow.com/comment/41054207
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41054376
type: Question
has answer: http://stackoverflow.com/a/26183425
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26211534
has body: I have a string like: Snt:It was the most widespread day of environmental action in the planet's history ==================== ----------- Snt:Five years ago, I was working for just over minimum wage ==================== ----------- and I want to split the string with ==================== ----------- and ofcourse remove Snt: from the first of sentences. what is the best way? I used this regular expression, but it didnt work! String[] content1 =content.split("\\n\\====================\\n\\-----------\\n"); Thanks in advance.

http://stackoverflow.com/comment/41073416
score: 0
type: AnswerComment
type: Comment
has text: Sorry, I didn't include the code from the for-loop, but there is no modification done at all. The product-objects iterated over are just used in read-mode to get some information. There is nothing taken from the list or added. Also nothing changed inside the product objects. Additionally the stacktrace points to the for(Product p: products) statement which I never saw before..
comment on: http://stackoverflow.com/a/26193848

http://stackoverflow.com/comment/40848776
comment on: http://stackoverflow.com/q/26071356
has text: @BoratSagdiyev because i want to create database tables at runtime. for that purpose i am testing the code. i delebrately put a table named test2 to check if it exists in database or not from my java code.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26084822
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/15253173
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
tagged with: bytecode-manipulation
answer count: 4
linked to: http://stackoverflow.com/q/100107
tagged with: java
has body: According this topic: Reasons of getting a java.lang.VerifyError java.lang.VerifyError obtains if version of execution jvm newer than jvm that was used for compilation. Always we can fix this problem using following jvm option: -XX:-UseSplitVerifier. According this: https://stackoverflow.com/a/16467026/2674303 to use this option is 'perfectly safe'. Thus I don't understand why does java.lang.VerifyError is problem that prevents succesful compilation. Please clarify. Maybe it is not safe for libraries which instrument bytecode?
upvote count: 1
has answer: http://stackoverflow.com/a/26085004
type: Question
has answer: http://stackoverflow.com/a/26085420
tagged with: compatibility
tagged with: bytecode
has comment: http://stackoverflow.com/comment/40873704
has answer: http://stackoverflow.com/a/26093483
has answer: http://stackoverflow.com/a/26085365
has comment: http://stackoverflow.com/comment/40873409
has title: Why does java.lang.VerifyError prevent successful compilation?

http://stackoverflow.com/q/26152831
has comment: http://stackoverflow.com/comment/40997468
favorite count: 0
has comment: http://stackoverflow.com/comment/40997592
type: Question
has comment: http://stackoverflow.com/comment/40997521
has comment: http://stackoverflow.com/comment/40997472
has comment: http://stackoverflow.com/comment/40997628
has comment: http://stackoverflow.com/comment/40997442
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/40997425
has answer: http://stackoverflow.com/a/26152894
has answer: http://stackoverflow.com/a/26152932
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40997567
has comment: http://stackoverflow.com/comment/40997509
possible better answer: http://stackoverflow.com/a/26152894
linked to: http://stackoverflow.com/q/28052519
has comment: http://stackoverflow.com/comment/40997639
type: AnsweredQuestion
has body: I'm trying to write a program where it will tell you: The number of integers in a list entered by the user at the command prompt The sum of those integers. But I'm having some trouble figuring out how to access those individual numbers. I've tried writing the while loop already, as well as the "if" statements. Another issue I'm having is that when I try to run my program, I get this error message: Exception in thread "main" java.lang.IllegalStateException: Scanner closed. NOTE: I'm very new to Java so a simpler solution that mainly uses scanners, next methods, and hasNext methods would be better! import java.util.Scanner; public class InputParser { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("How many values do you want to parse?: "); int numValues = scanner.nextInt(); System.out.println("Please enter " + numValues + " values: "); while(scanner.hasNextLine()) { if(scanner.hasNext()) { if(scanner.hasNextInt()) { int sum; System.out.println("The sum of your values is: " + sum + "."); } } scanner.close(); } } }
accepted answer: http://stackoverflow.com/a/26152932
duplicate of: http://stackoverflow.com/q/28052519
has comment: http://stackoverflow.com/comment/40997470
has title: How do I add numbers from a list of user inputs?
has comment: http://stackoverflow.com/comment/40997606

http://stackoverflow.com/comment/40922247
score: 1
comment on: http://stackoverflow.com/q/26111826
type: Comment
type: QuestionComment
has text: You can't change the state of a "live" UI component from a background thread. In Java 8 this should give you an exception. Use `Platform.runLater()`, or use the `javafx.concurrent` API.

http://stackoverflow.com/comment/41036412
score: 0
has text: Sure, working with an image pixelwise is always damn slow. Grab the image data and enjoy the speed up. Or try [ImageOp](http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImageOp.html).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26172607

http://stackoverflow.com/q/26142205
tagged with: java
tagged with: qr-code
type: Question
score: 0
answer count: 1
has title: ClassNotFoundException using zxing4processing, Processing Library
accepted answer: http://stackoverflow.com/a/26142635
tagged with: classnotfoundexception
has body: I am attempting to run the example sketch (generateQRCode) provided by the zxing4processing – Processing Library. import com.aos.zxing4processing.*; ZXING4P zxing; zxing = new ZXING4P(this); The following error occurrs at: zxing = new ZXING4P(this); results in ClassNotFoundException: com.google.zxing.ReaderException in Processing 2.2.1 I have imported the library correctly, and the only class is ZXING4P.class, located in libraries\com\aos\zxing4processing. I have also tried older versions of Processing. Any further suggstions?
tagged with: processing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26142635

http://stackoverflow.com/comment/40797873
score: 1
has text: `Platform.runLater(...)` schedules something to run on the FX Application Thread, which is exactly the opposite of what you want.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26043835

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26058686
tags question: http://stackoverflow.com/q/26045065
tags question: http://stackoverflow.com/q/26152162
tag name: deserialization
tags question: http://stackoverflow.com/q/26185097
tags question: http://stackoverflow.com/q/26185719
tags question: http://stackoverflow.com/q/26128033

http://stackoverflow.com/a/27443349
answers question: http://stackoverflow.com/q/26101842
downvote count: 0
score: 4
has body: I have got the answer. Actually while we are creating the App page on Linked in ,there will be a option to give the redirect Url. There we have to provide. After that if the cancel button is press it will redirect to that url and close the dialog
type: Answer
upvote count: 4

http://stackoverflow.com/q/26060812
has answer: http://stackoverflow.com/a/26060870
has comment: http://stackoverflow.com/comment/40828756
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26060968
has body: I'd like to have two classes: Layout1 and Layout2. Both will extend a specific class, Layout1 will extend LayoutGroup1 and Layout2 will extend LayoutGroup2. However, they will both have some common code in the form of a function named doSpecialLayout(). Ideally, I'd be able to have each class extend their appropriate class, and also put the shared doSpecialLayout() code in a common place that both can access. This will make it cleaner on my end, as well as improve my ability to bug fix stuff later on since I won't be editing two classes each time! Is something like this possible? I know I cannot extend multiple classes in Java, so what's the pattern I am looking for here? Thank you very much! FYI This is for Java on Android systems, so only Java 6 (7?) is supported.
has comment: http://stackoverflow.com/comment/40828742
has answer: http://stackoverflow.com/a/26060852
tagged with: java
has title: Extend from a specific class while implementing shared methods
has comment: http://stackoverflow.com/comment/40828715
type: Question
has comment: http://stackoverflow.com/comment/40828748
has comment: http://stackoverflow.com/comment/40828939
has answer: http://stackoverflow.com/a/26061015
answer count: 8
has answer: http://stackoverflow.com/a/26060905
score: 0
has answer: http://stackoverflow.com/a/26060938
has answer: http://stackoverflow.com/a/26060903
has answer: http://stackoverflow.com/a/26060952

http://stackoverflow.com/comment/41065269
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26189137
score: 0
has text: If the static object can/should be changed, then the first way is fine. I prefer it becuase of clarity, but that's due to my preference, not any technical advantage. But if you want it to remain unmodifiable, then you should make it `static final int[][] table = setTable(int, int)`, and use the second approach.

http://stackoverflow.com/a/59358788
has body: In my case the plugin registry loaded ImagePreloaders from both the plugin files and mixed them together. Yet the error still appeared. I was inserting an SVG file into a PDF file. The root cause was incorrect version of org.apache.xmlgraphics:batik-svg-dom. The 1.7 version was required by the org.apache.xmlgraphics:fop:1.1, however, the 1.8 version was on the classpath. There is a key difference between the two versions: the org.apache.fop.image.loader.batik.PreloaderSVG class needs org.apache.batik.dom.svg.SAXSVGDocumentFactory from the version 1.7 on the classpath. If it gets org.apache.batik.anim.dom.SAXSVGDocumentFactory from the 1.8 version it does not work as expected. This SO question: Where has org.apache.batik.dom.svg.SVGDOMImplementation gone? was helpful to me when resolving this issue.
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/132908234
downvote count: 0
answers question: http://stackoverflow.com/q/26139301

slf4j
tags question: http://stackoverflow.com/q/26177344
tags question: http://stackoverflow.com/q/26042322
tag name: slf4j
tags question: http://stackoverflow.com/q/26041712
tags question: http://stackoverflow.com/q/26075283
type: Tag

http://stackoverflow.com/a/26117651
has comment: http://stackoverflow.com/comment/40932212
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26117104
has body: would like do decrypt contents of b with public key of a: No you wouldn't. Certificates aren't encrypted. What you're really trying to do here is verify a certificate, which is done via its public key, obtained either from the certificate itself or from a second source of the same public key. Verifying it with the public key of a different certificate doesn't begin to make sense. In any caseX509Certificate already contains a sufficient verify() method.
answers question: http://stackoverflow.com/q/26117104
has comment: http://stackoverflow.com/comment/40933378
type: Answer
has comment: http://stackoverflow.com/comment/40932777
upvote count: 1
has comment: http://stackoverflow.com/comment/40933262
score: 1
downvote count: 0

http://stackoverflow.com/q/26075240
downvote count: 1
has comment: http://stackoverflow.com/comment/40855732
type: Question
score: -1
has title: no arg method compiler error not generated
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40855197
type: UnansweredQuestion
tagged with: overloading
tagged with: oop
has answer: http://stackoverflow.com/a/26075272
has comment: http://stackoverflow.com/comment/40855217
has body: Here is my code: public class XYZ { public static void overLoaded(Object a) { System.out.println("IN OBJECT"); } public static void main(String[] args) { overLoaded(); } } I expected compile time error as there is no arg method but instead the output is coming out to be IN OBJECT. Please explain the output.
tagged with: java

http://stackoverflow.com/comment/40997205
has text: Thank you very much, your code is really great. However, there is a problem which is the code does not read the first element in all lines except the first line. I'll grateful for any idea. Thanks
comment on: http://stackoverflow.com/a/26141156
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26164830
type: Answer
has body: I rementer that in bad old days (without Ivy/Maven/Gradle) we were handling dependencies of Eclipse projects via UserLibraries feature. If you go to Window -> Prefenrences -> Java -> Build Path -> User Libraries, you can create/import/export XML containing your dependencies. (Can't remember if this handles relative paths). This file can be stored in source control. You can than right click on project -> Properties -> Java Build Path -> Libraries -> Add Library... -> User Library and pick your create user library XML So whenever developer see strange compiler issues after pulling out source code, he needs to import new user libraries XML.
score: 0
answers question: http://stackoverflow.com/q/26160499

http://stackoverflow.com/comment/41070213
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26192137
has text: I need to add one string somewhere in ArrayList.

http://stackoverflow.com/comment/40983176
type: Comment
has text: I was thinking adding 'param' there would pass the inputted integer from my main throughout the methods, I guess I was totally wrong.
comment on: http://stackoverflow.com/q/26145057
score: 0
type: QuestionComment

http://stackoverflow.com/q/26070920
tagged with: java
tagged with: setter
has comment: http://stackoverflow.com/comment/40866840
has comment: http://stackoverflow.com/comment/40848008
type: Question
has title: Should a mutator return a bool or is it an unnecessary sanity check?
has comment: http://stackoverflow.com/comment/70428290
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40858271
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40865919
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40866092
has comment: http://stackoverflow.com/comment/40847927
has body: In other words when you write a mutator for a class such as the example I have given below should it return a bool so the main program can confirm that the instance variable was updated or is this an unnecessary sanity check? Is there any standard that suggests this is what you should do or does such said standard suggest that you should use a void mutator so nothing is returned to the main program? Or is this "issue" just dependent on the programmer? For example, should I use a mutator like this? public boolean changeString (String newValue) { if (newValue != NULL) { someString = newValue; return true; } else { return false; } } Or should I use a mutator like this? public void changeString (String newValue) { if (newValue != NULL) { someString = newValue; } }
tagged with: coding-style
tagged with: oop

http://stackoverflow.com/q/26174521
has title: Java Calendar generates invalid month and date
score: 0
has answer: http://stackoverflow.com/a/26174669
accepted answer: http://stackoverflow.com/a/26174541
possible better answer: http://stackoverflow.com/a/26174634
has answer: http://stackoverflow.com/a/26174634
answer count: 5
has answer: http://stackoverflow.com/a/79422557
type: AnsweredQuestion
tagged with: java
has body: Plase have a look at the below code Calendar date = Calendar.getInstance(); initialClientLetterDate.setText(date.get(Calendar.YEAR)+"/"+date.get(Calendar.MONTH)+"/"+date.get(Calendar.DAY_OF_WEEK)); This generates the invalid "month" and "date". The output is 2014/09/06. Why is this? I just wanted to get current year, date and month.
has answer: http://stackoverflow.com/a/26174541
tagged with: calendar
type: Question
has answer: http://stackoverflow.com/a/26174623

http://stackoverflow.com/a/26164194
has comment: http://stackoverflow.com/comment/41018773
answers question: http://stackoverflow.com/q/26163990
score: -2
has comment: http://stackoverflow.com/comment/41018746
downvote count: 2
type: Answer
upvote count: 0
has body: You should use Asynctask for any work with server, see http://developer.android.com/reference/android/os/AsyncTask.html
has comment: http://stackoverflow.com/comment/41018536

http://stackoverflow.com/comment/41063074
type: Comment
has text: Thanks. ill try this tonight and post back to you when ive code it :)
comment on: http://stackoverflow.com/a/26171861
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40967041
type: Comment
comment on: http://stackoverflow.com/a/26136557
score: 0
type: AnswerComment
has text: how reflection ?? as I know it works with class But here JSP page accessing the private field of action class.

http://stackoverflow.com/comment/69002032
score: 0
type: AnswerComment
has text: @Lakedaemon: "Can AppA send..." -- `FLAG_GRANT_READ_URI_PERMISSION` is put on an `Intent`, not a `Uri`.
comment on: http://stackoverflow.com/a/26065710
type: Comment

http://stackoverflow.com/a/26113458
has comment: http://stackoverflow.com/comment/40924928
answers question: http://stackoverflow.com/q/26113429
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26113429
type: Answer
has body: You can use this Signature[] sighashes = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures; The signatures can be compared with your debug keys or release keys(that you used when uploading to Play Store) to check whether its from apk or play store. However if someone has access to your release key signed apk then I dont know if its possible to distinguish.
score: 1
upvote count: 1

http://stackoverflow.com/q/26152084
linked to: http://stackoverflow.com/q/10659610
type: AnsweredQuestion
tagged with: classloader
has title: Excessive jstat "Class Loader Time"
upvote count: 1
type: Question
has body: Our Java-based server application is reporting an unusually high class loader time: # jstat -class 10625 1000 Loaded Bytes Unloaded Bytes Time 4781 9165.6 114 185.2 17769.35 4781 9165.6 114 185.2 17769.85 4781 9165.6 114 185.2 17770.36 4781 9165.6 114 185.2 17771.11 4781 9165.6 114 185.2 17771.73 This is on a server that had been running ~8 hours. jstat reports it has spent 17,769s (~4h56m!) doing class loading, and about 0.5-0.6 extra seconds every second! We've been tracking a performance issue and this is our best candidate for a culprit. Just to be sure, we checked our other Java services: jstat showed a very low value in the Time column (a few seconds, even after having run for hours) Our code doesn't do constant class loading, but we can't rule out a misbehaving 3rd party library. We enabled -verbose:gc hoping to diagnose the problem. But once our server loads all of its classes (within a minute or so of heavy traffic) the verbose class log became quiet -- we were half-expecting to see a flurry of activity given the jstat data. My questions would be: Is this really indicative of a problem? If so, what else could be done to diagnose it? Would really appreciate any suggestions.
has answer: http://stackoverflow.com/a/26161882
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/23561555
answer count: 1
downvote count: 0
tagged with: jstat
tagged with: jvm
accepted answer: http://stackoverflow.com/a/26161882
favorite count: 0

http://stackoverflow.com/q/26054216
type: Question
possible better answer: http://stackoverflow.com/a/26060689
tagged with: jstl
has answer: http://stackoverflow.com/a/26054644
accepted answer: http://stackoverflow.com/a/26054644
has body: I am displaying a list which contains objects which store message information. The list is loaded through getting the request as such: ArrayList&lt;MessageModel&gt; list = (ArrayList&lt;MessageModel&gt;) request.getAttribute("msgList"); I am trying to display information contained in each object as such: for(MessageModel msg : list){ String messageTo = msg.toAddress; String messageSub = msg.messageSubject; out.println(messageTo+ " " +messageSub); } I am getting a NullPointerException at the for each statement. As an aside, I am using this approach to debug as I want to check whether or not I can display the content of the MessageModel object at all. I tried using JSTL forEach tag but I could not access the object attributes. &lt;c:forEach items="${list}" var="current"&gt; &lt;li&gt;&lt;c:out value="${current.toAddress}"/&gt;&lt;/li&gt; &lt;/c:forEach&gt; I set the attribute like this : ArrayList&lt;MessageModel&gt; list =(ArrayList&lt;MessageModel&gt;) request.getAttribute("msgList"); pageContext.setAttribute("messages", list); This results in the following error message when run : org.apache.jasper.JasperException: /inbox.jsp (line: 37, column: 12) According to TLD or attribute directive in tag file, attribute items does not accept any expressions And intelliJ says that it cannot resolve the variable list. EDIT : I forward the request from a servlet that handles user login as follows : ArrayList&lt;MessageModel&gt; msglist = MessageModel.getRecievedMessages(username); request.setAttribute("msgList", msglist); I am trying to pass the ArrayList that contains the message objects and then iterate over the list and display it in the jsp. Is there a possibility for the jsp itself to get the information ? I have a separate java class which handles the messages with a bunch of helper functions. So can I call the method that retrieves all those messages and display them without explicitly setting a request attribute in the servlet ? Because I will be navigating between othe…
answer count: 2
upvote count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/26060689
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40817771
has title: NullPointerException when iterating over ArrayList in jsp

http://stackoverflow.com/comment/40887553
comment on: http://stackoverflow.com/a/26060478
score: 0
type: Comment
has text: Hi ....... I have tried by doing this mv=new ModelAndView("registration","user",new User()); But Still it is showing same error.
type: AnswerComment

language-lawyer
tags question: http://stackoverflow.com/q/26193797
tag name: language-lawyer
type: Tag
tags question: http://stackoverflow.com/q/26116141

http://stackoverflow.com/q/26162178
has comment: http://stackoverflow.com/comment/41014795
favorite count: 0
has comment: http://stackoverflow.com/comment/41017420
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/32342821
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41015216
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/41017147
has body: When researching the problem, it seems most people are wanting to do the opposite (i.e remove the minimize/close button). I've had no success using the reoccurrent setUndecorated and setDefaultCloseOperation Here is my code: private class TestDialog extends JDialog { public static final String title_ = "Test Dialog"; public TestDialog(JFrame parent) { super(parent,title_,true); setMinimumSize(new Dimension(500,500)); setLocationRelativeTo(null); setUndecorated(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } } When I display the dialog I get the following: Other info: OS: Ubuntu Java version: 1.7.0_55
downvote count: 0
has answer: http://stackoverflow.com/a/26166675
tagged with: jdialog
has title: JDialog not showing minimize/close button
tagged with: user-interface

http://stackoverflow.com/comment/41025066
comment on: http://stackoverflow.com/q/26167357
type: Comment
type: QuestionComment
has text: You might check this [thread](http://sourceforge.net/p/drjava/bugs/944/) There is an issue with Dr. Java and certain version of eclipse. Ensure you have JDK installed and not just JRE.
score: 0

http://stackoverflow.com/a/26166686
has comment: http://stackoverflow.com/comment/41038664
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26166542
has body: What you have here is called a Single Selection If Statement which will only execute the next line of code, if the conditional evaluates to TRUE. Like: if (someConditional) // do this if true // this, here, will always execute Your issues is you have a dangling else if, which is not attached to anything as far as the compiler is concerned. What you are after is an If Statement Block, which looks like: if (something) { // do stuff } else if (somethingElse) { // do stuff } else if (somethingEvenElse) { // do stuff } else { // do stuff } The block will execute any number of statements within the { }.
downvote count: 0

http://stackoverflow.com/q/26147858
downvote count: 0
answer count: 1
has body: I'm trying to generate documentation of an android project using javadoc from commandline to use a custom doclet and generate a PDF file. I'm using AurigaDoclet. Here is the command, but it doen't find any source file: javadoc -doclet com.aurigalogic.doclet.core.Doclet -docletpath "C:\Program Files\Java\aurigadoclet\bin\AurigaDoclet.jar" -format pdf -sourcepath "E:\Projects\MobileApp\src*.java" -package it org -out "E:\DemoDoc.pdf" it and org are packages of the mobile app, but javadoc says that packages it and org do not contain any source files. Should I specify the full path to each file of the project?? like this "it.company.x.y.java"
accepted answer: http://stackoverflow.com/a/29379785
tagged with: documentation
favorite count: 0
type: Question
score: 1
tagged with: command-line
upvote count: 1
has title: Javadoc and custom doclet
has answer: http://stackoverflow.com/a/29379785
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: AnsweredQuestion

http://stackoverflow.com/comment/40983141
has text: I'll take your word for that -- I am not aware of an Android-friendly packaging of HttpClient that moves it into a separate package, to not conflict with the built-in HttpClient implementation. I am not aware of SPDY support with HttpClient (other than the OkHttp compatibility layer that I mentioned), though I haven't gone looking for SPDY for HttpClient either.
score: 0
comment on: http://stackoverflow.com/q/26143842
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26130797
has answer: http://stackoverflow.com/a/26131510
accepted answer: http://stackoverflow.com/a/26131510
score: 0
tagged with: groovy
answer count: 1
has comment: http://stackoverflow.com/comment/40957111
type: AnsweredQuestion
tagged with: java
type: Question
has title: Grails UnitTest Ensure BigDecimal not a string
tagged with: grails
has body: System: Java 1.7 Grails 2.2 In my Domain Object: class Timer{ BigDecimal hours static constraints = { hours min: 0.5, validator: { h -&gt; // The hours has to be a number in whole or half hour increments. System.out.println "h:" + h.toString() // Twice the number : def h2 = 2 * h // Extract h2 fractional portion: String numberStr = Double.toString(h2); String fractionalStr = numberStr.substring(numberStr.indexOf('.') + 1); int fractional = Integer.valueOf(fractionalStr); System.out.println "fraction:" + fractional // if the fraction is 0 then "h" is a multiple of 0.5 // ie: h = 1.5 =&gt; h2 = 3.0, fractional = 0 return TRUE // ie: h = 1.1 =&gt; h2 = 2.2, fractional = 2 return FALSE (fractional == 0) } } } In the Unit Test @Build(Timer) class TimerTests { @Before void setUp() { // Ensure we can invoke validate() on our domain object. mockForConstraintsTests(Timer) } /** * Ensure setup creates a valid instance */ void testValid() { Timer t = Timer.build() assertTrue t.validate() } /** * hours must be a number */ void testHours(){ Timer m = Timer.build() assertTrue m.validate() t.hours = 1; assertTrue m.validate() t.hours = 1.5; assertTrue m.validate() t.hours = 1.3; assertFalse m.validate() assertEquals 'validator', t.errors['hours'] // Test Min constraint t.hours = 0; assertFalse t.validate() assertEquals 'min', t.errors['hours'] // // Test non numbers t = new Timer() t.hours = "ss" assertFalse t.validate() } } I get the error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'ss' with class 'java.lang.String' to class 'java.math.BigDecimal' I want to ensure that a string cannot be entered, and the hours field is in whole or half hour increments. Any suggestions are welcome. Thanks

http://stackoverflow.com/a/26111035
upvote count: 2
has comment: http://stackoverflow.com/comment/40921634
has comment: http://stackoverflow.com/comment/40920846
accepted answer of: http://stackoverflow.com/q/26111014
has body: Your code is not thread-safe, because a different thread might call put() between your two calls on the first thread. Instead, you should call putIfAbsent().
has comment: http://stackoverflow.com/comment/40920798
answers question: http://stackoverflow.com/q/26111014
has comment: http://stackoverflow.com/comment/40920813
has comment: http://stackoverflow.com/comment/40948745
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40946450
has comment: http://stackoverflow.com/comment/40946672
has comment: http://stackoverflow.com/comment/40946388
type: Answer
has comment: http://stackoverflow.com/comment/40922567
has comment: http://stackoverflow.com/comment/40920826
has comment: http://stackoverflow.com/comment/40920771
score: 2
has comment: http://stackoverflow.com/comment/40921006

http://stackoverflow.com/comment/40933900
comment on: http://stackoverflow.com/q/26117089
has text: And Cobertura version
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40866179
type: QuestionComment
has text: So my answer to *"what should i fix???"* would be to throw away your analysis code, find an existing Java parser / source code analyser library, and implement your analyser based on that. (Or if you are up for some interesting work, develop a parser from scratch using (say) Javacc or Antlr.)
score: 1
comment on: http://stackoverflow.com/q/26080896
type: Comment

http://stackoverflow.com/comment/41071917
type: Comment
type: QuestionComment
has text: You told that you know how to get `getAchievements` with `amount` you need to do exactly the same
comment on: http://stackoverflow.com/q/26193100
score: 0

http://stackoverflow.com/comment/40851989
comment on: http://stackoverflow.com/a/26065246
score: 0
type: AnswerComment
has text: (...) I'm given pause though about "the possibility that the index changes but the item doesn't". I'm not sure what this means. Does it imply that I'm going to find it non-trivial to match the item in the table cell back to the item I processed in the SortedList?
type: Comment

http://stackoverflow.com/comment/40860085
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26077556
has text: @mystickMagic , It is not loading too fast. i have a dialog.show(); and this show until the webview finish.. the image only not show!

http://stackoverflow.com/comment/40914541
type: Comment
score: 2
has text: "The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the **unsigned hexadecimal representation of the hash code of the object**."
type: AnswerComment
comment on: http://stackoverflow.com/a/26068509

http://stackoverflow.com/a/26245370
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26165776
has body: In my opinion You should verify if something is in buffer before reading. reading from stream is blocking operation so aplication will hang until somehing data appear. How can I check if an InputStream is empty without reading from it?
type: Answer

http://stackoverflow.com/comment/41042654
type: AnswerComment
comment on: http://stackoverflow.com/a/26176918
type: Comment
has text: Thanks to You i've found the problem
score: 0

http://stackoverflow.com/a/26098435
has comment: http://stackoverflow.com/comment/40898391
has comment: http://stackoverflow.com/comment/40899194
has comment: http://stackoverflow.com/comment/40899321
has body: You have supplied layout_weight=1 for both the children linear layout and not set Weightsum for parent Linear Layout.so height of each child will be equal to it's parents height/2. In short Scroll view height = full screen and each child will have height of half of screen. It means no scrolling needed. Try this: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
score: 0
answers question: http://stackoverflow.com/q/26097314
type: Answer

http://stackoverflow.com/a/26161552
has body: You can split on space (all whitespace) For example: String currLine = input1.nextLine(); //This only needed if you are not sure if the input will have leading/trailing space currLine = currLine.trim(); String[] split = currLine.split("\\s+"); //Ensuring the line read was properly split if(split.length == 2) { //split[0] will have the first hand player1.add(split[0]); //split[1] will have the second hand player2.add(split[1]); }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26161447
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41021416
answers question: http://stackoverflow.com/q/26161447

http://stackoverflow.com/a/26170380
has comment: http://stackoverflow.com/comment/41030430
type: Answer
has body: Use an IDE, it makes life so much easier. But, if you insist on doing things the old fashion way, try turning off your antivirus. If that doesn't work, check to make sure your environment variables are set correctly. If all else fails, try reinstalling your JDK.
score: 0
answers question: http://stackoverflow.com/q/26170234
accepted answer of: http://stackoverflow.com/q/26170234
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41030976

http://stackoverflow.com/comment/40856875
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26067765
has text: I cannot change the API I am using. The method in question takes as parameter Class<?>..., and what I have is a collection of Class<? extends MyType>.
type: Comment

http://stackoverflow.com/q/26148001
has comment: http://stackoverflow.com/comment/41000166
duplicate of: http://stackoverflow.com/q/2779251
upvote count: 1
has comment: http://stackoverflow.com/comment/40989024
favorite count: 0
has body: I am new to Android/ Java programming and need help in knowing how to convert json map to a java hashmap. Please refer the code below: HttpPost httpPost1 = new HttpPost( "http://www.mywebsite.com/something.json" ); Log.i("MAP", "Hash call"); List&lt;NameValuePair&gt; nameValuePair1 = new ArrayList&lt;NameValuePair&gt;(1); nameValuePair1.add(new BasicNameValuePair("id_token", token )); try { httpPost1.setEntity(new UrlEncodedFormEntity(nameValuePair1)); } catch (UnsupportedEncodingException e) { // writing error to Log e.printStackTrace(); } try { HttpResponse response1 = httpClient.execute(httpPost1); BufferedReader reader = new BufferedReader(newInputStreamReader(response1.getEntity().getContent(), "UTF-8")); StringBuilder builder = new StringBuilder(); for (line = null; (line = reader.readLine()) != null;) { // builder.append(line).append("\n"); System.out.println(line); } This code returns me a jason map, which has been shown below: {"myemailid@gmail.com":[{"lat":0.0,"lng":0.0,"tim":"2014-10-01T16:55:15.002Z"},{"lat":0.0,"lng":0.0,"tim":"2014-10-01T16:18:07.290Z"},{"lat":0.0,"lng":0.0,"tim":"2014-10-01T12:04:06.364Z"},{"lat":0.0,"lng":0.0,"tim":"2014-10-01T11:58:04.455Z"},{"lat":0.0,"lng":0.0,"tim":"2014-10-01T11:46:24.560Z"}]} What I need is to convert this json map to java hashmap. I would highly appreciate if I could be guided on this.
tagged with: hash
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/2779251
has title: Convert json map to java hashmap
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40988944
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: hashmap

http://stackoverflow.com/comment/40987237
has text: Yes. The properties need to be excluded in the `war` or `jar` and I mentioned in the earlier comment.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26130222

http://stackoverflow.com/q/26159993
has comment: http://stackoverflow.com/comment/41010329
tagged with: java
has comment: http://stackoverflow.com/comment/41010572
answer count: 2
has answer: http://stackoverflow.com/a/26163685
has comment: http://stackoverflow.com/comment/41010361
has comment: http://stackoverflow.com/comment/41010299
has comment: http://stackoverflow.com/comment/41010482
has comment: http://stackoverflow.com/comment/41010232
has comment: http://stackoverflow.com/comment/41011134
has answer: http://stackoverflow.com/a/26160102
has comment: http://stackoverflow.com/comment/41010266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41010262
has comment: http://stackoverflow.com/comment/41011489
has title: Algorithm suggestion - search on number list
has comment: http://stackoverflow.com/comment/41010337
has body: I have 7 digit number list. And I am required to perform search operation on the list. Input of program will be like this 5xx9xx1 . Minimum 3 digits will be known. And index of known digits are not important. Which algorithm would you suggest? I don't want to search on database with 'like' query.
score: 0
has comment: http://stackoverflow.com/comment/41014045
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41010368

http://stackoverflow.com/comment/40786320
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26037357
type: Comment
has text: But Java 8 has `LocalDateTime` too. So there's nothing that uniquely specifies it here.

http://stackoverflow.com/q/26111298
has body: Im trying to make a program that downloads a file. While downloading the file there needs to have a basic counter which counts from start to end. These two functions need to be in their own threads. I have created a method/thread to download the file. I'm having trouble figuring out how to make a basic counter. Nothing fancy but it needs to count up and only display the current number. Any help would be appreciated. import java.awt.Dimension; import java.awt.Toolkit; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import static myutilites.methods.*; public class Downloader { public static void main(String[] args) throws IOException { String filename = "Nexus5MahdiRom.zip"; URL link = new URL( "http://files.mahdi-rom.com/OnePlus%20One/" + "OnePlus%20One%20Builds/mahdi-2.7-bacon-20140903.zip"); Thread t1 = new Thread(new Runnable() { @Override public void run() { try { downloadFile(filename,link); } catch (IOException e) { e.printStackTrace(); } } }); Thread t2 = new Thread(new Runnable() { @Override public void run() { try { counter(link, t1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); t1.start(); println("Downloading File..."); } public void getScreenSize() { Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); println("width = " + d.width + " height = " + d.height); } public static void downloadFile(String fileName, URL link) throws IOException { InputStream in = new BufferedInputStream(link.openStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte [] buf = new byte[1024]; int n = 0; int count = 0; while (-1 !=(n=in.read(buf))) { out.write(buf, 0, n); } println(count); out.close(); in.close(); byte[] respon…
score: 0
has answer: http://stackoverflow.com/a/26111375
answer count: 1
has title: Creating threads to download a file and make a counter java
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
tagged with: inputstream
type: Question

http://stackoverflow.com/comment/40793705
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26041568
has text: What is the code for `friends`?
score: 0

http://stackoverflow.com/q/26060395
linked to: http://stackoverflow.com/q/11551985
type: AnsweredQuestion
has body: I am a student at a local tech in Ireland first year. We are as you guessed doing java and the at the moment we are handling Scanners at the moment. I have added my code at the bottom and a little confused. When I run the program it works fine till I get to the "Enter country" and the "Enter course" and these two line land up printing together no matter if I change the scanner to f.nextLine or f.next. Anyone able to help me out with this as I am missing something and I can't figure out what it is. Many thanks Matthew public static void main(String[] args) { String name; //declaring string name String town; //declaring string town double dist; //declaring double distance from AIT the person lives int age; //declaring their age double height; //declaring their height double weight; //declaring their weight String country; //declaring their country that they are from String course; //declaring their course that they are taking int years; //declaring the amount of years they are in the course String sNum; //declaring there email address string Scanner f = new Scanner(System.in); //Scanner s = new Scanner(System.in); // below is the prompt for all the information and there keyboard input with scanner System.out.print("Enter your name here &amp; press enter: "); name = f.nextLine(); System.out.print("Enter the name of the town or city you live in &amp; press enter: "); town = f.nextLine(); System.out.print("Enter the distance from AIT that you live in kilometers &amp; press enter: "); dist = f.nextDouble(); System.out.print("Enter your age &amp; press enter: "); age = f.nextInt(); System.out.print("Enter your height &amp; press enter: "); height = f.nextDouble(); System.out.print("Enter your weight &amp; press enter: "); weight = f.nextDouble(); System.out.print("Enter the name of country that you are from &amp; press enter: "); country = f.nextLine(); System.out.print("Enter the name of course you are taking &amp; press enter: "); course = f.nextLine(); System.out.print(…
tagged with: java
has comment: http://stackoverflow.com/comment/40912591
upvote count: 1
accepted answer: http://stackoverflow.com/a/26060613
type: Question
tagged with: eclipse
has title: Scanner multiple inputs issue
has comment: http://stackoverflow.com/comment/40827974
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26062580
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26060613
possible better answer: http://stackoverflow.com/a/26062580

http://stackoverflow.com/comment/40881533
score: 2
has text: @Harry Serialization is meant for the short term storage of the objects, typically for the transmission across the wire. JAXB would be a preferable solution as its more flexible and you can gain some control over it. You may even need to consider using your own process, extracting the properties you need and saving them to an XML file...
comment on: http://stackoverflow.com/q/26089184
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40945245
type: QuestionComment
comment on: http://stackoverflow.com/q/26110333
type: Comment
has text: @blackSmith I saved the file as a .csv and converted it to .txt below is a sample line, unless you want me to upload a larger sample set.
score: 0

http://stackoverflow.com/comment/40897204
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26098074
has text: This is about reacting on incoming connects, only. It is just one aspect of the question.
type: AnswerComment

http://stackoverflow.com/q/26047313
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26047452
accepted answer: http://stackoverflow.com/a/26047452
favorite count: 0
has body: my problem is I want a user based lock that I am able to create in one thread and release in a different thread. I was trying to use reetrant locks but my idea is falling short somewhere. I.e. There are blue, green and purple people. Each color group only has one shovel. If the purple group needs to use the shovel they need to wait for the shovel to be available. Both the blue group and purple group can have their respective shovels at a given moment. Mainclass public class MainReentrant { public static ConcurrentHashMap&lt;String, ReentrantLock&gt; locks; public static void main(String[] args){ locks = new ConcurrentHashMap&lt;String, ReentrantLock&gt;(); new Thread( new ReentrantEx(1)).start();; new Thread( new ReentrantEx(1)).start();; new Thread( new ReentrantEx(2)).start();; } } The first step is to create a lock and lock it. public class ReentrantEx implements Runnable { private Integer id; public ReentrantEx(Integer id){ this.id = id; } public void doSomethingPerUser(Integer i){ synchronized(i){ ReentrantLock tempLock = MainReentrant.locks.get(i.toString()); if(tempLock != null){ //we have an unlocked lock tempLock.lock(); }else{ //add a new lock for this customer tempLock = new ReentrantLock(); tempLock.lock(); MainReentrant.locks.put(i.toString(), tempLock); } System.out.println("doSomethingPerUser lock should be held : " + i); new Thread(new RandomRunnable(i)).start(); } } @Override public void run() { // TODO Auto-generated method stub doSomethingPerUser(id); } } next the randomRunnable class attempts to release the lock created by ReentrantEx public class RandomRunnable implements Runnable { private Integer id; public RandomRunnable(Integer id){ this.id = id; } @Override public void run() { // TODO Auto-generated method stub System.out.println(" RandomRunnable: id = "+ id ); ReentrantLock tempLock = MainReentrant.locks.get(id.toString()); synchronized(tempLock){ if(tempLock == null){ System.out.println("ERROR: we have a lock that we cannot free"); return…
tagged with: locks
has title: Name based Reentrant Lock in Java
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/41004881
type: QuestionComment
comment on: http://stackoverflow.com/q/26156760
score: 0
type: Comment
has text: Try read [the official tutorial](http://docs.oracle.com/javase/tutorial/java/generics/subtyping.html), then indicate which exact part you don't understand.

http://stackoverflow.com/q/26154316
has comment: http://stackoverflow.com/comment/41000345
answer count: 1
tagged with: macos
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to run eclipse on my Mac OS X. I've been doing some Android programming on Eclipse lately, and today wanted to do some development on Java. However, to my surprise, Eclipse says there's no JRE/JDK installed. I don't know how this is possible, since my android projects have worked very well so far, and even now. I've tried the following items: Checking java version through the Mac terminal. It says java version "1.8.0_20" is installed. Here's the screenshot. I've checked the Java version through the Java Control Panel in System Preferences. Again, same thing: I know that when there's no JRE visible in Eclipse, it can be manually entered through the "add" option under preferences > Java > Installed JREs in Eclipse. But although I can find the Contents folder in this path: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents, when I attempt to manually add this in Eclipse, the Java folder under users/library just doesn't show up. I have no idea why this is happening. Here are some screenshots, just in case: As you can see, the Java folder just doesn't show up under Library in the above screenshot. Lastly, I've also tried to hit "Search" in Eclipse (same place as "Add" in one of the screenshots above), but "Search" doesn't find anything at all. I've gone through existing answers on SO which deal with similar problems. The only thing which I haven't done seems to be about setting a path variable, but they were all in Windows OS, so not sure if it applies in my situation. I'd really appreciate any help on this. Update 1: According to what has been pointed out so far, I tried copy-pasting the suggested path. But the error I get is: The home directory does not exist. Here's the screenshot:
has answer: http://stackoverflow.com/a/26154374
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41000101
tagged with: eclipse
type: Question
downvote count: 0
has title: Missing JRE in Eclipse in Mac OSX

http://stackoverflow.com/q/26038963
has answer: http://stackoverflow.com/a/26039604
score: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/20443179
tagged with: io
tagged with: apache-commons-io
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40788944
upvote count: 1
downvote count: 1
has title: Should I close InputStream passed to IOUtils?
has body: I'm going to use apache commons method: IOUtils.toString(InputStream, "UTF-8"); Should I close passed InputStream manually or library is smart enough to care about it?
type: Question
has comment: http://stackoverflow.com/comment/40788574
accepted answer: http://stackoverflow.com/a/26039604
tagged with: apache-commons
duplicate of: http://stackoverflow.com/q/20443179
has comment: http://stackoverflow.com/comment/40788559

http://stackoverflow.com/a/27197094
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26100831
answers question: http://stackoverflow.com/q/26100831
upvote count: 1
has body: Firstly you need to check that the same jdk is being used when you run mvn from the command line. Secondly that the same version of mvn is being used on the commandline. C:\WORK\apache-maven-3.2.3 Once that is confirmed I would run a debug session from within intellij so I can tell which tests fail and why. Also make sure the permissions available running from within intellj and from the command line are the same. https://github.com/destin/maven-test-support-plugin Try installing this to view the test results and work through the failures

http://stackoverflow.com/comment/41006941
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26158159
score: 3
has text: Missing the case of `successPercent == 10` (I know it's also in the question, but that's why OP asked for a professional way of doing it).

http://stackoverflow.com/comment/40874940
type: Comment
type: QuestionComment
has text: @High Performance Mark - same code on different platforms is not measuring efficiency - agreed. Intention is to find some platform-independent way of measuring speed.
comment on: http://stackoverflow.com/q/26084436
score: 0

http://stackoverflow.com/q/26132065
type: UnansweredQuestion
has title: Spring STS 3.6.1 and Gradle plugin
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43379429
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/30853637
tagged with: spring
has comment: http://stackoverflow.com/comment/41030691
upvote count: 2
has answer: http://stackoverflow.com/a/36089594
answer count: 2
has body: I have downloaded Gradle support plugin through extension tab in dashboard of spring STS 3.6.1. Then tried to import a local gradle based project. But when I click on the button "Build Model". The following error message pops up and gradel project can't be imported to my spring STS. unable to find valid certification path to requested target See error log for details The Error log details is as follows: org.eclipse.core.runtime.CoreException: unable to find valid certification path to requested target at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.ensureModels(GradleModelProvider.java:284) at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:633) at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:654) at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:516) at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:84) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Caused by: org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.0-bin.zip'. at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:107) at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:36) at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:40) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(LazyConsumerActionExecutor.java:98) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:81) at org.gradle.tooling.internal.c…
tagged with: gradle
has comment: http://stackoverflow.com/comment/41032737
tagged with: java
tagged with: spring-tool-suite

http://stackoverflow.com/q/26060473
has answer: http://stackoverflow.com/a/34901471
type: Question
has body: In Spring MVC, I am writing something using a controller, essentially performing REST plus a few additions. Most of the functionality is called from ExtJS to spring, and to adhere to their conventions, the return is always a json object in the format: { success: true, data: { ... } } or in the case of an error: { success: false, message: { ... } } For the exceptions it is easy - Spring provides @ControllerAdvice and @ExceptionHandler etc so that errors can be trapped in one place and the standard response works. However is there an easy way to force all of the valid responses to be passed through in the same way, so that the success element could be sent every time with the data sent back in the data object. in other words, currently for every call I have to do something like @RequestMapping(method = RequestMethod.POST) @ResponseBody public HashMap&lt;String, Object&gt; add(@RequestBody ManagedView targetTest) { ManagedView result = service.add(targetTest); HashMap&lt;String, Object&gt; ret = new HashMap&lt;String, Object&gt;(); ret.put("success", new Boolean(true)); ret.put("data", result); return ret; } whereas I would like to do is have something like @RequestMapping(method = RequestMethod.POST) public ManagedView add(@RequestBody ManagedView targetTest) { return service.add(targetTest); } // and each response intercepted by something like this public HashMap&lt;String, Object&gt; addWrapper(Object result) { HashMap&lt;String, Object&gt; ret = new HashMap&lt;String, Object&gt;(); ret.put("success", new Boolean(true)); ret.put("data", result); return ret; } I appreciate I could just create a standard utility type function to do this but is there something that does this out of the box without me having to add the same code to all of the methods - preferably set globally. Thanks in advance
answer count: 2
has comment: http://stackoverflow.com/comment/40831693
tagged with: extjs
has comment: http://stackoverflow.com/comment/40829503
upvote count: 3
favorite count: 0
has title: Spring MVC / Rest - return standard response
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 3
has answer: http://stackoverflow.com/a/26065383
downvote count: 0
linked to: http://stackoverflow.com/q/13173341
tagged with: java

http://stackoverflow.com/comment/40836043
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26055493
has text: @MarkRotteveel, I tried, and it gives the same exception.

http://stackoverflow.com/q/26190851
has answer: http://stackoverflow.com/a/53206856
answer count: 5
score: 50
has comment: http://stackoverflow.com/comment/137218152
has answer: http://stackoverflow.com/a/62273087
tagged with: java
has title: Get single field from JSON using Jackson
has body: Given an arbitrary JSON I would like to get value of a single field contentType. How to do it with Jackson? { contentType: "foo", fooField1: ... } { contentType: "bar", barArray: [...] } Related How to find specified name and its value in JSON-string from Java? (GSON) Using gson to deserialize specific JSON field of an object (GSON)
has answer: http://stackoverflow.com/a/26191723
linked to: http://stackoverflow.com/q/35722646
type: Question
linked to: http://stackoverflow.com/q/6153176
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/56574388
has answer: http://stackoverflow.com/a/56574388
has comment: http://stackoverflow.com/comment/137192688
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/11428329
has comment: http://stackoverflow.com/comment/87170150
tagged with: jackson
accepted answer: http://stackoverflow.com/a/26191723
has answer: http://stackoverflow.com/a/26192894
upvote count: 50
downvote count: 0
has comment: http://stackoverflow.com/comment/137186632
has comment: http://stackoverflow.com/comment/125598080
favorite count: 0
has comment: http://stackoverflow.com/comment/137196893

http://stackoverflow.com/a/26178526
has comment: http://stackoverflow.com/comment/41050535
answers question: http://stackoverflow.com/q/26176727
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26176727
has body: Your JPA implementation should provide a property on persistence.xml to make it for you. By example, Hibernate provides hibernate.hbm2ddl.auto property which allow to create the schema, update or just validate. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <persistence ...> <persistence-unit ...> org.hibernate.jpa.HibernatePersistenceProvider <properties> <property name="hibernate.hbm2ddl.auto" value="validate"/> This makes the schema validation process on EntityManager initialization. Check on your current JPA implementation documentation to find the equivalent property. Good luck!

jaas
tags question: http://stackoverflow.com/q/26118287
type: Tag
tag name: jaas

http://stackoverflow.com/q/26124660
upvote count: 0
has answer: http://stackoverflow.com/a/26124806
has comment: http://stackoverflow.com/comment/40945305
answer count: 4
has title: Char-array: replace letter with capital letter in java
favorite count: 0
has comment: http://stackoverflow.com/comment/40945755
type: UnansweredQuestion
downvote count: 1
tagged with: foreach
has answer: http://stackoverflow.com/a/26124734
tagged with: java
score: -1
has body: So I want to take this String called navn, and make it into a char-array. Then I want to go through it and replace small "a's" with capital A's. So it should print E S ... l A ...(big A). But I cannot get it to work correctly. Any help would be great! private String navn = "Espen Askeladd"; public void metode4() { char[] navnBlirCharArray = navn.toCharArray(); for (char output : navnBlirCharArray) { if(navnBlirCharArray.equals('a')) { navnBlirCharArray[output] = 'A'; } System.out.println(output); } }
has answer: http://stackoverflow.com/a/26124733
has answer: http://stackoverflow.com/a/26124709
type: Question

http://stackoverflow.com/comment/40874211
score: 0
type: AnswerComment
has text: Marking this as the answer as that's what I ended up doing.
type: Comment
comment on: http://stackoverflow.com/a/26061436

http://stackoverflow.com/comment/40898770
type: QuestionComment
score: 1
has text: Maybe the limit is just your network throughput? 15Krps x 5000 bytes = about 70 MB per second.
type: Comment
comment on: http://stackoverflow.com/q/26098764

http://stackoverflow.com/q/26102115
type: AnsweredQuestion
favorite count: 0
score: 15
has answer: http://stackoverflow.com/a/31379132
type: Question
has body: I just encountered a strange error when switching the JDK version of a new Project of mine from 7u45 to 8u20. A harmless LogManager declaration at the beginning of my class is being refused with the following error: The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files This is the code: public class Class1 { private static Logger log = LogManager.getLogger(Class1.class); ... Eclipse proposes me to configure the build path, but I have no Idea what to configure because I don't know the underlying problem of that error. Using the JDK with version 7, everything works fine.
tagged with: java-8
tagged with: log4j2
possible better answer: http://stackoverflow.com/a/31379132
has answer: http://stackoverflow.com/a/26105217
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/32918092
has answer: http://stackoverflow.com/a/42686879
upvote count: 15
has title: Error when using LogManager (l4j2) with Java 8 (java.lang.reflect.AnnotatedElement cannot be resolved)
tagged with: java-7
downvote count: 0
has answer: http://stackoverflow.com/a/33985899
accepted answer: http://stackoverflow.com/a/26105217

http://stackoverflow.com/comment/41074181
comment on: http://stackoverflow.com/a/26193368
type: AnswerComment
score: 0
has text: Since we know the data is there, start narrowing down the possible error locations. I'd recommend this: Debug only the `first` object in the list at 1. arraylist befor calling NotifyDataSetChanged, 2. At the constructor of your Adapter class, 3. Before returning the rowView in the adapter (use position == 0 to get only first object). Using the `toString()` method, the 3 results should be identical with true values, the first one that doesn't match is the source of the problem. I went over your code and it seems pretty correct so must be a small thing we're missing.
type: Comment

http://stackoverflow.com/a/26156527
accepted answer of: http://stackoverflow.com/q/26156427
answers question: http://stackoverflow.com/q/26156427
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Try this code in Your Activity. set Your Custom Back Button getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_actionbar_screen_back); Hope it helps...

http://stackoverflow.com/q/26061217
linked to: http://stackoverflow.com/q/1154701
answer count: 3
tagged with: windows
possible better answer: http://stackoverflow.com/a/26061286
favorite count: 0
linked to: http://stackoverflow.com/q/12034177
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26061322
downvote count: 0
tagged with: java
has body: So my question today is one of personal academic willingness to learn, despite it probably being a little beyond my level. Bear with me on this! I've made a simple application, that might look (and might BE) a little clunky. All it does is open a window, and have you press a button, to close said window. Here's the code for this questionable construct: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class StartupLearning extends JFrame implements ActionListener { private JButton button; public StartupLearning() { super("If you see this box on startup, you've learned something new today!"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); button = new JButton("Close this box"); button.addActionListener(this); button.setActionCommand("Close"); add(button); pack(); } @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("Close")) dispose(); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new StartupLearning().setSize(400, 75); } }); } } I know it's not perfect, and I know it probably has faults that could be optimized and organized, but like mentioned, this is just me trying to teach myself something new. Now, what I wonder about is what code I can use, and how I can use said code to make this one very simple application run when a user logs in to Windows (let's leave cross-platform out of it, if it makes things even more complicated)? For someone about as green as he sounds, what class or code would best suit this job, and how can I use it with my presented code? All that needs to happen, is that this simple code needs to run when the user is logged in, and close when the user hits the button. EDIT Thanks to you three who answered, and I have clearly not been specific enough. I need my little pretty code to run on…
type: Question
tagged with: startup
linked to: http://stackoverflow.com/q/17838671
has answer: http://stackoverflow.com/a/26061302
accepted answer: http://stackoverflow.com/a/26061302
has title: Application start on logon with Java
has answer: http://stackoverflow.com/a/26061286
upvote count: 2

http://stackoverflow.com/comment/40973643
type: AnswerComment
score: 0
type: Comment
has text: Looks like I misinterpreted the purpose of the program. The aim is to calculate the next birthday given $years have passed since the $d ? Sure that means it was working correctly in the first place? Example yearsToNotify(2013, "0001-10-02"); so 2013 years have passed since 0001-10-02. That means its 2014-10-02. Thus the next birthday would be 2015.
comment on: http://stackoverflow.com/a/26139017

http://stackoverflow.com/comment/40823235
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26057239
has text: Yes, I want the first index of the value (for example "D") in the list. It's ok!
score: 0

jsp
tags question: http://stackoverflow.com/q/26111679
tags question: http://stackoverflow.com/q/26048052
tags question: http://stackoverflow.com/q/26100542
tags question: http://stackoverflow.com/q/26151933
tags question: http://stackoverflow.com/q/26090572
tags question: http://stackoverflow.com/q/26141077
tags question: http://stackoverflow.com/q/26185024
tags question: http://stackoverflow.com/q/26034901
tags question: http://stackoverflow.com/q/26051702
tags question: http://stackoverflow.com/q/26136335
tags question: http://stackoverflow.com/q/26056820
tags question: http://stackoverflow.com/q/26089856
tags question: http://stackoverflow.com/q/26174776
tags question: http://stackoverflow.com/q/26064766
tags question: http://stackoverflow.com/q/26104175
tags question: http://stackoverflow.com/q/26139942
tags question: http://stackoverflow.com/q/26058625
tags question: http://stackoverflow.com/q/26075304
tags question: http://stackoverflow.com/q/26167362
tags question: http://stackoverflow.com/q/26141003
tags question: http://stackoverflow.com/q/26047109
tags question: http://stackoverflow.com/q/26174503
tags question: http://stackoverflow.com/q/26051100
tags question: http://stackoverflow.com/q/26056739
tags question: http://stackoverflow.com/q/26185935
tags question: http://stackoverflow.com/q/26119716
tags question: http://stackoverflow.com/q/26191135
tags question: http://stackoverflow.com/q/26141816
tags question: http://stackoverflow.com/q/26193272
tags question: http://stackoverflow.com/q/26086289
tags question: http://stackoverflow.com/q/26138162
tags question: http://stackoverflow.com/q/26057743
tags question: http://stackoverflow.com/q/26092467
tags question: http://stackoverflow.com/q/26094987
tags question: http://stackoverflow.com/q/26094396
tags question: http://stackoverflow.com/q/26042496
tags question: http://stackoverflow.com/q/26134846
tags question: http://stackoverflow.com/q/26078116
tags question: http://stackoverflow.com/q/26157850
tags question: http://stackoverflow.com/q/26090965
tags question: http://stackoverflow.com/q/26126071
tags question: http://stackoverflow.com/q/26146049
type: Tag
tags question: http://stackoverflow.com/q/26169959
tags question: http://stackoverflow.com/q/26125014
tags question: http://stackoverflow.com/q/26114432
tags question: http://stackoverflow.com/q/26134338
tags question: http://stackoverflow.com/q/26061450
tags question: http://stackoverflow.com/q/26178788
tags question: http://stackoverflow.com/q/26089207
tags question: http://stackoverflow.com/q/26139856
tags question: http://stackoverflow.com/q/26045955
tags question: http://stackoverflow.com/q/26092902
tags question: http://stackoverflow.com/q/26169763
tags question: http://stackoverflow.com/q/26045368
tags question: http://stackoverflow.com/q/26040312
tags question: http://stackoverflow.com/q/26075727
tags question: http://stackoverflow.com/q/26093568
tags question: http://stackoverflow.com/q/26095068
tags question: http://stackoverflow.com/q/26063733
tags question: http://stackoverflow.com/q/26061189
tag name: jsp
tags question: http://stackoverflow.com/q/26035782
tags question: http://stackoverflow.com/q/26180970
tags question: http://stackoverflow.com/q/26127355
tags question: http://stackoverflow.com/q/26163484
tags question: http://stackoverflow.com/q/26170289
tags question: http://stackoverflow.com/q/26109380
tags question: http://stackoverflow.com/q/26160861
tags question: http://stackoverflow.com/q/26045244
tags question: http://stackoverflow.com/q/26153765
tags question: http://stackoverflow.com/q/26040693
tags question: http://stackoverflow.com/q/26106179
tags question: http://stackoverflow.com/q/26060261
tags question: http://stackoverflow.com/q/26167609
tags question: http://stackoverflow.com/q/26090955
tags question: http://stackoverflow.com/q/26081018
tags question: http://stackoverflow.com/q/26122780
tags question: http://stackoverflow.com/q/26115011
tags question: http://stackoverflow.com/q/26097341

http://stackoverflow.com/a/26078285
answers question: http://stackoverflow.com/q/26078171
has comment: http://stackoverflow.com/comment/40861518
has comment: http://stackoverflow.com/comment/40861257
downvote count: 0
has comment: http://stackoverflow.com/comment/40861329
has comment: http://stackoverflow.com/comment/40861172
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40861243
has body: You can't write a method INSIDE another method. Write all of your methods outside body of MAIN method to make it more clear look at this class Employee{ String fname,lname; double salary; static void main() {/*body of main*/} public Employee() {/*body of constructor*/} void func1() {/*body of func1*/} }//End of Class

http://stackoverflow.com/comment/77174301
comment on: http://stackoverflow.com/a/26098399
type: Comment
has text: Hmm. `AbstractStringBuilder` has a default constructor. But neither `StringBuilder` or `StringBuffer` use that. They use a one with a initial capacity. So in that case for those two there won't be a 0-length array. they have default size of 16. Do you know any other use case of `AbstractStringBuilder`
score: 0
type: AnswerComment

http://stackoverflow.com/q/26120591
type: AnsweredQuestion
tagged with: nomenclature
tagged with: design-patterns
type: Question
accepted answer: http://stackoverflow.com/a/26121575
has comment: http://stackoverflow.com/comment/40938111
tagged with: java
upvote count: 6
possible better answer: http://stackoverflow.com/a/26136755
has answer: http://stackoverflow.com/a/26121575
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/26136755
has comment: http://stackoverflow.com/comment/40938889
downvote count: 1
favorite count: 0
has body: Consider this code from Apache Commons StringUtils: public static String[] splitByCharacterType(final String str) { return splitByCharacterType(str, false); } private static String[] splitByCharacterType(final String str, final boolean camelCase) { // Some code... } This is a pretty common approach - public method delegates a call to private method with the same name but with additional parameters. Is there any name for this pattern?
has title: Public method calls private method with the same name - what is this pattern?
tagged with: language-agnostic
has comment: http://stackoverflow.com/comment/40937918

http://stackoverflow.com/a/26038227
has comment: http://stackoverflow.com/comment/40787167
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26038118
answers question: http://stackoverflow.com/q/26038118
upvote count: 5
has body: Are you sharing a single connection (a single Producer) across all threads? If so then probably you are hitting some thread contention in there and you are limited to the speed of the socket connection between your producer and your broker. Of course, it will depend much on the jms implementation you are using (and if you are using asyncSends or not). I will recommend you to repeat your tests using completely separate producers (although, you will lose the "queue" semantic in terms of ordering of messages, but I guess that is expected). Also, I do not recommend running performance tests with numbers so high like 100 threads. Remember that your multithread capability it at some point limited by the amount of cores you machine has (more or less, you are having also a lot of IO in here so it might help to have a few more threads than cores, but a 100 is not really a good number in my opinion)

http://stackoverflow.com/a/26160334
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26159453
has body: Implement com.microsoft.windowsazure.serviceruntime.RoleEnvironmentStoppingListener This is available from Maven Central: http://search.maven.org/#artifactdetails|com.microsoft.azure|azure-serviceruntime|0.6.0|jar
accepted answer of: http://stackoverflow.com/q/26159453

http://stackoverflow.com/comment/40908180
type: QuestionComment
has text: i don't believe you again :D
score: 0
comment on: http://stackoverflow.com/q/26102916
type: Comment

http://stackoverflow.com/q/26176797
has comment: http://stackoverflow.com/comment/41042465
has answer: http://stackoverflow.com/a/26177393
downvote count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41041903
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41042141
has title: Java-Spring, strange NullPointerException
tagged with: dwr
has body: I'll explain the situation. I have an application web, java + spring + hibernate. Actually, i want to integrate DWR with Spring, so I did all the configuration and I think what I did works fine since I get this windows: Now, we can focus on the findUsername(String username) methodo inside the dwr code: @Autowired UserBo userBo; public boolean findUsername(String username) { System.out.println("I'm in the DWR"); try { User user = userBo.findByUsername(username); if(user != null) { return true; } else { return false; } } catch (Exception e) { System.out.println(e.toString()); return false; } } And this is the code of userBo.findByUsername(String username) methodo: public User findByUsername(String username) { System.out.println("I'm in the BO"); return userDao.findByUsername(username); } And the DAO Code: @Transactional public User findByUsername(String username) { session = sessionFactory.openSession(); System.out.println("I'm in the DAO"); String hql = "FROM User Tab WHERE Tab.username= :username"; Query query = session.createQuery(hql); query.setParameter("username", username); @SuppressWarnings("unchecked") List&lt;User&gt; userFound = (List&lt;User&gt;) query.list(); if (userFound.size() &gt; 0) { session.close(); return userFound.get(0); } return null; } But when the code reach userBo.findByUsername(username); method call i get the NullPointerException. I'm pretty sure the bo + day working good because I've used it in some other part of the application. I don't understand the problem. Can someone help me? EDIT: The StackTrace lcc.dwr.CCServiceDWR.findUsername(CCServiceDWR.java:26) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.directwebremoting.impl.CreatorModule$1.doFilter(CreatorModule.java:229) org.directwebremoting.impl.CreatorModule.executeMethod(CreatorModule.java:241) o…
has comment: http://stackoverflow.com/comment/41042404
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41042072
has answer: http://stackoverflow.com/a/26176918
has comment: http://stackoverflow.com/comment/41041724
has comment: http://stackoverflow.com/comment/41042509
favorite count: 0
accepted answer: http://stackoverflow.com/a/26177393
possible better answer: http://stackoverflow.com/a/26176918
has comment: http://stackoverflow.com/comment/41041823
has comment: http://stackoverflow.com/comment/41042266

http://stackoverflow.com/a/26087943
upvote count: 1
answers question: http://stackoverflow.com/q/26087061
type: Answer
has body: If you don't specify any modifier to any property/method then, it has default modifier. Which means it can be only accessed within same class or package. Whereas a private modifier restrict the property to be accessed within the defined class.
downvote count: 0
score: 1

http://stackoverflow.com/q/26116948
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40931165
has answer: http://stackoverflow.com/a/31604438
has body: I want to change color of underline in Edittext and i follow some tutorials to do this. I create this xml file: <?xml version="1.0" encoding="utf-8"?> <solid android:color="#00FFFFFF" /> <padding android:bottom="2dp" /> <stroke android:width="1dp" android:color="#FFFFFF" /> But i only do the underline not all rectangle, similiar as default line but white inside of blue and solid background transpartet. How can i do this? Thanks
has answer: http://stackoverflow.com/a/29713896
tagged with: android-edittext
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13238298
has title: Edit color of underline in Edittext Android

http://stackoverflow.com/a/26405932
has comment: http://stackoverflow.com/comment/41570224
has comment: http://stackoverflow.com/comment/41491915
has comment: http://stackoverflow.com/comment/41520578
has comment: http://stackoverflow.com/comment/41485904
has body: The problem is, that there is an exception thrown and no exceptionMapper can map this to an valid output. You can try this: @Provider @Produces(MediaType.TEXT_PLAIN) public class ValidationErrorMessageBodyWriter implements MessageBodyWriter&lt;ValidationErrorMessage&gt; { private static final Logger LOG = LoggerFactory.getLogger(ValidationErrorMessageBodyWriter.class); @Override public boolean isWriteable( Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { return ValidationErrorMessage.class.isAssignableFrom(type); } @Override public long getSize( ValidationErrorMessage t, Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } @Override public void writeTo( ValidationErrorMessage t, Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap&lt;String, Object&gt; httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Joiner joiner = Joiner.on("; ").skipNulls(); String message = joiner.join(t.getErrors().iterator()); entityStream.write(message.getBytes(Charsets.UTF_8)); LOG.info(message); } } Now add in you app run(config,enviroment) method: // Serializer environment.jersey().register(new ValidationErrorMessageBodyWriter()); Perhaps you want to modify the BodyWriter to produce other output like xml or sth. else! Hope this solves your problem :-) EDIT: Question in Comment Add this in one of your resources: @GET @Path("getMBW") public Response getInTestResource(@Context MessageBodyWorkers workers) { Map&lt;MediaType, List&lt;MessageBodyWriter&gt;&gt; writers = workers.getWriters(MediaType.WILDCARD_TYPE); for (Entry&lt;MediaType, List&lt;MessageBodyWriter&gt;&gt; entry : writers.entrySet()) { for (MessageBodyWriter writer : entry.getValue()) { System.out.println(String.format("For mediaType '%s' there is a class called %s", entry.getKey(),writer.getClass().getName())); } } return Response.status(Status.OK).type(MediaT…
has comment: http://stackoverflow.com/comment/41568494
has comment: http://stackoverflow.com/comment/41460675
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41498174
answers question: http://stackoverflow.com/q/26137824
has comment: http://stackoverflow.com/comment/41484533

http://stackoverflow.com/q/26181815
tagged with: repast-simphony
linked to: http://stackoverflow.com/q/16428098
type: UnansweredQuestion
tagged with: compiler-errors
has title: An error keeps coming up when using repast simulator
tagged with: java
tagged with: simulator
type: Question
has answer: http://stackoverflow.com/a/26628518
has body: I looked at the demos and built my own zombie simulator as described in the documentation, but an error keeps coming up and I'm pretty sure its not to do with my code since I just copied it from the docs for the zombie simulator and opened the demos repast provides. when I run the simulator it gives me this error 2014/10/03 16:05:19,354: Scenario Load Error repast.simphony.scenario.ScenarioLoadException: ParseError at [row,col]:[5,21] Message: Open quote is expected for attribute "{1}" associated with an element type "type". at repast.simphony.scenario.ScenarioLoader.load(ScenarioLoader.java:220) at repast.simphony.ui.RSApplication.open(RSApplication.java:353) at repast.simphony.ui.RSAppConfigurator.postWindowOpen(RSAppConfigurator.java:39) at saf.core.ui.GUICreatorDelegate.runDisplay(GUICreatorDelegate.java:188) at saf.core.ui.GUICreator$1.run(GUICreator.java:18) at simphony.util.ThreadUtilities$Runner.run(ThreadUtilities.java:33) at simphony.util.ThreadUtilities.runInEventThread(ThreadUtilities.java:47) at saf.core.ui.GUICreator.runDisplay(GUICreator.java:16) at repast.simphony.ui.RSUIPlugin$1.run(RSUIPlugin.java:104) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: javax.xml.stream.XMLStre…
tagged with: runtime-error
score: 0
answer count: 1

http://stackoverflow.com/comment/40882180
type: Comment
type: QuestionComment
has text: Where are you inserting the commas?
comment on: http://stackoverflow.com/q/26089727
score: 0

http://stackoverflow.com/comment/40986398
score: 0
type: QuestionComment
has text: It is hard to tell what is causing it to be slow without seeing what email.jar is doing internally.
type: Comment
comment on: http://stackoverflow.com/q/26147003

http://stackoverflow.com/comment/40787228
has text: Thanks Stephan for your answer! Appreciate it!
comment on: http://stackoverflow.com/a/26036758
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40995167
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26151609
has text: Here is an answer: http://stackoverflow.com/questions/10301907/why-do-i-get-non-static-variable-this-cannot-be-referenced-from-a-static-contex
score: 0

http://stackoverflow.com/q/26038049
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40788189
tagged with: eclipse-rcp
type: Question
has title: Getting the Visibility of a Handler
has answer: http://stackoverflow.com/a/26053162
has comment: http://stackoverflow.com/comment/40787704
score: 0
tagged with: java
tagged with: swt
answer count: 1
has body: Out base plug-ins define commands and handler, which the application later enables or disables or makes (in)visible. Now I'm trying to evaluate a double click and need to access a command. That's easy: private boolean executeCommand(String commandId) { IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class); try { handlerService.executeCommand(commandId, null); return true; } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { MessageUtil.logError(e); return false; } } Now the problem is: There are two handlers ("edit" and "view") which are possible to be executed, and I want to only execute "edit" when it's there, else "view". ICommandService commandService = (ICommandService) getSite().getService(ICommandService.class); Command command = commandService.getCommand(commandId); IHandler handler = command.getHandler(); I tried asking the command for isDefined(), isEnabled() and isHandled() and the handler for isEnabled() and isHandled(), but everything returns true. How do I find out if the handler is visible?
accepted answer: http://stackoverflow.com/a/26053162

http://stackoverflow.com/q/26146905
tagged with: oracle-database
tagged with: jdbc
has body: public void Execute_Select_Statement(String instruction) throws SQLException { PreparedStatement ps = null; try { ps = this.conn.prepareStatement(instruction); ResultSet rs = ps.executeQuery(); while (rs.next()) { String column = rs.getString(1); System.out.println("column1:" + column); } } catch(SQLException e) { System.out.println(e.getMessage()); } finally { if(ps != null) { ps.close(); } } } I now have the code above, which gets a specific column from a table in an oracle database. But when I want to get more columns I have to add another getstring. How can I fix it in a way that it first gets the number of columns of the given table, and then gets the info out of it?
has comment: http://stackoverflow.com/comment/40987618
accepted answer: http://stackoverflow.com/a/26146941
tagged with: java
tagged with: mysql
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2614416
has title: Java - jdbc select method for multiple columns
type: Question
score: 0
duplicate of: http://stackoverflow.com/q/2614416
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/26146941

http://stackoverflow.com/comment/41050511
has text: Thanks for the suggestion. I will definitely look into XMLBeam, have to figure out first how to use it though.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26180059
score: 0

http://stackoverflow.com/a/26113867
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26113769
has body: You may throw an exception but this will result in a verbose output with the whole stacktrace included. Another way is to use ant.fail construct. For instance: if(1 != 2) { ant.fail('1 is not equal to 2') } There was also a similar question.

http://stackoverflow.com/q/26099818
has answer: http://stackoverflow.com/a/40930850
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26100094
has comment: http://stackoverflow.com/comment/40900239
has title: How quickly check whether double fits in float? (Java)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26099977
answer count: 4
has body: Are there some arithmetic or bitwise operations that can check whether a double fits into a float without loss of precision. It should not only check that the double range is in the float range, but also that no mantissa bits get lost. Bye P.S.: This answers the problem half way for C#: How to check if a double can fit into a float without conversion to infinity But I need a solution that works for Java.
tagged with: floating-point
has answer: http://stackoverflow.com/a/26099911
type: Question
tagged with: java
score: 10
upvote count: 10
has comment: http://stackoverflow.com/comment/70981677
linked to: http://stackoverflow.com/q/16857604

http://stackoverflow.com/comment/41179104
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26097200
type: Comment
has text: @pappu_kutty For me its working in both IE and firefox

http://stackoverflow.com/comment/40908929
score: 0
type: AnswerComment
type: Comment
has text: Yes, But he says he is using Xpath, which is basically javascript, If you can directly do this request using JAVA, let us know.. good luck :)
comment on: http://stackoverflow.com/a/26104526

struts-1
tags question: http://stackoverflow.com/q/26074351
type: Tag
tag name: struts-1

http://stackoverflow.com/a/26218749
accepted answer of: http://stackoverflow.com/q/26189167
score: 2
answers question: http://stackoverflow.com/q/26189167
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: I experienced this issue because the lombok version my project used, 0.9.3, was not supported in Eclipse Luna. I have upgraded my version to 1.14.8 and now everything is working as expected. See how to configure lombok in eclipse luna for more information.
type: Answer

http://stackoverflow.com/q/26131447
type: Question
has comment: http://stackoverflow.com/comment/40969569
has comment: http://stackoverflow.com/comment/40969373
has title: Java SWT image in front of a styled text
score: 0
has body: I have a StyledText in my application with bold or colored words and I want to add an image in front of the text, like in the example above: But since I am very new in SWT I don't know what to search for. How is this possible? Can anyone give me some code snippet or examples from web? I searched but I could not find anything.
answer count: 1
tagged with: user-interface
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/40970286
has comment: http://stackoverflow.com/comment/40965933
has answer: http://stackoverflow.com/a/26147749
has comment: http://stackoverflow.com/comment/40969845
tagged with: java
tagged with: image
tagged with: styledtext
has comment: http://stackoverflow.com/comment/40970030

http://stackoverflow.com/comment/42132028
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26752840
type: AnswerComment
has text: it works but I had to manually download [hadoop-auth-2.5.0.jar](http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-auth/2.5.0) (for `org.apache.hadoop.util.PlatformName`) as for some reason it was missing in my hadoop installation.

http://stackoverflow.com/q/26073033
type: AnsweredQuestion
has body: I created a simple Maven web app project, with 1 jsp file index.jsp. I am able to access this file from server as follows: http://localhost:8080/myProject/ How does it is able to access my index.jsp ? I haven't specified anything on web.xml. Where does all these configuration was exist ? 2.) Can I change the URL to like http://localhost:8080/myProject/webapp/index.jsp ?
tagged with: java
type: Question
has title: How maven knows about my web app files vs servlet files?
has answer: http://stackoverflow.com/a/26073136
accepted answer: http://stackoverflow.com/a/26073136
answer count: 1
score: 0
tagged with: maven

http://stackoverflow.com/a/26185940
has body: Both the above answers by Chris and Sotirios Delimanolis are correct. I just marked the one as answer which covers both the cases.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26171326

http://stackoverflow.com/q/26050559
favorite count: 0
has comment: http://stackoverflow.com/comment/40832937
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40831931
tagged with: java
has title: TDD, Matrix Additions Not Working
has answer: http://stackoverflow.com/a/26063657
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40812174
has comment: http://stackoverflow.com/comment/40831963
score: -1
has body: Lowdown: Beginning Java course. Lecture has been about collections, and nothing really too difficult in concept. All theory, not blood and guts coding. Lab, has been a series of coding projects completely unrelated to the lecture (or mostly anyway). This lab is about Test Driven Development. The Exact text is as such: Write tests for, and an implementation of, a method which performs matrix addition on integer matrices, as described below. Note that "x" and "y" must have the same dimensions; the resulting matrix will also have the same dimensions. public int[][] add(int[][] x, int[][] y); See http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html for documentation about arrays. Challenge - write the tests BEFORE you write implementation code. Make sure you have a good understanding of what the properties of matrix addition are before you attempt to write code to perform it. For more information about matrix addition, see http://mathworld.wolfram.com/MatrixAddition.html and the references cited there. Note the two properties of matrix addition: commutativity and associativity --- you tests should verify these properties. My Test Code First Attempt package tests; import static org.junit.Assert.assertTrue; import code.Homework4Practice; import org.junit.Before; import org.junit.Test; public class ReferenceTests { private code.Homework4Practice _class; @Before public void setUp() { _class = new code.Homework4Practice(); } @Test public void addMatrice01() { int [][] a = {{1,2}, {1,0}}; int [][] b = {{1,0}, {1,2}}; int [][] expected = {{2,2}, {2,2}}; int [][] actual = _class.addMatrices(a, b); assertTrue("Calling addMatrices with arguments \""+a+"\" and \""+b+"\" I expected the result to be {2,2} {2,2} but instead the result was " +arrayEquals(expected,actual)); } private boolean arrayEquals(int[][] expected, int[][] actual) { if (expected.length != actual.length) { return false; } for (int i=0; i&lt;expected.length; i++) { if (expected[i] != actual[i]) { return fal…
tagged with: tdd
has comment: http://stackoverflow.com/comment/40832150
accepted answer: http://stackoverflow.com/a/26063657
has comment: http://stackoverflow.com/comment/40810378
upvote count: 0
tagged with: matrix
answer count: 1

http://stackoverflow.com/comment/40907924
comment on: http://stackoverflow.com/q/26103950
score: 0
has text: but thats increbidle amount of methods.. i dont want to have all of them in my class
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26177946
has answer: http://stackoverflow.com/a/45008664
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/75817778
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41045578
tagged with: jpa
score: 0
has body: I have a scenario where a database column is of the data type mediumtext. My entity has the following interface: @Lob @Column(name = "data", length = 16777215) public String getData() { return this.data; } Still when I deploy to my server I get this error: HibernateException: Wrong column type in dme42_apns.appboxdatastore for column data. Found: mediumtext, expected: longtext I have tried making my own MySQLDialect with the following code which does not help: @Override protected void registerVarcharTypes() { super.registerVarcharTypes(); registerColumnType(Types.VARCHAR, 16777215, "mediumtext"); registerColumnType(Types.VARCHAR, 65535, "text"); } Does anyone have an idea, of why hibernate maps like this?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41107201
tagged with: hibernate-mapping
has title: Mapping of data types in hibernate
has comment: http://stackoverflow.com/comment/41044531

http://stackoverflow.com/comment/40795867
has text: I should mention that the code that the OP has provided here is **[my code that I wrote to answer another question of his](http://stackoverflow.com/questions/26022233/calculate-the-date-of-easter-sunday/26022891#26022891)**. You guys need to read that question to understand this one.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26042547

http://stackoverflow.com/comment/40944736
type: QuestionComment
has text: Not sure what you're asking. Can you clarify?
score: 0
comment on: http://stackoverflow.com/q/26124372
type: Comment

http://stackoverflow.com/comment/77632112
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/26154762
has text: You can also just do `mock(ObjectNeedToMock.class, RETURNS_DEFAULTS);` No lambda needed.

http://stackoverflow.com/a/26145065
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26144980
has body: getActivity().findViewById(R.id.listViewShop) Assuming the listview is in the fragment layout, it isn't yet a part of the activity view hierarchy in a method called from activity onCreateView(). Pass the view hierarchy you've inflated in onCreateView() as the root view you call findViewById() on to find views there.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26144980
has comment: http://stackoverflow.com/comment/40982773

http://stackoverflow.com/comment/41015423
score: 1
comment on: http://stackoverflow.com/q/26162646
type: Comment
type: QuestionComment
has text: [Collections.reverse(List)](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#reverse%28java.util.List%29) doesn't take a comparator. Also, what do you mean does not work?

http://stackoverflow.com/comment/41134336
comment on: http://stackoverflow.com/q/26064489
has text: Have you considered using the new java 8 time api?, The dateTime class used to have this kind of problems. Maybe using Instant class from java 8 instead of DateTime.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26191723
has comment: http://stackoverflow.com/comment/87169102
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/87169816
upvote count: 84
has comment: http://stackoverflow.com/comment/87179055
has comment: http://stackoverflow.com/comment/87170165
has body: The Jackson Way Presuming you don't have a POJO describing your data structure, you could simply do: final String json = "{\"contentType\": \"foo\", \"fooField1\": ... }"; final JsonNode node = new ObjectMapper().readTree(json); // ^^^^^^^^^^^^^^^^^^ // n.b.: try and *reuse* a single instance of ObjectMapper in production if (node.has("contentType")) { System.out.println("contentType: " + node.get("contentType")); } Addressing concerns in the comments section If, however, you wish to not consume the entire source String, but simply access a specific property whose path you know, you'll have to write it yourself, leveraging a Tokeniser. Actually, it's the weekend and I got time on my hands, so I could give you a head start: here's a basic one! It can run in strict mode and spew out sensible error messages, or be lenient and return Optional.empty when the request couldn't be fulfilled. public static class JSONPath { protected static final JsonFactory JSON_FACTORY = new JsonFactory(); private final List<JSONKey> keys; public JSONPath(final String from) { this.keys = Arrays.stream((from.startsWith("[") ? from : String.valueOf("." + from)) .split("(?=\\[|\\]|\\.)")) .filter(x -> !"]".equals(x)) .map(JSONKey::new) .collect(Collectors.toList()); } public Optional<String> getWithin(final String json) throws IOException { return this.getWithin(json, false); } public Optional<String> getWithin(final String json, final boolean strict) throws IOException { try (final InputStream stream = new StringInputStream(json)) { return this.getWithin(stream, strict); } } public Optional<String> getWithin(final InputStream json) throws IOException { return this.getWithin(json, false); } public Optional<String> getWithin(final InputStream json, final boolean strict) throws IOException { return getValueAt(JSON_FACTORY.createParser(json), 0, strict); } protected Optional<String> getValueAt(final JsonParser parser, final int idx, final boolean strict) throws IOException { try { if (parser.isCl…
accepted answer of: http://stackoverflow.com/q/26190851
has comment: http://stackoverflow.com/comment/87169682
score: 83
answers question: http://stackoverflow.com/q/26190851
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/87170168
has comment: http://stackoverflow.com/comment/87169900
has comment: http://stackoverflow.com/comment/87169620
has comment: http://stackoverflow.com/comment/87170081
has comment: http://stackoverflow.com/comment/87169908

http://stackoverflow.com/comment/40847037
has text: I am not exactly sure why I am getting a null pointer exception.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26070484

http://stackoverflow.com/comment/41036332
has text: @KickButtowski You can't say OP **stole your answer** SO is open for all to learn something new and he/she just used your answer to learn.
type: Comment
score: 3
comment on: http://stackoverflow.com/a/26173751
type: AnswerComment

http://stackoverflow.com/q/26073453
favorite count: 0
has body: I am learning GWT and to create a new project I call webappcreator with -templates sample,ant,eclipse,readme Using template sample is a great start, but the "sample" is very limited. Where can I find more templates like "sample"? I guess I am looking for a simple GWT code generator.
tagged with: gwt
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
has title: Where can I find more GWT webappcreator templates?
answer count: 1
tagged with: javascript
upvote count: 3
has answer: http://stackoverflow.com/a/36316131
accepted answer: http://stackoverflow.com/a/36316131

http://stackoverflow.com/q/26127893
has answer: http://stackoverflow.com/a/26127953
type: AnsweredQuestion
has body: I have three .java files, A.java, B.java and C.java A.java: public class A { public static void main(String[] args) { A a = new A(); B b = new B(); a.display(); b.display(); } public void display() { System.out.println("In A"); } } B.java: public class B { public void display() { System.out.println("In B"); C c = new C(); c.display(); } } C.java: public class C { public void display() { System.out.println("In C"); } } The program works fine. I compiled it as: javac A.java and this generated A.class, B.class and C.class files. Then ran it as: java A It's output: In A In B In C Now the PROBLEM is here: When I delete A.class and C.class, and not B.java, and recompiled A.java: javac A.java This generates only A.class. B.class was already present as not deleted. But why was C.class not generated this time? NOTE: C.class is generated when B.class is also deleted along with A.class and C.class. Or if I make any changes in B.java file pre-compilation.
tagged with: java
has comment: http://stackoverflow.com/comment/40951459
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26127954
tagged with: compilation
score: 4
answer count: 2
downvote count: 0
favorite count: 0
has title: Compiling Class files in Java has been confusing
possible better answer: http://stackoverflow.com/a/26127953
accepted answer: http://stackoverflow.com/a/26127954
tagged with: javac

http://stackoverflow.com/q/26051247
has comment: http://stackoverflow.com/comment/40811732
has title: Fill ImageView to screen whilst maintaining aspect ratio
has answer: http://stackoverflow.com/a/26051281
tagged with: android
possible better answer: http://stackoverflow.com/a/26052164
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40811632
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40821557
has answer: http://stackoverflow.com/a/26052105
tagged with: java
has answer: http://stackoverflow.com/a/26052164
type: Question
accepted answer: http://stackoverflow.com/a/26051281
has body: I have two image files: 320dpi 768x1280 480dpi 1080x1920 I have placed each image in the xhdpi and xxhdpi drawables folder of my project respectively. I am trying to get both images to scale appropriately and fill the screen without any whitespace. My XML code is as follows: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.vax.gamurs.LandingPage" android:background="#ffffffff" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/LandingBack" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/background" android:adjustViewBounds="true" android:layout_gravity="center" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /&gt; I am getting whitespace on the sides of both the Nexus 4 and the Nexus 5. How can I eliminate the whitespace and have the image fill the screen whilst maintaining aspect ratio?
score: 0
has answer: http://stackoverflow.com/a/26054896

http://stackoverflow.com/a/26052445
has body: Better you can try this will help you a lot. use strict; use warnings; my $string = qq( They are the same thing. Let's shoot them both. We can't wait for you to move back either. You seem quite uptight. Does your wife (who is also your sister) not give it up any more? Can domestic violence abusers be rehabilitated? http://usat.ly/1rwvgWf Taulia enables Fortune 500 businesses to electronically handle all invoicing and payment to their suppliers ); $string =~ s{<seg(?: [^>]+)?>((?:(?!</?seg[ >]).)*) }{$1}ig; print $string;exit;
answers question: http://stackoverflow.com/q/26048524
has comment: http://stackoverflow.com/comment/40813853
score: 0
type: Answer

http://stackoverflow.com/a/72142940
has body: For future readers struggling to understand how the count method doesn't execute the peek method before it, I thought I add this additional note: As per Java 9, the Java documentation for the count method states that: An implementation may choose to not execute the stream pipeline (either sequentially or in parallel) if it is capable of computing the count directly from the stream source. This means terminating the stream with count is no longer enough to ensure the execution of all previous steps, such as peek.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26058573
type: Answer

http://stackoverflow.com/q/26039111
score: 1
has comment: http://stackoverflow.com/comment/40790753
tagged with: java
has comment: http://stackoverflow.com/comment/40788904
type: Question
has body: I'm new to developing android apps. And already overchallenged with my first project. My app should be able to save a list of EditText fields to a text file by clicking a "save"-Button. But I got no success to write a file to my SD-card. My code: (function in MainActivity.java called by the button) public void saveData(View view){ try{ File sdcard = Environment.getExternalStorageDirectory(); // to this path add a new directory path File dir = new File(sdcard.getAbsolutePath() + "/myapp/"); // create this directory if not already created dir.mkdir(); // create the file in which we will write the contents File file = new File(dir, "datei.txt"); FileOutputStream os = new FileOutputStream(file); String data = "some string"; os.write(data.getBytes()); os.flush(); os.close(); } catch (IOException e){ Log.e("com.sarbot.FitLogAlpha", "Cant find Data."); } } With Google I found another way: public void saveData3(View view){ FileWriter fWriter; File sdCardFile = new File(Environment.getExternalStorageDirectory() + "/datafile.txt"); Log.d("TAG", sdCardFile.getPath()); //&lt;-- check the log to make sure the path is correct. try{ fWriter = new FileWriter(sdCardFile, true); fWriter.write("CONTENT CONTENT UND SO"); fWriter.flush(); fWriter.close(); }catch(Exception e){ e.printStackTrace(); } } In my manifest.xml I set the permissions: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; And the function from developer guide returns me True -> SD-card is writable. /* Checks if external storage is available for read and write */ public boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { return true; } return false; } In the res/layout/activity_main.xml are some TextViews and EditText and a save button with android:onClick="saveData" argument. The function is called. The SD-card is writa…
has answer: http://stackoverflow.com/a/26039501
accepted answer: http://stackoverflow.com/a/26039501
has answer: http://stackoverflow.com/a/26039150
answer count: 2
possible better answer: http://stackoverflow.com/a/26039150
upvote count: 1
tagged with: external
favorite count: 0
has title: How to write file to sd-card? (Android) No errors, but nothing written
has comment: http://stackoverflow.com/comment/40790127
tagged with: android
tagged with: storage
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41032161
comment on: http://stackoverflow.com/q/26171284
has text: @Pshemo Thanks. I just updated the question with the completed code. Now i guess you will create the same error as mine :)
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/41046133
type: QuestionComment
comment on: http://stackoverflow.com/q/26178887
has text: @shinjw: Yes, I know but I asked what I should use ,setString() or setObject().
score: 0
type: Comment

http://stackoverflow.com/a/26213174
downvote count: 0
has comment: http://stackoverflow.com/comment/77736553
has body: Regardless of whether you use method references, lambda expressions or ordinary method calls, an instance method requires an appropriate instance for the invocation. The instance may be supplied by the function invocation, e.g. if forEach expected a BiConsumer&lt;Chapter3,String&gt; it worked. But since forEach expects a Consumer&lt;String&gt; in your case, there is no instance of Chapter3 in scope. You can fix this easily by either, changing Chapter3.print to a static method or by providing an instance as target for the method invocation: public class Chapter3 { public void print(String s) { System.out.println(s); } public static void main(String[] args) { Arrays.asList("a", "b", "c").forEach(new Chapter3()::print); } } Here, the result of new Chapter3(), a new instance of Chapter3, will be captured for the method reference to its print method and a Consumer&lt;String&gt; invoking the method on that instance can be constructed.
type: Answer
answers question: http://stackoverflow.com/q/26168806
upvote count: 24
score: 24

http://stackoverflow.com/comment/40948103
comment on: http://stackoverflow.com/q/26125454
type: Comment
type: QuestionComment
has text: I say again: That answer didn't work for me! Maybe the null value is caused by another problems. I need help. You can change the title of my question for "custom names" instead "begin with a dot", I do not care, but I need new answers and comments to help me. Please, reopen it.
score: 0

http://stackoverflow.com/q/26107921
tagged with: interface
possible better answer: http://stackoverflow.com/a/48200887
has answer: http://stackoverflow.com/a/48200887
has answer: http://stackoverflow.com/a/26108171
has comment: http://stackoverflow.com/comment/40915485
type: AnsweredQuestion
downvote count: 2
accepted answer: http://stackoverflow.com/a/26108031
has title: What determines ascending or descending order in Comparator / Comparable collection class?
tagged with: collections
type: Question
upvote count: 37
has comment: http://stackoverflow.com/comment/40915507
tagged with: java
tagged with: comparable
has comment: http://stackoverflow.com/comment/40915619
has comment: http://stackoverflow.com/comment/40915578
tagged with: sorting
has comment: http://stackoverflow.com/comment/40915429
has body: I understand we can sort or order the objects, stored in Collection as per our requirement(s). While I get deep understanding, I am not convinced by the fact that ascending and descending order of arrangement is achieved by (a - b) ->ascending or (b - a) -> descending where "a" and "b" are class members we chose to compare. Example: public int compareTo(Student s) { return this.grade - s.grade; //ascending order // return s.grade - this.grade; // descending order } What is logic behind ordering object elements? how "(this.grade - s.grade)" if positive 1 moves "this.grade" front and puts "s.grade" next in order, why not other way around? Who validates the compare result (+1, -1, 0) and then puts in ascending order or descending order respectively, is there any documentation that describes internal working of this part? public class Student implements Comparable &lt;Student&gt;{ String name; int grade; public Student(String name, int grade) { this.name = name; this.grade = grade; } public int compareTo(Student s) { return this.grade - s.grade; //ascending order // return s.grade - this.grade; // descending order } public String toString() { return this.name + ", " + this.grade; } } Please share, thank you much! Edit: I get the Java docs, my question is this: sort these grades (13, 2) Case ascending -&gt; return this.grade - s.grade; picture in my mind: compare (13, 2) , (13 - 2) &gt; 0 so move 2 to front. result -&gt; 2, 13 ------ Case descending -&gt; return s.grade - this.grade; picture in my mind: compare (2, 13) , (2 - 13) &lt; 0 so move 13 to front. result -&gt; 13, 2 "How does this happen?" was my original question. I read the docs, still couldn't figure out.
has answer: http://stackoverflow.com/a/26108031
favorite count: 0
score: 35
answer count: 3

http://stackoverflow.com/comment/40831411
type: QuestionComment
comment on: http://stackoverflow.com/q/26061664
has text: No, `javac` version 1.6.0_65 does not reproduce your report.
score: 0
type: Comment

http://stackoverflow.com/a/26161931
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26161930
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26161930
has body: The warning says that an anonymous inner class (within MyServlet class) must implement serialization. My servlet class contains only one anonymous inner class and it implements Serializable and have a serialVersionUID: public class MyServlet extends VaadinServlet implements SessionInitListener { //... @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(new BootstrapListener() { private static final long serialVersionUID = 1L; @Override public void modifyBootstrapPage(BootstrapPageResponse response) { //... } @Override public void modifyBootstrapFragment(BootstrapFragmentResponse response) { //... } }); } } After a little research I found the solution: NotSerializableException on anonymous class So we have to change the anonymous inner class to a static nested class: public class MyServlet extends VaadinServlet implements SessionInitListener { //... @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(new MyBootstrapListener()); } private static class MyBootstrapListener implements BootstrapListener { private static final long serialVersionUID = 1L; @Override public void modifyBootstrapPage(BootstrapPageResponse response) { //... } @Override public void modifyBootstrapFragment(BootstrapFragmentResponse response) { //... } }); } Or if we don't want multiple objects after deserialization: public class MyServlet extends VaadinServlet implements SessionInitListener { //... @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addBootstrapListener(MyBootstrapListener.INSTANCE); } private static class MyBootstrapListener implements BootstrapListener { private static final long serialVersionUID = 1L; private static final MyBootstrapListener INSTANCE = new MyBootstrapListener(); @Override public void modifyBootstrapPage(BootstrapPageResponse response) { //... } @Override public void mod…
type: Answer

http://stackoverflow.com/q/26128826
score: 3
upvote count: 3
tagged with: java
tagged with: authentication
type: Question
has answer: http://stackoverflow.com/a/31676905
downvote count: 0
tagged with: spring-security
has title: Using Java config with Spring Security for annotation-based role checks and Basic HTTP Auth
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to accomplish annotation-based (using @PreAuthorize) permission checking on one of my controllers. I'm using Java config, and have a SecurityConfig class extending WebSecurityConfigurerAdapter. I'm also using Basic HTTP Authentication to get to the methods that require authorization. But - the problem is, I don't want the SecurityConfig determining which methods require authentication using an antPattern() or similar. That's what the annotations are for! How can I configure my SecurityConfig class so that it properly uses HTTP Basic authentication and the configured AuthenticationManager for methods with @PreAuthorize, and allows anonymous access to controller methods that do not have any security annotations attached? When I try this (Attempt #1): @Configuration @EnableWebSecurity @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().authenticated().and().httpBasic(); } @Autowired public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("craig").password("craigpass").roles("USER"); } } My unprotected methods fail with: Full authentication is required to access this resource And my protected (but properly-authenticating) tests fail with: Error: Expected CSRF token not found. Has your session expired? When I try this (Attempt #2): @Configuration @EnableWebSecurity @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("craig").password("craigpass").roles("USER"); } } My unprotected methods fail with a 302 status code, and redirect to /login, and my protected/authenticating methods fail wit…
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/a/26119193
has comment: http://stackoverflow.com/comment/67207930
has comment: http://stackoverflow.com/comment/67199287
has comment: http://stackoverflow.com/comment/67199190
has comment: http://stackoverflow.com/comment/67199862
has body: You can use the following code to get a long value (milliseconds since January 1, 1970, 00:00:00 GMT) from a String date with the format "dd/mm/yyyy". try { String dateString = "30/09/2014"; SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = sdf.parse(dateString); long startDate = date.getTime(); } catch (ParseException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/67199970
score: 37
has comment: http://stackoverflow.com/comment/67207482
upvote count: 37
accepted answer of: http://stackoverflow.com/q/26119072
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26119072
type: Answer
has comment: http://stackoverflow.com/comment/67199664

http://stackoverflow.com/a/26159168
downvote count: 0
has body: Try this: public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) and add: import android.support.annotation.NoNNull; Look also: Meaning of Android Studio error: Not annotated parameter overrides @NotNull parameter Next time post the code directly as text.
score: 1
has comment: http://stackoverflow.com/comment/41008836
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26159115
answers question: http://stackoverflow.com/q/26159115
type: Answer
has comment: http://stackoverflow.com/comment/41008645

http://stackoverflow.com/q/26036813
score: 0
linked to: http://stackoverflow.com/q/513832
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26036881
tagged with: string-matching
tagged with: java
has body: I was trying to compare a user input with a predefined string. But it did not show my expected result. Here is the code import java.util.Scanner; public class StringMatching { public static void main(String[] args) { Scanner scannerObj=new Scanner(System.in); String userinput=scannerObj.nextLine(); System.out.println(userinput); System.out.println(userinput); if(userinput=="yes") { System.out.println("Yes! Working.."); } else { System.out.println("Not Working.."); } } } The output of this program shows Not Working. I don't know what I missed here. Looking for your kind support. Regards
duplicate of: http://stackoverflow.com/q/513832
has title: Is nextLine method in java.util.Scanner package take string from user?
type: Question
answer count: 1

http://stackoverflow.com/a/26057094
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26055611
has comment: http://stackoverflow.com/comment/40825187
score: 1
has body: It works for me: import java.awt.event.*; import javax.swing.*; class TestKeyCode implements KeyListener { public void keyPressed(KeyEvent e) { System.out.println("keyPressed(KeyEvent e)"); int code= e.getKeyCode(); System.out.println("code = " + code); } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public static void main(String[] args) { JFrame jf = new JFrame(); jf.setSize(800, 800); TestKeyCode tkc = new TestKeyCode(); jf.addKeyListener(tkc); jf.setVisible(true); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26055611

http://stackoverflow.com/q/26134086
tagged with: java
type: UnansweredQuestion
tagged with: servlets
has body: I'm using Tomcat as the application server, and have 4 web applications running on it. Due to some common requirements across the web applications, I have developed a library which is put in Tomcat's lib folder for sharing the implementation to the web applications. However, I want to implement some resource management features on the library, such as to create and manage singleton resources to each of the web applications (that is, one web application gets one singleton resource). What I suppose to do so is to manage a ConcurrentHashMap and stores each of the singleton resources in it. However, when a web application calls the library for accessing its resource, I need to get the name of the web application which the caller belongs to so I can return the right resource to the caller. Is there a good way to implement things like this (ways that the application don't need to pass parameters or identifications while calling the library to get resource is preferred)? Or it's just a wrong way to think like this, and there is a better solution? Many thanks!
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/26137045
has title: Is there a way to get the name of web application without using Servlet features?

http://stackoverflow.com/comment/40917142
has text: I am using RubyMotion, see: http://www.rubymotion.com/developer-center/api/Thread.html After using your answer I am still getting the error: java.lang.NoSuchMethodError: no method with name='<init>' signature='()V' in class Lcom/rubymotion/Thread;
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26105315

http://stackoverflow.com/comment/40952558
type: Comment
comment on: http://stackoverflow.com/q/26128352
score: 0
has text: Explain your thinking. It's not clear you understand what needs to be done. It looks like you believe that you only need to look two numbers ahead, but you're not even doing that.
type: QuestionComment

http://stackoverflow.com/comment/40857083
type: Comment
comment on: http://stackoverflow.com/a/26074305
has text: Thanks for understanding ! Let put the question in a different way : you have class A - class A { public void doStuff() throws SQLException { } } and class B extends A - class B extends A { public void doStuff() throws Exception { } } It will throw exception during compilation because of violation of the method's contract. Assume that the Java would allows this then what would be the consequences ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26136281
accepted answer of: http://stackoverflow.com/q/26123961
has comment: http://stackoverflow.com/comment/40977578
answers question: http://stackoverflow.com/q/26123961
has comment: http://stackoverflow.com/comment/40968014
has body: Maybe you should have a look to the @Configurable annotation : http://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/aop.html#aop-atconfigurable Then to inject a value, use @Value, example : @Value("${some.property:defaultvalue}") The primitive exclusion doesn't seem to affect the @Value annotation. "it is preferable to specify explicit, annotation-driven dependency injection for your @Configurable beans by using @Autowired or @Inject at the field or method level" And @Autowired and @Value are processed by the same beanpostprocessor (http://grepcode.com/file/repository.springsource.com/org.springframework/org.springframework.beans/3.2.3/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java)
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/40974196
type: Answer

http://stackoverflow.com/comment/41067303
score: 2
has text: Maybe easier then to: Each JVM gets assigned a unique number (in config or something) Then, each JVM generated a random number, with their assigned number pre-pended. Eliminated the centralized server, queue, observer, etc.
comment on: http://stackoverflow.com/q/26190097
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40870810
score: 0
type: Comment
has text: @user889742, that seems to imply that `x = "a"; y = "a";` would result in `(x == y) == false` which isn't true.
comment on: http://stackoverflow.com/a/26083393
type: AnswerComment

http://stackoverflow.com/a/26360083
accepted answer of: http://stackoverflow.com/q/26134827
type: Answer
downvote count: 2
answers question: http://stackoverflow.com/q/26134827
upvote count: 1
has body: I was able to trace the root cause of it and fixed this issue. The method that I declared as @Cacheable, has some local calls, means one mehtod in the same service class was calling it. When I removed the call from local class then it worked fine. This may be useful for others. Thanks, Dev
has comment: http://stackoverflow.com/comment/99875984
score: -1
type: AcceptedAnswer

http://stackoverflow.com/comment/41051434
type: Comment
comment on: http://stackoverflow.com/a/26181782
has text: Do you mean this `onTick(long millisUntilFinished)`?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26081060
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/8962700
has comment: http://stackoverflow.com/comment/40866401
downvote count: 0
linked to: http://stackoverflow.com/q/15228742
has comment: http://stackoverflow.com/comment/40866349
has title: Is there a way to create an AND/OR/ETC. Boolean statement that is comparing with the same value without redefining the value?
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: The Question is this: Is there any way to create a AND/OR/ETC. Boolean Statement that shares the same value (EX. (1 == 0 || 1 == -1 || 1 == 2 || 1 == 31)) without having to specify that value(1) each time?
score: 1

http://stackoverflow.com/comment/66602155
comment on: http://stackoverflow.com/q/26142063
type: Comment
type: QuestionComment
has text: I get the feeling there may be a fundamental misunderstanding. In order to create any future you _must_ have an ExecutionContext available. ExecutionContexts can be implemented many ways, and creating one from an executor is common. So I am curious what you mean by "building the futures by hand, without an executor service". Do you mean using **scala.concurrent.ExecutionContext.Implicits.global** as your EC? For the record, I think the default for global is a ThreadPool Executor that has one Thread per core of your processor.
score: 0

http://stackoverflow.com/a/26235603
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41368763
answers question: http://stackoverflow.com/q/26165776
has body: In your client code you should probably keep the connectedThread object alive a while longer. Might be that once the if clause closes and it goes out of scope (not quite sure what happens with GC and all) the write just doesn't happen and your connection is not closed but not used either. Calling flush() on the mmOutStream inside the connectedThread after the write might help also. Like @EJP suggested, you should put something inside your read loop. Edit: For the sake of debugging you could add this.wait(1000); immediately after your write in the client code.
has comment: http://stackoverflow.com/comment/41325773
type: Answer

http://stackoverflow.com/comment/41057366
type: AnswerComment
comment on: http://stackoverflow.com/a/26177481
has text: timerExec() as well as asyncExec use facilities ofthe respective window system. Is is important for your use case to have an exact interal? How did you measure the time interval? Does the 'background thread varian' give better results?
type: Comment
score: 0

http://stackoverflow.com/a/26091006
type: Answer
answers question: http://stackoverflow.com/q/26090986
has body: You have a loop condition x that you never change: While (x != 0){ // loop code } However, loop code doesn´t change the x value.
score: 0

http://stackoverflow.com/comment/41050856
has text: yeah... it may because of the do while loop so time exceeds and the if loop you wrote is repeated every second ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26180393
score: 0
type: Comment

http://stackoverflow.com/q/26163667
has comment: http://stackoverflow.com/comment/41046638
type: AnsweredQuestion
tagged with: java
has title: How to limit a Trident DRPC result to contain the fields of only the last function of the topology?
has answer: http://stackoverflow.com/a/26181523
tagged with: apache-storm
type: Question
tagged with: trident
score: 0
has comment: http://stackoverflow.com/comment/41047475
answer count: 1
accepted answer: http://stackoverflow.com/a/26181523
has body: I've got a simple Trident Topology running in a LocalDRPC where one of the functions outputs the result field, but when I run it the results I get back seem to be all the information from every tuple, instead of just the result field as I would have expected given the DRPC docs. Eg: [["http:\/\/www.smbc-comics.com\/rss.php",http://www.smbc-comics.com/rss.php,[#document: null],[item: null],[link: null],[description: null],http://feedproxy.google.com/~r/smbc-comics/PvLb/~3/CBpJmAiJSxs/index.php,http://www.smbc-comics.com/comics/20141001.png,"http:\/\/www.smbc-comics.com\/comics\/20141001.png"], ...] It would be okay to get all the information from every tuple back, but there's no indication of which of the fields is called result. As it stands it's not even valid JSON! So how can I extract the value that corresponds to a specific field that I specified in the topology?

http://stackoverflow.com/comment/40784228
score: 0
type: Comment
has text: Also, why did you say its a `Map`? The Op has already said its a `Group` object.
type: AnswerComment
comment on: http://stackoverflow.com/a/26036510

http://stackoverflow.com/q/26180414
has body: I invoke my custom Monitor registered on the Weblogic MBeanServer, but weblogic give me the updated value only after 15 seconds. Does Weblogic cache call?
upvote count: 2
has answer: http://stackoverflow.com/a/26181165
tagged with: jmx
has title: Weblogic MBeanServer provides the value only after 15 secs
answer count: 1
tagged with: weblogic
tagged with: java
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/40918835
type: Comment
has text: @BradLarson these comments could do with _more_ cleanup - it's mostly nonsense.
comment on: http://stackoverflow.com/q/26105157
score: 0
type: QuestionComment

java-8
tags question: http://stackoverflow.com/q/26106613
tags question: http://stackoverflow.com/q/26054363
tags question: http://stackoverflow.com/q/26155174
tags question: http://stackoverflow.com/q/26170264
tags question: http://stackoverflow.com/q/26118090
tags question: http://stackoverflow.com/q/26064689
tags question: http://stackoverflow.com/q/26073723
tags question: http://stackoverflow.com/q/26142864
tags question: http://stackoverflow.com/q/26049187
tags question: http://stackoverflow.com/q/26165644
tags question: http://stackoverflow.com/q/26119099
tags question: http://stackoverflow.com/q/26178610
tags question: http://stackoverflow.com/q/26116411
tags question: http://stackoverflow.com/q/26058573
tags question: http://stackoverflow.com/q/26161705
tags question: http://stackoverflow.com/q/26167294
tags question: http://stackoverflow.com/q/26186767
tags question: http://stackoverflow.com/q/26169008
tags question: http://stackoverflow.com/q/26153180
tags question: http://stackoverflow.com/q/26091682
tags question: http://stackoverflow.com/q/26191773
tags question: http://stackoverflow.com/q/26180083
tags question: http://stackoverflow.com/q/26166281
tags question: http://stackoverflow.com/q/26147712
tags question: http://stackoverflow.com/q/26152692
tags question: http://stackoverflow.com/q/26179001
tags question: http://stackoverflow.com/q/26041012
tags question: http://stackoverflow.com/q/26102115
tags question: http://stackoverflow.com/q/26162407
tags question: http://stackoverflow.com/q/26052956
tags question: http://stackoverflow.com/q/26163645
tags question: http://stackoverflow.com/q/26050530
tags question: http://stackoverflow.com/q/26086538
tags question: http://stackoverflow.com/q/26168806
tag name: java-8
tags question: http://stackoverflow.com/q/26174818
tags question: http://stackoverflow.com/q/26094200
tags question: http://stackoverflow.com/q/26129564
type: Tag
tags question: http://stackoverflow.com/q/26157543
tags question: http://stackoverflow.com/q/26172555
tags question: http://stackoverflow.com/q/26105928

http://stackoverflow.com/q/26067292
score: 0
type: UnansweredQuestion
tagged with: annotations
has answer: http://stackoverflow.com/a/26068563
has title: Custom Spring Security using annotation: REST api to pass in username password instead of login dialog box
tagged with: java
tagged with: spring-java-config
type: Question
answer count: 2
has body: I am trying to secure my REST based application using Spring Security using no XML. This is what I have so far - -- AppConfig.java import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration @ComponentScan("com.trans.*") @EnableWebMvc @Import({SecurityConfig.class}) public class AppConfig { } -- WebAppInitializer.java -- import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[] { AppConfig.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return null; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } } -- SecurityConfig.java -- import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("john").password("123456").roles("USER"); auth.inMemoryAuthentication().withUser("admin").password("123456").roles("ADMIN"); auth.inMemoryAuthentication().withUser("dba").password("123456").roles("DBA"); } @Override protected void configure(HttpS…
tagged with: spring-security
tagged with: rest
has answer: http://stackoverflow.com/a/26068626

http://stackoverflow.com/q/26131832
favorite count: 0
has body: Everytime I change Item background color when I scroll random items change the background color too, and I don't know why. Another thing that happen is that if the item isn't displayed in the screen it doesn't change the bg color. Here is my code: public class MyActivity extends ListActivity { char[] items = { 'e', 'f', 'f', 'f', 'e', 'f', 'e', 'e', 'f', 'f', 'e', 'e', 'f', 'f', 'f', 'e', 'e', 'f', 'f', 'e', 'e', 'f', 'f', 'f', 'e', 'e', 'f', 'f', 'e', 'e', 'f', 'f', 'f', 'e', 'e', 'f', 'f', 'p', 'e', 'e', 'p', 'f', 'f', 'f', 'e', 'e', 'a', 'f', 'p', 'f', 'e', 'e', 'f', 'f', 'p', 'f', 'e', 'a', 'e', 'p', 'f', 'f', 'e', 'p', 'e', 'f', 'f', 'f', 'a', 'p', 'e', 'e', 'p', 'f', 'f', 'e', 'p', 'e', 'f', 'p', 'f', 'e', 'f', 'e', 'f' }; int[] horas = {00, 01, 03, 04, 04, 05, 05, 05, 06, 06, 06, 06, 07, 07, 07, 07, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23,}; int[] minutos = {20, 00, 00, 00, 30, 10, 25, 40, 10, 20, 40, 50, 00, 10, 30, 50, 00, 20, 40, 00, 10, 20, 30, 50, 10, 20, 40, 00, 20, 30, 40, 50, 10, 30, 40, 10, 20, 30, 40, 50, 00, 00, 10, 30, 50, 00, 10, 20, 30, 40, 00, 10, 30, 50, 50, 00, 10, 20, 20, 30, 40, 00, 20, 30, 30, 50, 10, 20, 20, 30, 30, 40, 50, 00, 20, 40, 50, 50, 10, 15, 30, 00, 40, 10, 50}; String[] total = new String[horas.length]; // declare class variables private ArrayList<Item> m_parts = new ArrayList<Item>(); private Runnable viewParts; private ItemAdapter m_adapter; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); for (int i = 0; i < items.length; i++) { total[i] = String.format("%02d",horas[i]) + ":" + String.format("%02d",minutos[i]); } int cuantos_f = cuantosF('f'); // instantiate our ItemAdapter class…
has answer: http://stackoverflow.com/a/26133428
tagged with: android
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40959908
has title: Everytime that I change Item background color when I scroll randoms items change the background color too
tagged with: listview
has comment: http://stackoverflow.com/comment/40958708
answer count: 1
has comment: http://stackoverflow.com/comment/40958976
downvote count: 0
linked to: http://stackoverflow.com/q/25436483

integration-testing
tags question: http://stackoverflow.com/q/26182345
tags question: http://stackoverflow.com/q/26173289
tag name: integration-testing
tags question: http://stackoverflow.com/q/26192418
tags question: http://stackoverflow.com/q/26147205
type: Tag

http://stackoverflow.com/comment/40872802
type: QuestionComment
score: 1
has text: The contents of `displayMessage()` look *very* strange. What is that function supposed to do?!
type: Comment
comment on: http://stackoverflow.com/q/26084654

http://stackoverflow.com/q/26095104
accepted answer: http://stackoverflow.com/a/26095173
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26095173
has title: Adding table rows to a table layout in a loop
possible better answer: http://stackoverflow.com/a/26095170
answer count: 3
has answer: http://stackoverflow.com/a/26095184
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/26095170
has body: I have written this code which tries to add Table Rows (which contain Text Views) inside a Table Layout. This is done in a loop. I get this error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.testant/com.test.testant.products}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. Can I somehow override the removeView() on parent? If I can't how can the removeView() be incorporated inside my code? products.java public class products extends Activity{ private DataBaseManager dataBase; //put the table name and column in constants public static final String TABLE_NAME_PRODUCTS = "products"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.products); TableLayout tl = (TableLayout) findViewById(R.id.prodTable); TableRow tr = (TableRow) findViewById(R.id.prodRow); //creates and open the database so we can use it dataBase = DataBaseManager.instance(); Cursor cursor = dataBase.select("SELECT * FROM " + TABLE_NAME_PRODUCTS); while (cursor.moveToNext()){ tl.addView(tr); } } products.xml &lt;TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/prodTable"&gt; &lt;TableRow android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="false" android:id="@+id/prodRow"&gt; &lt;TextView android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight=".08" android:textColor="#fff" android:id="@+id/prodCodeView" android:clickable="true" /&gt; &lt;TextView android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight=".30" android:textColor="#fff" android:id="@+id/prodNameView" android:clickable="true" /&gt; &lt;TextView android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight=".05" android:textColor="#fff" android:id="@+id/prodMUView"…

http://stackoverflow.com/a/26046341
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26045184
has comment: http://stackoverflow.com/comment/40803099
has body: I'll leave it to the reader to figure out if, how and why this works :) String message = ""; int n = 8; int s = (int) Math.round((n + 1) * (n * 0.5)); int j = 0, l = 1; for (int i=0; i &lt; s; ++i) { int k = Integer.signum(j - i) ^ 1; message += "*\n".charAt(k); l += k; j += (l * k); }
score: 1

http://stackoverflow.com/q/26068508
downvote count: 6
upvote count: 1
has comment: http://stackoverflow.com/comment/40843394
accepted answer: http://stackoverflow.com/a/26068558
type: AnsweredQuestion
tagged with: java
has title: Generics are not supported?
type: Question
answer count: 1
has body: I have the following code: Map&lt;String, String&gt; prefMap = new HashMap&lt;String, String&gt;(); prefMap.put("ns2", "http://service.fr/myservice1"); prefMap.put("ns3", "http://service.fr/myservice2"); And when I compile it I get the error: generics are not supported in -source 1.3
favorite count: 0
has answer: http://stackoverflow.com/a/26068558
score: -5
has comment: http://stackoverflow.com/comment/40843373
has comment: http://stackoverflow.com/comment/40843360

http://stackoverflow.com/q/26089727
has comment: http://stackoverflow.com/comment/40882579
has comment: http://stackoverflow.com/comment/40882301
has title: How to separate a string of numbers entered in a loop?
has answer: http://stackoverflow.com/a/26089782
score: -1
has comment: http://stackoverflow.com/comment/40882281
answer count: 3
downvote count: 1
has body: I need help pulling the numbers out and separating them by commas, for example, if I enter 1 2 3 4 5, it should print out Entered Numbers: 1, 2, 3, 4, 5 The Sum: 15 instead I get this Entered Numbers: 12345 The Sum: 15 Code: /*A program that prompts the user to enter a positive integer number. The program should accept integers until the user enters the value -1 (negative one). After the user enters -1, the program should display the entered numbers followed by their sum*/ import java.util.Scanner; public class InputSum { public static void main(String [] args) { //create a way to receive user input Scanner input = new Scanner(System.in); //Variables int sum = 0; String value; //Input System.out.println("Enter a positive integer (Enter -1 to quit): "); value = input.nextLine(); String x = ""; //Loop Statements while (Integer.parseInt(value) != -1) { sum = Integer.parseInt(value) + sum; x = x + value; value = input.nextLine(); } //Output System.out.println("Entered Numbers: " + x); System.out.println("The sum: " + sum); } }
has comment: http://stackoverflow.com/comment/40882180
favorite count: 0
has answer: http://stackoverflow.com/a/26089815
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26089851
upvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/26128352
has comment: http://stackoverflow.com/comment/40952495
has body: I have a method to check if a number is prime or not. I need to write a program that will allow a user to input a number and the program will then display the next largest prime number. Here's what I have so far... Its very brutal because I am a beginning CS student who gets the material but cannot exactly implement code in the ways that I want. package nextprime; import java.util.Scanner; public class NextPrime { public static boolean isPrime(int number) { for (int divisor = 2; divisor &lt;= number / 2; divisor++) { if (number % divisor == 0) { return false; } } return true; } public static void main(String[] args) { Scanner input = new Scanner(System.in); int numberInput; System.out.println("Enter a number: "); numberInput = input.nextInt(); int end = numberInput + 2; if (isPrime(end)) { System.out.println(end); } int i; for (i = numberInput; i &lt; end; i++) { } if (isPrime(i)) { System.out.println(i); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40952518
has answer: http://stackoverflow.com/a/26129911
has comment: http://stackoverflow.com/comment/40952595
tagged with: user-input
has comment: http://stackoverflow.com/comment/40952558
has answer: http://stackoverflow.com/a/39559438
has title: Next Prime Number based on User Input
tagged with: numbers
has comment: http://stackoverflow.com/comment/40952311
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40952850
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40952429
has answer: http://stackoverflow.com/a/26128662
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/40952868
favorite count: 0

http://stackoverflow.com/q/26145174
has comment: http://stackoverflow.com/comment/40983181
has comment: http://stackoverflow.com/comment/40985595
linked to: http://stackoverflow.com/q/8858584
has comment: http://stackoverflow.com/comment/40985271
has comment: http://stackoverflow.com/comment/40985358
tagged with: java
has comment: http://stackoverflow.com/comment/40985412
type: Question
has body: I am having trouble getting my console/Terminal output to resemble my GUI output in JTEXTAREA. I am expecting the data to appear on multiple lines but it isn't. Can someone take a look and offer an opinion, solution, to my code problem. Thanks! import java.io.*; import java.util.Arrays; import java.io.FileReader; import java.io.PrintWriter; import java.util.Arrays; import javax.swing.*; public class RecurringGrowthCells { public static void main(String[] args) { JFrame frame = new JFrame("Recurring Bacterial Growth Data"); JTextArea textArea = new JTextArea(); int[] Growth_numbers1 = new int[73]; String text = ""; try{ BufferedReader reader1 = new BufferedReader(new FileReader("col1.csv")); for (int i = 0; i &lt; 73; i++ ) //Growth { Growth_numbers1[i] = 0; } String Growth_nums = ""; while(Growth_nums!=null) { Growth_nums = reader1.readLine(); String[] pieces1 = Growth_nums.split(","); for (int j = 1; j &lt;= 1; j++) { int IncrementNumber1 = Integer.parseInt(pieces1[j]); Growth_numbers1[IncrementNumber1]++; } text = text + Growth_nums + Growth_numbers1 + "\n"; //For Loop is for console output.... Not GUI for (int i = 1; i &lt; 73; i++) { show_text(i, Growth_numbers1); } } } catch(Exception ex){ ex.printStackTrace(); System.out.println("Why is this exception being thrown."); } textArea.setText(text); frame.add(new JScrollPane(textArea)); frame.setSize(500, 800); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static int[] show_text(int i, int[] Growth_numbers1) { System.out.printf("%-10s\n", new Object[]{ i + ": " + Growth_numbers1[i] }); return Growth_numbers1; } } Here is a sample of col1.csv showing the date and test number. 6/17/14 18 6/18/14 18 6/19/14 18 6/20/14 18 6/21/14 18 6/22/14 1 6/23/14 2 6/24/14 9 6/25/14 2 I expect the output to appear like this: 1: 4 2: 10 3: 4 4: 4 5: 6 6: 1 7: 2 8: 5 9: 4 10: 3 11: 3 12: 1 13: 2 But instead of appearing on multiple lines as I expect, it all ge…
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/40983941
has comment: http://stackoverflow.com/comment/40985213
score: 0
has comment: http://stackoverflow.com/comment/40984400
has comment: http://stackoverflow.com/comment/40983556
has comment: http://stackoverflow.com/comment/40984156
has title: Trouble getting my console output in TextArea, I am expecting the data to appear on multiple lines but it isn't
has comment: http://stackoverflow.com/comment/40984470
has comment: http://stackoverflow.com/comment/40984976
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40985242
tagged with: file

http://stackoverflow.com/q/26067617
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26067663
tagged with: if-statement
score: -1
accepted answer: http://stackoverflow.com/a/26067663
answer count: 1
tagged with: calculator
favorite count: 0
has title: Java tip calculator
has body: Basically I just need help with a tip calculator program. It should ask how many customers there are, the tip percentage to be used, the bill amount of each customer, the tip amount, and the tip amount distributed evenly to each customer. I'm also trying to get the program to read in as many customers as the user wants to input for bonus to the homework. Here is the code, instead of the program returning "Please enter their bill amount" i keep getting "Is there another customer? y or n?". That is the main problem i'm having. Excuse the bad structuring, i'm basically a complete beginner. import java.util.Scanner; public class H3_TipCalc { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.println("Please enter your bill amount."); double bill = input.nextDouble(); { String multiplecust = ("Y"); //int mc = 1; while (multiplecust.equalsIgnoreCase("y")) { Scanner usrin = new Scanner (System.in); System.out.println("Is there another customer? y or n?"); multiplecust = usrin.nextLine(); //mc++; if (usrin.equals("y")) { System.out.println("Please enter their bill amount."); } } } } }
tagged with: java
downvote count: 2
upvote count: 1
type: Question

http://stackoverflow.com/comment/40869869
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26078373
has text: Obviously i'm not using log4j in Apache but I need to change apache logging path to my custom path (the same as log4j).
score: 0

http://stackoverflow.com/comment/40865378
type: QuestionComment
comment on: http://stackoverflow.com/q/26078385
type: Comment
has text: _"So in my application I am using the code:"_ - Why are you using it if you don't know what it does?
score: 0

http://stackoverflow.com/q/26037218
tagged with: ssh
tagged with: spring
has comment: http://stackoverflow.com/comment/40785380
has answer: http://stackoverflow.com/a/26044863
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40795547
answer count: 1
tagged with: spring-cloud
has title: Cannot make a maven build of spring-cloud-config
has body: I'm trying to make a maven build of spring-cloud-config. All the tests in JGitEnvironmentRepositoryTests class are failing with the following exception stack trace: java.lang.IllegalStateException: Cannot clone repository . . Caused by: org.eclipse.jgit.api.errors.TransportException: juancarlos@localhost:/Users/juancarlos/Documents/eclipse/spring-cloud-config/spring-cloud-config-server/target/test-classes/config-repo: Connection refused My SSH keys are properly configured in .ssh folder, as I've tested them with github and worked properly.
type: UnansweredQuestion

classpath
tags question: http://stackoverflow.com/q/26041510
tags question: http://stackoverflow.com/q/26169595
tags question: http://stackoverflow.com/q/26068128
tags question: http://stackoverflow.com/q/26145601
tags question: http://stackoverflow.com/q/26191144
tags question: http://stackoverflow.com/q/26116028
tags question: http://stackoverflow.com/q/26072411
tags question: http://stackoverflow.com/q/26130264
tags question: http://stackoverflow.com/q/26128278
type: Tag
tags question: http://stackoverflow.com/q/26135306
tags question: http://stackoverflow.com/q/26160862
tags question: http://stackoverflow.com/q/26045312
tag name: classpath

http://stackoverflow.com/comment/40921661
has text: Ah, it continues to cycle to the last tile and returns that one.
type: QuestionComment
comment on: http://stackoverflow.com/q/26108352
score: 0
type: Comment

http://stackoverflow.com/comment/44548162
type: AnswerComment
comment on: http://stackoverflow.com/a/28084905
type: Comment
has text: See the documentation of [`PreparedStatement.setTimestamp`](http://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html#setTimestamp-int-java.sql.Timestamp-java.util.Calendar-) and [`ResultSet.getTimestamp`](http://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html#getTimestamp-int-java.util.Calendar-)
score: 0

arrays
tags question: http://stackoverflow.com/q/26132112
tags question: http://stackoverflow.com/q/26136113
tags question: http://stackoverflow.com/q/26080493
tags question: http://stackoverflow.com/q/26194290
tags question: http://stackoverflow.com/q/26064595
tags question: http://stackoverflow.com/q/26084412
tags question: http://stackoverflow.com/q/26130238
tags question: http://stackoverflow.com/q/26154715
tags question: http://stackoverflow.com/q/26089679
tags question: http://stackoverflow.com/q/26077697
tags question: http://stackoverflow.com/q/26149182
type: Tag
tags question: http://stackoverflow.com/q/26059244
tags question: http://stackoverflow.com/q/26185393
tags question: http://stackoverflow.com/q/26126423
tags question: http://stackoverflow.com/q/26067017
tags question: http://stackoverflow.com/q/26114025
tags question: http://stackoverflow.com/q/26173878
tags question: http://stackoverflow.com/q/26135900
tags question: http://stackoverflow.com/q/26101934
tags question: http://stackoverflow.com/q/26121128
tags question: http://stackoverflow.com/q/26187855
tags question: http://stackoverflow.com/q/26193336
tags question: http://stackoverflow.com/q/26121246
tags question: http://stackoverflow.com/q/26156297
tags question: http://stackoverflow.com/q/26071073
tags question: http://stackoverflow.com/q/26131798
tags question: http://stackoverflow.com/q/26126353
tags question: http://stackoverflow.com/q/26054363
tags question: http://stackoverflow.com/q/26042139
tags question: http://stackoverflow.com/q/26126863
tags question: http://stackoverflow.com/q/26187046
tags question: http://stackoverflow.com/q/26057148
tags question: http://stackoverflow.com/q/26079550
tags question: http://stackoverflow.com/q/26173073
tags question: http://stackoverflow.com/q/26125033
tags question: http://stackoverflow.com/q/26168846
tags question: http://stackoverflow.com/q/26161447
tags question: http://stackoverflow.com/q/26080818
tags question: http://stackoverflow.com/q/26185728
tags question: http://stackoverflow.com/q/26123520
tags question: http://stackoverflow.com/q/26080756
tags question: http://stackoverflow.com/q/26168798
tags question: http://stackoverflow.com/q/26165956
tags question: http://stackoverflow.com/q/26072520
tags question: http://stackoverflow.com/q/26172378
tags question: http://stackoverflow.com/q/26179173
tags question: http://stackoverflow.com/q/26114505
tags question: http://stackoverflow.com/q/26157055
tags question: http://stackoverflow.com/q/26149244
tags question: http://stackoverflow.com/q/26153180
tags question: http://stackoverflow.com/q/26172161
tags question: http://stackoverflow.com/q/26107220
tags question: http://stackoverflow.com/q/26080769
tags question: http://stackoverflow.com/q/26177093
tags question: http://stackoverflow.com/q/26145429
tags question: http://stackoverflow.com/q/26133031
tags question: http://stackoverflow.com/q/26049953
tags question: http://stackoverflow.com/q/26098861
tags question: http://stackoverflow.com/q/26091233
tags question: http://stackoverflow.com/q/26101990
tags question: http://stackoverflow.com/q/26159011
tags question: http://stackoverflow.com/q/26174493
tags question: http://stackoverflow.com/q/26047585
tags question: http://stackoverflow.com/q/26093386
tags question: http://stackoverflow.com/q/26148018
tags question: http://stackoverflow.com/q/26122975
tags question: http://stackoverflow.com/q/26147928
tags question: http://stackoverflow.com/q/26173639
tags question: http://stackoverflow.com/q/26106664
tags question: http://stackoverflow.com/q/26192332
tags question: http://stackoverflow.com/q/26070492
tags question: http://stackoverflow.com/q/26090262
tags question: http://stackoverflow.com/q/26094013
tags question: http://stackoverflow.com/q/26107340
tags question: http://stackoverflow.com/q/26146502
tags question: http://stackoverflow.com/q/26127128
tags question: http://stackoverflow.com/q/26081151
tags question: http://stackoverflow.com/q/26069906
tags question: http://stackoverflow.com/q/26083314

http://stackoverflow.com/comment/41046543
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26179346
has text: you can see more details about the error using eg e.printStackTrace()

http://stackoverflow.com/a/26073335
has body: You need to flip() before write(), and compact() afterwards. NB Looping while read() returns -1 doesn't begin to make sense. It means the peer disconnected, for heaven's sake.
has comment: http://stackoverflow.com/comment/40860502
accepted answer of: http://stackoverflow.com/q/26072926
score: 0
answers question: http://stackoverflow.com/q/26072926
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 1

http://stackoverflow.com/a/26167477
has body: These are not the same kinds of variables: firstName and secondName are method parameters. As soon as the method is over, these variables go out of scope name and surname, on the other hand, are fields in a class. They remain "attached" to the instance of that class for as long as the instance exists. Here is an illustration of what that means: String a = "Hello"; String b = "World"; // For the duration of the constructor, a becomes firstName, // and b becomes secondName Example e = new Example(a, b); // Once the constructor exists, firstName and secondName disappear. // Resetting a and b after the call is no longer relevant a = "Quick brown fox jumps"; b = "over the lazy dog"; System.out.println(e.getName()+" "+e.getSurname()); The valuesof a and b have changed, but the values stored in Example remain set to what you passed to the constructor.
type: Answer
score: 5
answers question: http://stackoverflow.com/q/26167426
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/41287438
type: AnswerComment
has text: Thank you this is exactly the answer I was looking for
comment on: http://stackoverflow.com/a/26288293
score: 0
type: Comment

http://stackoverflow.com/q/26099434
favorite count: 0
has comment: http://stackoverflow.com/comment/40899711
has comment: http://stackoverflow.com/comment/56144233
tagged with: jdbc
has answer: http://stackoverflow.com/a/26099529
downvote count: 0
has comment: http://stackoverflow.com/comment/56141711
type: UnansweredQuestion
has body: I am trying to run Tomcat with web-matrix.war, but I can not. I am look at log file and see exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) .............................................. Caused by: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524) at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493) at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) at java.sql.DriverManager.getDriver(DriverManager.java:262) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) My settings are: /usr/share/apache-tomcat-7.0.55/conf/Catalina/localhost/web-matrix.xml &lt;Context path="/web-matrix" reloadable="true"&gt; &lt;Resource name="jdbc/webmatrix" auth="Container" type="javax.sql.DataSource" username="webmatrix" password="webmatrix" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@spb-fusion02:1521:orcl" /&gt; &lt;/Context&gt; Does anyone help me? I've checked the connection with listener. It's good. [root@spb-fusionwm02 localhost]…
tagged with: tomcat7
has title: How can I resolve the error during starting Tomcat?
tagged with: spring
type: Question
score: 1
tagged with: java
upvote count: 1
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/40835672
has text: Is this something you can reproduce, or that you at least see in testing? Or are you getting these exceptions from a production app? If the latter, it may be that some script kiddies are trying to access the content. And, if this is truly only for within your own app... why are you using a streaming `ContentProvider` in the first place?
score: 0
comment on: http://stackoverflow.com/q/26064379
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40893919
comment on: http://stackoverflow.com/a/26096074
type: AnswerComment
score: 0
type: Comment
has text: However, using this, I will not being creating a new method called "inputBirthday", which is what I am trying to do.

http://stackoverflow.com/comment/40898023
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26098359
has text: I dont think that is valid syntax for your string array. See the answer where 2 lists are used, that is the only way to achieve what you are looking for. Personally, i would use Enums for this.
score: 0

http://stackoverflow.com/q/26107220
has comment: http://stackoverflow.com/comment/40914154
type: UnansweredQuestion
upvote count: 1
tagged with: processing
score: 1
tagged with: java
has body: I'm following a course in programming in the Java-based environment "Processing". One assignment is to write a program that displays 3 buttons (black). When the button is clicked, that button should change to another colour (grey). We are required to use a boolean[] array. My code is as follows: boolean[] button = new boolean[3]; void setup(){ size(300,300); button[0] = false; button[1] = false; button[2] = false; } void draw(){ int x = (width/(button.length+1)); int y = height/2; int ellipseSize = 50; int radius = ellipseSize/2; background(255); noStroke(); fill(0); for(int i = 1; i &lt;= button.length; i++){ ellipse(i*x, y, ellipseSize, ellipseSize); } } //shifting array values upon mouse pressing void mousePressed(){ int x = (width/(button.length+1)); int y = height/2; int ellipseSize = 50; int radius = ellipseSize/2; for(int i = 1; i &lt;= button.length; i++){ button[i] = !button[i]; if (mouseX &gt; i*x-radius &amp;&amp; mouseX &lt; i*x+radius &amp;&amp; mouseY &gt; y-radius &amp;&amp; mouseY &lt; y+radius){ if (button[i]){ fill(150); } } else { fill(0); } ellipse(i*x, y, ellipseSize, ellipseSize); } } I get an error saying "ArrayIndexOutOfBoundsException: 3". Can someone help?
type: Question
tagged with: boolean
has answer: http://stackoverflow.com/a/26107558
has answer: http://stackoverflow.com/a/26115032
tagged with: arrays
downvote count: 0
tagged with: button
has title: How to make buttons with a boolean array in Processing?
has answer: http://stackoverflow.com/a/26107894
answer count: 3
favorite count: 0

http://stackoverflow.com/comment/40883076
type: QuestionComment
has text: You might want to know, that Stackoverflow Netiquette discourages from using a URL-link derrogated posts. Rather include the merit her, in your post, once the referred page(s) need not be persistent forever so as to still provide your intended content. You might want to re-read the StackOverflow Do-s and Don't-s and re-edit your post to both show your will to comply with the Community Netiquette and also to avoid any adverse step from any Moderator who may feel necessary to enforce the said rules. Enjoy the great Community of contributing members you have just stepped in to belong to.
comment on: http://stackoverflow.com/q/26089949
score: 0
type: Comment

http://stackoverflow.com/q/26132790
has answer: http://stackoverflow.com/a/26132815
tagged with: java
has body: Here is my code... can someone please tell me what is wrong? void keyPressed() { if (key == '\n') { equation = typing; switch (equation.charAt(2)) { case "-": if (equation.charAt(3) == "x") { math[0] = -1; }; else { math[0] = int(equation.charAt(3) * -1); }; } } } I don't understand what is wrong. All of the braces match up. Is it that you can't use an if else inside a switch???
downvote count: 1
tagged with: switch-statement
type: Question
tagged with: case
tagged with: processing
score: -1
has title: Processing - Found one too many { characters without a } character afterward
tagged with: curly-braces
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40960388
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41034705
score: 2
has text: Why do you have the inner loop wrapped with a `while(true)`?
comment on: http://stackoverflow.com/q/26172857
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26124297
type: Question
has body: I am a web dev and a couple of weeks ago I started trying to learn android studio and app dev. Im currently using kii cloud for my android app and I am currently trying to figure out how implement the following scenario -- a. I already have user registration, so I am currently working on a "edit profile" page. b. On the edit profile page Im trying to create a button so that the user clicks on it and it will then open a fragment where the user can upload the image. link c. Then attach that image to the url, and use the URL where needed such as a view profile page. linkenter link description here EditUserProfile.java public class EditUserProfile extends Activity { Button picbutton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); picbutton = (Button) findViewById(R.id.MypicButton); // Capture button clicks picbutton.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { FragmentManager fm = getFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragcon); if(fragment == null) fragment = new ProfilePic(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fragcon, fragment); ft.commit(); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } } ProfilePic.java (Fragment) public class ProfilePic extends Fragment { private static final String TAG = "ProfilePic"; String objectUri = null; private static final int PICK_IMAGE = 1; private Activity activity; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_attach_file, container, false); Bundle args = getArguments(); objectUri = args.getString("object_uri"); Button attachButton = (Button) view .findViewById(R.id.attach_file_button); attachButton.setOnClickListener(new O…
has comment: http://stackoverflow.com/comment/42236066
tagged with: image
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42339582
favorite count: 0
has title: KiiObject Upload Picture to use for profile
has answer: http://stackoverflow.com/a/39997373
type: UnansweredQuestion
tagged with: android-studio
score: 1
tagged with: kiicloud
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26054200
has comment: http://stackoverflow.com/comment/40816996
score: 0
has comment: http://stackoverflow.com/comment/40816685
tagged with: udp
has comment: http://stackoverflow.com/comment/40819191
has comment: http://stackoverflow.com/comment/40817150
tagged with: sockets
has comment: http://stackoverflow.com/comment/40818633
has comment: http://stackoverflow.com/comment/40827976
has comment: http://stackoverflow.com/comment/40818124
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26058333
has comment: http://stackoverflow.com/comment/40817279
has comment: http://stackoverflow.com/comment/40818352
has comment: http://stackoverflow.com/comment/40818462
has comment: http://stackoverflow.com/comment/40816803
has answer: http://stackoverflow.com/a/26057384
has title: transfer file by UDP but guaranti file not lost
has body: I have a project require using UDP protocol to transfer file but still guaranty the feature of TCP protocol. That means we have the speed of UDP and the file not lost. I've already have: Server: public class UDPServer { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO code application logic here int port = 6788; DatagramSocket sk = new DatagramSocket(port); byte[] buf = new byte[1000]; while(true){ DatagramPacket request = new DatagramPacket(buf, buf.length); sk.receive(request); String msg = (new String(request.getData())); DatagramPacket reply = new DatagramPacket(msg.getBytes(), msg.getBytes().length, request.getAddress(), request.getPort()); sk.send(reply); } } } Client: public class UDPClient { public static void main(String[] args) throws SocketException, UnknownHostException, IOException { DatagramSocket sk = new DatagramSocket(); String msg = "message send"; InetAddress addr = InetAddress.getByName("localhost"); int port = 6788; DatagramPacket request = new DatagramPacket(msg.getBytes(), msg.getBytes().length, addr, port); sk.send(request); byte[] buf = new byte[1000]; DatagramPacket reply = new DatagramPacket(buf, buf.length); sk.receive(reply); System.out.println("packet da nhan duoi client" + new String(reply.getData())); sk.close(); } } and can you help me any suggest to guaranty file not lost ?. tks
has comment: http://stackoverflow.com/comment/40817824
tagged with: java
has comment: http://stackoverflow.com/comment/40816871
has comment: http://stackoverflow.com/comment/40830710
has comment: http://stackoverflow.com/comment/40822160
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40816898
has comment: http://stackoverflow.com/comment/40816736
has comment: http://stackoverflow.com/comment/40817634

http://stackoverflow.com/q/26101606
type: Question
answer count: 1
score: 0
has body: Is it possible to determine the actual logger which sends log messages to an appender in logback? Example: &lt;configuration&gt; &lt;!-- ... --&gt; &lt;logger name="com.example"&gt; &lt;appender-ref ref="myAppender"/&gt; &lt;/logger&gt; &lt;logger name="com.example.sub"&gt; &lt;appender-ref ref="myAppender"/&gt; &lt;/logger&gt; &lt;/configuration&gt; Now both com.example and com.example.sub hold references to myAppender. If I log to com.example.sub.MyClass both loggers would trigger .doAppend() on myAppender. Now, is it possible to get the name of the logger that actually sent the message (holding the reference to myAppender)? Exemplary output: Logger com.example (com.example.sub.MyClass) Test Logger com.example.sub (com.example.sub.MyClass) Test I'm configuring the logging framework programmatically. I thought, I could do something like ContextSelectorStaticBinder binder = ContextSelectorStaticBinder.getSingleton(); ContextSelector selector = binder.getContextSelector(); selector.getLoggerContext(name).setName(name); selector.getLoggerContext(name).getLogger(name).addAppender(appender); And then later in the Encoder: @Override public void doEncode(ILoggingEvent event) throws IOException { String name = event.getLoggerContextVO().getName(); // ... } But selector.getLoggerContext(name) doesn't return different instances. Background: I have one appender that sends log messages to a WebSocket. This appender should be able to "subscribe" to different loggers (basically like in the XML). The webpage would present the log messages in different tabs ("channels").
has title: Logback - determine the actual logger that sent the log message to an appender
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26102972
tagged with: logging
tagged with: java
tagged with: logback

http://stackoverflow.com/a/61842656
has body: Right command for this is mvn appengine:deployCron
type: Answer
answers question: http://stackoverflow.com/q/26089297
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/40978465
has text: http://chat.stackoverflow.com/rooms/62262/discussion-between-shoaib-chikate-and-chaitanya we can have chat
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26141550

http://stackoverflow.com/comment/40842485
has text: Can't you just `@Inject` an `@ApplicationScoped` or `@Singleton` EJB into your MDB to get the next counter value?
comment on: http://stackoverflow.com/q/26054657
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40820586
comment on: http://stackoverflow.com/q/26056396
has text: Without going into depth on the full answer, the phrase "makes for" could be replaced with "creates" or "leads to", and the sentence still means the same.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40794138
type: QuestionComment
has text: Why not this work `"12.10 On-Going Submission of \"\"Made Up\"\" Samples."` ???
score: 1
comment on: http://stackoverflow.com/q/26041797
type: Comment

http://stackoverflow.com/comment/40921348
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26111207
has text: @markspace i'm having a progress bar, it blocks a little at 63% and then complete 100%. Afte this a scanning projects starts without endind
type: Comment

http://stackoverflow.com/comment/40805697
type: QuestionComment
score: 2
has text: @khelwood I doubt this exercise would allow the use of Arrays.sort. This is a common interview question. Also, Arrays.sort would be O(n log n), where as counting sort is O(n).
comment on: http://stackoverflow.com/q/26047945
type: Comment

http://stackoverflow.com/q/26095219
type: Question
tagged with: saml
score: 0
answer count: 1
tagged with: attributes
has body: How can i parse the values i got from SAML response? I want to get the AttributeValue of a specific AttributeName. Something like this. &lt;saml:Attribute AttributeName="FirstName" AttributeNamespace="http://schemas.xmlsoap.org/claims"&gt; &lt;saml:AttributeValue&gt;MY FirstName&lt;/saml:AttributeValue&gt; &lt;/saml:Attribute&gt; Please help me. Thanks in Advance!
tagged with: android
has title: SAML parsing in JAVA
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6681083
has answer: http://stackoverflow.com/a/26182028
accepted answer: http://stackoverflow.com/a/26182028
tagged with: java

http://stackoverflow.com/q/26125655
has body: I have huge number of XML files for which parsing needs to be done and generate a tree structure and further read to move data into database. Following is the structure which i think suffices my requirement. TreeNode class will have tag name, its properties and its parent tag (Tags here are xml elements) public class TreeNode { String tagname; Map&lt;String, String&gt; tagmap; TreeNode parent; List&lt;TreeNode&gt; children; public TreeNode(String tagname, Map&lt;String, String&gt; tagmap) { this.tagname = tagname; this.tagmap = tagmap; this.children = new LinkedList&lt;TreeNode&gt;(); } public TreeNode addChild(String tagname,Map&lt;String, String&gt; tagmap) { TreeNode childNode = new TreeNode(tagname,tagmap); childNode.parent = this; this.children.add(childNode); return childNode; } Now I am finding it difficult to parse XML file. Sample XML file is below &lt;head&gt; &lt;link href="files/style.css" rel="stylesheet"/&gt; &lt;/head&gt; &lt;div class="toolbar" style="display:block;position:absolute;top:0;left:0;width:100%;height:100%"&gt; &lt;TABLE datatable="0" summary=""&gt; &lt;prj:if condition="Platform"&gt; &lt;tr&gt; &lt;td nowrap&gt;&lt;prj:toolbar name="First RunningTest"&gt;&lt;prj:running property="HTML"/&gt;&lt;/prj:toolbar&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td nowrap&gt;&lt;prj:toolbar name="Second RunningTest"&gt;&lt;prj:running property="HTML"/&gt;&lt;/prj:toolbar&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td nowrap&gt;&lt;prj:toolbar name="Third RunningTest"&gt;&lt;prj:running property="HTML"/&gt;&lt;/prj:toolbar&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/prj:if&gt; &lt;/TABLE&gt; &lt;/div&gt; Apart from HTML tags, prj tags are there project specific. So the tree structure would be root --head (its map will be empty) --link (its map will all its properties i.e. key,value pair) --div --table --prj_if --tr --td --prj_toolbar --prj_running --td --tr --td --prj_toolbar --prj_running --td…
has comment: http://stackoverflow.com/comment/40948124
type: Question
tagged with: tree
tagged with: java
has comment: http://stackoverflow.com/comment/40948307
tagged with: treemap
has title: XML Parsing in Java having user defined elements
has comment: http://stackoverflow.com/comment/40947125
score: 0
has comment: http://stackoverflow.com/comment/40948187
has comment: http://stackoverflow.com/comment/40947644
has answer: http://stackoverflow.com/a/26128724
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40948616
tagged with: http://stackoverflow.com/tag/xml

aop
tags question: http://stackoverflow.com/q/26158913
tags question: http://stackoverflow.com/q/26112460
tag name: aop
tags question: http://stackoverflow.com/q/26171863
type: Tag

http://stackoverflow.com/comment/40899435
score: 0
type: Comment
has text: Yes, but at least you don't lose the data. The log-aggregation though is a better option
comment on: http://stackoverflow.com/a/26098513
type: AnswerComment

http://stackoverflow.com/comment/50446235
type: Comment
has text: AFAIK, yes. But its not so hard that convert to raw websocket to SockJS - Stomp. It's better than "raw" ws
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31219539

data-structures
tags question: http://stackoverflow.com/q/26070484
tags question: http://stackoverflow.com/q/26147375
tags question: http://stackoverflow.com/q/26052850
tags question: http://stackoverflow.com/q/26141211
tags question: http://stackoverflow.com/q/26162183
tags question: http://stackoverflow.com/q/26070079
tag name: data-structures
tags question: http://stackoverflow.com/q/26113576
tags question: http://stackoverflow.com/q/26147586
tags question: http://stackoverflow.com/q/26058700
tags question: http://stackoverflow.com/q/26119951
tags question: http://stackoverflow.com/q/26119232
tags question: http://stackoverflow.com/q/26044177
tags question: http://stackoverflow.com/q/26185323
tags question: http://stackoverflow.com/q/26046112
tags question: http://stackoverflow.com/q/26132734
tags question: http://stackoverflow.com/q/26067298
type: Tag
tags question: http://stackoverflow.com/q/26070024
tags question: http://stackoverflow.com/q/26067498

http://stackoverflow.com/comment/40907342
has text: I do specifically refer to the documentation in the post. How do i prove it isn't to do with the classpath then? I put the path of the class file that its using, and its where its supposed to be. BUT it doesn't look like what the Java API says it should.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26100947
type: Comment

http://stackoverflow.com/q/26096466
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40895804
type: Question
tagged with: export
tagged with: executable-jar
tagged with: workspace
has body: I have a Java code with main method that I exported into a runnable jar using Eclipse. The problem is, when I run this file; it generates a workspace folder. In this workspace folder, it stores the user-configuration etc. that was entered in the program. This "workspace" folder is generated in the same folder where the original .jar file is. What I want is to somehow change the location of this folder to some other place. Is it possible to do that ?
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40897760
has comment: http://stackoverflow.com/comment/40899894
has comment: http://stackoverflow.com/comment/40896474
has title: Eclipse: Exporting into runnable Jar. How to change the autogenerated workspace folder location?
tagged with: java
has comment: http://stackoverflow.com/comment/40895169
has comment: http://stackoverflow.com/comment/40895505

http://stackoverflow.com/comment/41007562
has text: Fine, thanks for still trying (2.3 GB -> 70 MB). I'll leave the answer for other with similar questions, as gzip is often overlooked. Like using a RAM disk / SSD too.
type: AnswerComment
comment on: http://stackoverflow.com/a/26140483
score: 0
type: Comment

http://stackoverflow.com/comment/40941815
comment on: http://stackoverflow.com/a/26122870
score: 0
type: AnswerComment
type: Comment
has text: Note that an indeterminate progress bar will not work unless he puts the sql on another thread.

http://stackoverflow.com/comment/41036917
has text: yes the control does not reach RegisterServlet @Jitendra
comment on: http://stackoverflow.com/q/26174003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40807246
comment on: http://stackoverflow.com/q/26045798
score: 0
type: QuestionComment
type: Comment
has text: It's likely that the Sun provider is already installed, just further down the list, and the doc for `insertProviderAt` says "*A provider cannot be added if it is already installed.*". Documentation for RsaJsse and Jsafe is hard to find, it's not directly related, but [this document](http://docs.oracle.com/middleware/1213/wls/SECMG/standards.htm#A1124197) seems to suggest that a version of WebLogic running on Java 7 needs JsafeJCE 6.1, whereas you have version 6.0. This 6.0/6.1 difference might have something to do with Java 6/Java 7 incompatibilities.

http://stackoverflow.com/a/26061188
downvote count: 0
has comment: http://stackoverflow.com/comment/40829460
type: Answer
has body: This is known as FallThrough Look at the fallthrough demos in the docs case KeyEvent.VK_NUMPAD0: case KeyEvent.VK_INSERT: //Identical Code break;
score: 4
has comment: http://stackoverflow.com/comment/40829465
answers question: http://stackoverflow.com/q/26061165
has comment: http://stackoverflow.com/comment/40829509
has comment: http://stackoverflow.com/comment/40829428
upvote count: 4

http://stackoverflow.com/q/26047783
downvote count: 0
tagged with: inversion-of-control
favorite count: 0
has body: i am trying to develop a Spring bean like this 1962 1968 this is just a example the WifeClazz the name is just for the example.. have a Constructor which have a String and a series of Integers.. like this example new WifeClazz("Cinthia Lennon",java.util.Arrays.asList(1,2,3,4,5,6,7,8)); the integers may be a severals from 1 to 10 integers. but i think is kind of annoying do something like this 1 2 3 4 would be great if i could do something like this #{T(java.util.Arrays).asList(1,2,3,4)} but throws Exception any clue? any help is hugely appreciate. UPDATE I have change my code according Edwin a something like this. but throws Caused by: java.lang.IllegalArgumentException: Final expected argument should be array type (the varargs parameter) my target clazz is public MyClass(final String name,final List<Integer>years){} my resulting code this solves the trick...
has answer: http://stackoverflow.com/a/26047954
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: constructor-injection
has title: Java Spring IOC constructor-arg inject a List<Integer>
accepted answer: http://stackoverflow.com/a/26047954
answer count: 1

http://stackoverflow.com/a/26137330
score: 2
type: AcceptedAnswer
downvote count: 0
has body: For accomplishing that best way would be to use Singleton pattern since you are gonna need your Resources all the time throughout the application life cycle. Creating a Singleton class is as follows : Static member : This contains the instance of the singleton class. Private constructor : This will prevent anybody else to instantiate the Singleton class. Static public method : This provides the global point of access to the Singleton object and returns the instance to the client calling class. Also take care of of multi-threaded environment if that exists in your case. public class ResourcesHandler { private static ResourcesHandler handlerObj; private Context mContext; private GraphicsCollection mGraphics; private SoundFxPlayer mSoundFx; private MusicPlayer mMusic; private ResourcesHandler(){ //TODO } public static ResourcesHandler getInstance() { if (handlerObj == null){ handlerObj = new ResourcesHandler(); } return handlerObj; } public void unload(){ mContext=null; if(null != mGraphics){ mGraphics.unload(); } if(null != mSoundFx){ mSoundFx.unload(); } if(null != mMusic){ mMusic.unload(); } } }
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26137133
answers question: http://stackoverflow.com/q/26137133
has comment: http://stackoverflow.com/comment/40968794

http://stackoverflow.com/q/26070079
has title: Count frequencies and missing numbers in array
tagged with: time-complexity
answer count: 0
has comment: http://stackoverflow.com/comment/40849103
type: UnansweredQuestion
tagged with: space-complexity
has comment: http://stackoverflow.com/comment/40846277
tagged with: java
has comment: http://stackoverflow.com/comment/40850565
type: Question
tagged with: arrays
has body: You are given an array of n integers which can contain integers from 1 to n only . Some elements can be repeated multiple times and some other elements can be absent from the array . Write a running code on paper which takes O(1) space apart from the input array and O(n) time to print which elements are not present in the array and the count of every element which is there in the array along with the element number . Here is the link to the problem and some solutions: http://www.careercup.com/question?id=21263687 Here is my solution: import java.util.HashMap; public class Question { public static void main(String[] args) { int arr[] = { 6, 4, 1, 4, 3, 2, 5, 2, 1,6,6,6 }; freq(12, arr); } public static void freq(int n, int[] array) { int[] count = new int[n+1]; for (int i = 0; i &lt; array.length; i++) { count[array[i]]++; } for (int i = 1; i &lt; count.length; i++) { System.out.println("number" + i + "frequency" + count[i]); } } } According to somebody else's solution, element present at any index can be overwritten and this can cause problem? We can sort the array in that case value present at index i is I+1 itself. I dont understand why an element at an index can be overwritten?
tagged with: data-structures
score: 0

http://stackoverflow.com/comment/41155812
comment on: http://stackoverflow.com/q/26185066
type: Comment
score: 0
has text: thanks for the reply again. I can share. But, how to share on stackoverflow ?
type: QuestionComment

http://stackoverflow.com/q/26071552
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40849673
has body: I have a file that has has a section something like: some phrase taxlabels gjasfg%$*!#%$97 dimensions more I want to remove everything between taxlabels and dimensions so that it reads: some phrase more I tried: fw.write(br.readLine().replaceAll("taxlabels.*?dimensions", ""); but nothing happens to the file. If I replace just one word e.g. "taxlabels" it works fine so I know its this line that is the problem. I think the problem is that .*? doesn't work for special characters, but I can't work out how to account for both regular and special characters. Any advice?
has title: java remove regular and special characters between two strings in a file
has comment: http://stackoverflow.com/comment/40850761
tagged with: string
has comment: http://stackoverflow.com/comment/40871054
has comment: http://stackoverflow.com/comment/40849422
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/40871328

http://stackoverflow.com/q/26066540
has answer: http://stackoverflow.com/a/26110274
has body: I have Google app engine Java app. I have created a service account to access Google API. My Java app is designed to update the Google calendar. So I tried to share the calendar to service account email id. I am not able to choose the option 'Make changes to events' for the service account id. It defaults to 'See all event details'. Due to this, I am not able to make changes to calendar using my Java app. I am the admin for the the google domain account that owns the calendar and the app engine. Please let me know the how to fix this.
favorite count: 0
tagged with: google-app-engine
tagged with: google-calendar-api
type: UnansweredQuestion
tagged with: google-api
upvote count: 1
has title: allow app engine service account to edit calendar
tagged with: java
type: Question
tagged with: google-api-java-client
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/26186776
has comment: http://stackoverflow.com/comment/41064449
has comment: http://stackoverflow.com/comment/41060778
downvote count: 0
has comment: http://stackoverflow.com/comment/41060807
type: Answer
answers question: http://stackoverflow.com/q/26185746
has comment: http://stackoverflow.com/comment/41060746
score: 1
has body: Have you tried saving : Integer.toString(inputTime.getValue());
upvote count: 1

http://stackoverflow.com/a/26157449
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41005800
has body: Download the mysql-connector-java.jar and add it to your classpath.
upvote count: 1
answers question: http://stackoverflow.com/q/26157397
score: 0

http://stackoverflow.com/q/26065599
tagged with: java
downvote count: 3
has title: I'm always get -1 index in java arraylist
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40838099
has body: import java.util.*; public class SWDistaster extends ITDisaster { String Cause; int count=0; List&lt;String&gt; SW_NameList = new ArrayList&lt;String&gt;(); List&lt;String&gt; SW_PlaceList = new ArrayList&lt;String&gt;(); List&lt;Double&gt; SW_CostList = new ArrayList&lt;Double&gt;(); List&lt;Integer&gt; SW_DateList = new ArrayList&lt;Integer&gt;(); public SWDistaster() {} public SWDistaster(String Name) { super(Name); } public void show() { System.out.println(Name + " " + Place + " " + Cost + " " + Date + " " + Cause); } public void SW_SearchName(String name) { System.out.println(SW_NameList.lastIndexOf(name)); if(SW_NameList.contains(name)) { System.out.println(SW_PlaceList.get(SW_NameList.indexOf(name))); System.out.println("here"); } else { SW_NameList(name); //System.out.println("here2"); } } public void SW_NameList(String name) { SW_NameList.add(count, name); count++; } public void SW_PlaceList(String place) { SW_PlaceList.add(place); } public void SW_CostList(double cost) { SW_CostList.add(cost); } public void SW_DateList(int date) { SW_DateList.add(date); } public void ShowList() { for(int i = 0; i&lt;SW_NameList.size() ; i++) { System.out.print((SW_NameList.get(i)).toString()); } } } and application class : public class Application { public static void main(String[] args) { SWDistaster dis1 = new SWDistaster(); dis1.SW_SearchName("Election"); dis1.ShowList(); SWDistaster dis2 = new SWDistaster(); dis2.SW_SearchName("Election"); dis2.ShowList(); SWDistaster dis3 = new SWDistaster(); dis3.SW_SearchName("Batee5"); dis3.ShowList(); } } there is no append in arraylist like i'm always used to do in vector in c++ ! and i need to save all names in arraylist to come and search in and if i find it i would show the place and date and if not i will add it to the arraylist and may anybody also help me how to use files to save in it more easily as i'm new to java
favorite count: 0
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/26065634
has comment: http://stackoverflow.com/comment/40838120

http://stackoverflow.com/comment/41297529
score: 0
type: AnswerComment
type: Comment
has text: if i put it as string Result result = junit.run("package.classname"); i get error : junitCore is not applicable to the arguments (String)
comment on: http://stackoverflow.com/a/26115878

http://stackoverflow.com/a/26109151
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26108513
type: Answer
answers question: http://stackoverflow.com/q/26108513
has body: This is a relatively common problem with many applications, not just JDOM. When you create a FileOutputStream, and write to it, you HAVE TO FLUSH IT AND CLOSE IT before exiting your program. Change: xmlOutput.output(doc, new FileOutputStream(new File("./src/Lexicon.xml"))); to be (using try-with-resources): try (OutputStream fileout = new FileOutputStream(new File("./src/Lexicon.xml"))) { xmlOutput.output(doc, fileout); } or: OutputStream fileout = new FileOutputStream(new File("./src/Lexicon.xml")); xmlOutput.output(doc, fileout); fileout.flush(); fileout.close();
downvote count: 0
score: 1

http://stackoverflow.com/q/26157055
has comment: http://stackoverflow.com/comment/41005259
has comment: http://stackoverflow.com/comment/41005083
has comment: http://stackoverflow.com/comment/41005698
has answer: http://stackoverflow.com/a/26158140
accepted answer: http://stackoverflow.com/a/26157237
has comment: http://stackoverflow.com/comment/41004929
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41005454
has comment: http://stackoverflow.com/comment/41004949
possible better answer: http://stackoverflow.com/a/26158140
tagged with: java
has title: Having trouble with equals/not equals using array in Java
has comment: http://stackoverflow.com/comment/41005367
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41005248
tagged with: arrays
has body: I am working on an Address Book homework assignment for Java, using arrays. I am stuck on how to make sure someone isn't in the address book before adding them, and making sure they are in the address book in order to delete them. I have three files; hopefully I'll copy the code into here correctly. Any ideas about what I'm doing wrong are most appreciated. This is the AddressBook class: package addressbook; public class AddressBook { // declaring variable addressBook as reference // to an array of Person objects Person[] addressBook; // using a static field to keep track of // the number of person objects public static int people = 0; // allocate memory for the array field in a constructor public AddressBook() { addressBook = new Person[2]; } //Method to add a person object to the addressBook public void AddPerson(Person person) { for (int i = 0; i &lt; people; i++) { if (addressBook[i] != person) { // check to see if the number of person objects // is fewer than the number of spaces in the array if (people &lt; addressBook.length) { // add new person to array at the position // specified by variable people (starting with 0) addressBook[people] = person; } // if there are too many person objects // to fit in the address book else { // declare a temp array twice the length of address book Person[] temp = new Person[addressBook.length * 2]; for (int j = 0; j &lt; addressBook.length; j++) // put the references from the old address book into temp { temp[j] = addressBook[j]; } //add the new person object into temp temp[people] = person; // copy the reference to temp into address book addressBook = temp; } // increase person object count (since you just added a person) people++; // print to the console to see if method is working System.out.println("people = " + people + "\n" + "addressBook.Length = " + addressBook.length); } } } // Method to search for a person by name. // Searches both first and last names // and puts the results into an array. public Person[] searchNa…
has comment: http://stackoverflow.com/comment/41004885
has comment: http://stackoverflow.com/comment/41005301
score: 0
has answer: http://stackoverflow.com/a/26157237

http://stackoverflow.com/q/26063583
has body: I'm currently trying to save an ArrayList containing POJOs as a SharedPreference to retrieve it when the user re-enters the application, but it doesn't seem to work. This is what I do: callback methods ArrayList&lt;myObject&gt; myList; ArrayList&lt;Boolean&gt; myobject_repeat; MyListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myview); lw = (ListView) findViewById(R.id.lw); myList= new ArrayList&lt;myObject&gt;(); myobject_repeat = new ArrayList&lt;Boolean&gt;(); adapter = new MyListAdapter(this, myList); lw.setAdapter(adapter); } @Override protected void onPause() { saveArray(); super.onPause(); } @Override protected void onResume() { loadArray(this); super.onResume(); } Methods to save/load array public boolean saveArray() { SharedPreferences pref = PreferenceManager .getDefaultSharedPreferences(this); SharedPreferences.Editor edit = pref.edit(); edit.putInt("list_size", myList.size()); for (int i = 0; i &lt; myList.size(); i++) { edit.remove("id" + i); edit.remove("repeat" + i); edit.putLong("id" + i, myList.get(i).getId()); edit.putBoolean("repeat" + i, myList.get(i).isRepeat()); } return edit.commit(); } public void loadArray(Context c) { SharedPreferences pref = PreferenceManager .getDefaultSharedPreferences(c); myList.clear(); myList2.clear(); int listsize = pref.getInt("list_size", 0); for (int i = 0; i &lt; listsize; i++) { MyObject tmpObject = new MyObject(); tmpObject.setId(pref.getLong("id" + i, 0)); tmpObject.setRepeat(pref.getBoolean("repeat" + i, false)); myList.add(tmpObject); } } This is where I add an object to the array @Override protected void onActivityResult(int requestCode, int resultCode, Intent result) { super.onActivityResult(requestCode, resultCode, result); if (resultCode == RESULT_OK) { int hour = result.getExtras().getInt("hour"); int minute = result.getExtras().getInt("minute"); boolean repeat = result.getExtras().getBoolean("repeat"); setUpO…
possible better answer: http://stackoverflow.com/a/26063758
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/26073595
answer count: 3
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26073595
has title: Android saving an ArrayList<Object> as SharedPreference
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26064900
has answer: http://stackoverflow.com/a/26063758

http://stackoverflow.com/q/26149289
downvote count: 8
has comment: http://stackoverflow.com/comment/40990910
tagged with: string
possible better answer: http://stackoverflow.com/a/26149393
score: -6
has body: Is there a not-so-messy way to convert a String "[1,2,3]" into a List&lt;Long&gt; ? I tried to find some good ways but most takes many steps
favorite count: 0
has answer: http://stackoverflow.com/a/26149476
answer count: 5
has title: Converting a string into an List
accepted answer: http://stackoverflow.com/a/26149390
has comment: http://stackoverflow.com/comment/40990968
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26149591
has answer: http://stackoverflow.com/a/26149390
type: Question
has answer: http://stackoverflow.com/a/26149443
tagged with: java
has comment: http://stackoverflow.com/comment/40990934
has answer: http://stackoverflow.com/a/26149393
upvote count: 2

http://stackoverflow.com/q/26034317
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
downvote count: 0
answer count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42109676
has body: i has implemented volley library android. but i have get error com.android.volley.NoConnectionError: java.io.IOException: Received authentication challenge is null, the URL rquest is http://23.89.192.247/tanker-dev/index.php/api/masuk, this my code: queue = Volley.newRequestQueue(this); Map&lt;String, String&gt; jsonParams = new HashMap&lt;String, String&gt;(); jsonParams.put("username",user); jsonParams.put("password", password); JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST, url, new JSONObject(jsonParams), new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { Toast.makeText(SplashLoginActivity.this, ""+response,Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(SplashLoginActivity.this, ""+error,Toast.LENGTH_LONG).show(); } }) { @Override public Map&lt;String, String&gt; getHeaders() throws AuthFailureError { HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;(); headers.put("Content-Type", "application/json; charset=utf-8"); headers.put("User-agent", "My useragent"); headers.put("WWW-Authenticate", "None"); return headers; } }; queue.add(jsonObjReq); How to fix it ? sorry for my english...
has title: com.android.volley.NoConnectionError: java.io.IOException: Received authentication challenge is null
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40789631

http://stackoverflow.com/comment/41067129
type: AnswerComment
comment on: http://stackoverflow.com/a/26190099
score: 0
type: Comment
has text: 1) No. 2) Use an absolute pathname, or run the application from the command line.

http://stackoverflow.com/comment/40785165
type: QuestionComment
has text: thanks for your suggestion . As i have explained the operations performed . you could see that bulk updates cant be performed as generate dyanamic values here
score: 0
comment on: http://stackoverflow.com/q/26037098
type: Comment

http://stackoverflow.com/a/26049994
has comment: http://stackoverflow.com/comment/40809493
downvote count: 1
has body: at the top of your for loop add imageItems[i] = gallery.new ImageItem()
has comment: http://stackoverflow.com/comment/40809456
score: 5
has comment: http://stackoverflow.com/comment/40809501
has comment: http://stackoverflow.com/comment/40809556
has comment: http://stackoverflow.com/comment/40809768
has comment: http://stackoverflow.com/comment/40809347
has comment: http://stackoverflow.com/comment/40809482
has comment: http://stackoverflow.com/comment/40809736
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26049953
type: Answer
has comment: http://stackoverflow.com/comment/40809801
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26049953
has comment: http://stackoverflow.com/comment/40809396
has comment: http://stackoverflow.com/comment/40809639
has comment: http://stackoverflow.com/comment/40809840

http://stackoverflow.com/comment/40966334
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26135444
has text: You misunderstood the question. I am asking about [CustomComponent](https://vaadin.com/api/com/vaadin/ui/CustomComponent.html) not [CustomLayout](https://vaadin.com/book/-/page/layout.customlayout.html). Hit that first link for The Book Of Vaadin for info. You gave a good answer but on the wrong question. I suggest you create your own Question and post this Answer. Doing so is encouraged on StackOverflow.
score: 1

http://stackoverflow.com/q/26134846
has answer: http://stackoverflow.com/a/26144460
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/40964341
score: 0
has comment: http://stackoverflow.com/comment/40963888
has comment: http://stackoverflow.com/comment/40963946
has title: How to call a controller method from jsp in Spring mvc using onchange method
type: UnansweredQuestion
has body: I have a Spring mvc project with an html form in jsp. The form has a date field which I have to validate. But, we cannot enter an already existing date in the database, so I want to get that message to the web page when we enter an already existing date. I have to call back end java methods to check that. How can I do that? What is the way to call a back end java method when we enter a Date field ? How can we use onchange method for that?
has answer: http://stackoverflow.com/a/26135916
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/41034042
type: Comment
score: 0
type: AnswerComment
has text: @RandykaYudhistira just used your code , do i place this in the main or in the method?
comment on: http://stackoverflow.com/a/26171861

http://stackoverflow.com/q/26187645
type: Question
has body: Wowza Streaming Engine 4.0.4 from the AMI available here Currently, I need to wait for the file to finish transcoding before I can use it again. I'm looking at the logs and I see this: INFO session comment 1420436222 client connectionClosed [1420436222] pingtimeout INFO server comment - onStreamDestroy: 1 INFO server comment - TranscodingSession.shutdown[recorder/_definst_/530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d91412373547415] INFO transcoder decoder-audio-stop 530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d91412373547415 - INFO transcoder encoder-audio-stop 530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d91412373547415 {name: "aac"} And then the transcoding is done. and the .tmp file is removed. I'm assuming that "pingtimeout" is a natural event that happens due to inactivity. I don't want to have the client sit there until it is naturally timed out before I can use the transcoded file. Is there any way that I can force-close the connection either from the client or the server, without waiting for a "pingtimeout" so that I can use this transcoded file faster? The client should be able to tell the server "I'm done", and then the server should wrap up all the transcoding operations. Can I do this? From the client, I'm already calling NetStream.close() and NetStream.dispose(), but that doesn't seem to help. EDIT: On the client I call NetStream.close() Then I call my custom method that hits the server-side API which saves the file. Here is a log from a successful attempt: INFO server comment - LiveStreamPacketizerSanJose.endChunkTS[recorder/_definst_/530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d81412696439395]: Add chunk: id:4 a/v/k:251/151/10 duration:10026 INFO server comment - TranscodingSession.close[recorder/_definst_/530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d81412696439395] INFO stream recordstop 530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d81412696439395 - INFO stream unpublish 530d8aa855df0c2d269a5a5853a47a049c52c9d83a2d71d81412696439395 - INFO …
accepted answer: http://stackoverflow.com/a/26260685
tagged with: wowza
has title: Transcoding only finishes once client is timed out?
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: actionscript-3
tagged with: transcoding
has answer: http://stackoverflow.com/a/26260685
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/41012861
type: Comment
comment on: http://stackoverflow.com/q/26161357
type: QuestionComment
has text: Can you use Java 8 and Streams?
score: 0

http://stackoverflow.com/comment/41013754
has text: *"The least intrusive option I personally see is adding a trailing underscore, like `Thread_`."* That's not really a good idea. Too easy to misread, and the underscore tells you nothing of value.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26161728

http://stackoverflow.com/q/26177504
tagged with: spring
has body: I am struggling on this for days. I have a date field, that gives a date on 'yyyy-MM-dd' format. My Object have this field like this @Temporal(TemporalType.DATE) private Date finishdate; I am on UTC, and this need to work all over the world, so on UTC-7 or UTC+7 On DataBase this value need to be store with 0 hours. When the finishdate is filled, the format give me the timezone, so, for example: I want 2014-10-01, with ZERO HOURS AND MINUTES AND SECONDS, on diferent timezones I catch: 2014-10-01 07:00:00:000 or 2014-09-01 17:00:00:000 The problem seams to be because of the Date liybrary, and i've found a solution with JODA Library, but i was told not to used it, and I need to find another solution. So, need to convert to UTC Date, all dates,or other thing, but the day must be the same, like 1 October. Anyone pass through this?
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26178628
type: Question
has comment: http://stackoverflow.com/comment/41043838
has comment: http://stackoverflow.com/comment/41053723
has title: Java Date problems with TIMEZONE
tagged with: date
possible better answer: http://stackoverflow.com/a/26178628
has answer: http://stackoverflow.com/a/38840438
has answer: http://stackoverflow.com/a/26238960
accepted answer: http://stackoverflow.com/a/26238960
upvote count: 1
favorite count: 0
tagged with: timezone
has answer: http://stackoverflow.com/a/27195718

http://stackoverflow.com/q/26072950
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40851335
has body: can you please tell me that ...Is it possible to search words that are in database and list them,when using spell the words through the microphone in swing?if possible how can i implement this one.thanks in advance
answer count: 1
has comment: http://stackoverflow.com/comment/40851234
type: UnansweredQuestion
tagged with: microphone
tagged with: speech-recognition
type: Question
has comment: http://stackoverflow.com/comment/40851211
tagged with: audio
has answer: http://stackoverflow.com/a/26073102
has title: Search information based on sound from microphone

http://stackoverflow.com/q/26179170
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41046874
has body: I have a MouseListener inside my action, the action corresponds to a JButton. The mouse event works fine for right click events, but for left click events It seems not be resetting my mouse events so every left click plays through every left click mouse event that was before it. So the first left click will increment my number by 1, the second increments it by 2 the third by 3 the fourth 4 etc. It should only increment by 1 every time. I did some debugging and it seems that the left click function is called for every left click on the history of the component. Any thoughts? private void setupActions() { oneAction = new AbstractAction( "1" ) { @Override public void actionPerformed( ActionEvent e ) { ((JButton)e.getSource()).addMouseListener(new MouseAdapter() { @Override public void mouseClicked( MouseEvent e ) { if ( SwingUtilities.isLeftMouseButton(e) ) { Integer quantityField = (Integer) model.getValueAt(0, 3); if ( quantityField == null || quantityField == 0) { quickOrderTableModel.setValueAt(1, 0, 3); } else { Integer newValue = (quantityField + 1); quickOrderTableModel.setValueAt(newValue, 0, 3); } } if ( SwingUtilities.isRightMouseButton(e) ) { Integer quantityField = (Integer) model.getValueAt(0, 3); if ( quantityField == null || quantityField == 0) { quickOrderTableModel.setValueAt(0, 0, 3); } else { Integer newValue = (quantityField - 1); quickOrderTableModel.setValueAt(newValue, 0, 3); } } } }); } };
has title: Java MouseEvent left click inside actionPerformed
tagged with: events
tagged with: action
has answer: http://stackoverflow.com/a/26179721
accepted answer: http://stackoverflow.com/a/26179721
type: AnsweredQuestion
tagged with: mouselistener
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/comment/40939803
type: Comment
score: 0
has text: Service A on port 8080 and service B on port 8081, ect...
type: QuestionComment
comment on: http://stackoverflow.com/q/26111050

http://stackoverflow.com/a/26120937
upvote count: 1
has comment: http://stackoverflow.com/comment/40959214
has body: You can store JSONs in Dynamodb as Strings. It all depends on what you want to do with the data and how to retrieve it. The DynamoDB Java API for instance, introduces Marshaller objects that transforms any Java object into a String so you can store it and fetch it automagically from a DynamoDB attribute.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26118067
has comment: http://stackoverflow.com/comment/40964356
score: 1
has comment: http://stackoverflow.com/comment/105782505

http://stackoverflow.com/a/26079172
has body: Maybe it can help you : http://zetcode.com/tutorials/javaswingtutorial/resizablecomponent/ Disadvantage of code In this code we do not layout manager. So if we have a component in center of jframe when this jframe is re-sizing this component maybe display in corner of jframe. You can solve this problem but it is a little complex. We can talk about this problem if you want.
has comment: http://stackoverflow.com/comment/40862860
score: 0
has comment: http://stackoverflow.com/comment/40862640
answers question: http://stackoverflow.com/q/26078983
type: Answer

http://stackoverflow.com/comment/40780492
type: QuestionComment
has text: Yes 1.8 I have already only installed jdk 1.8. And set it to environment variables.
comment on: http://stackoverflow.com/q/26034338
score: 0
type: Comment

http://stackoverflow.com/comment/41011614
has text: Hi Thiago. Please mark it as the correct answer to your question if that is the case ;-)
comment on: http://stackoverflow.com/a/26160718
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26075808
score: 2
has body: Wihtout synchronization you could have this: Producer Thread Consumer Thread if (sharedQueue.isEmpty) { sharedQueue.add(i); sharedQueue.notifyAll(); sharedQueue.wait() } So, even though there is data in the queue, consumer thread would wait potentially forever, because stuff got added between it testing for data, and it starting wait for notification about added data. Of course there are workarounds, such as timeout on wait, but these all have polling overhead, latency due to polling interval, ugly code, and so on. No reason to resort to such things when you can just use synchronization. So why is it not enough, that the queue class is thread safe? Well, a thread safe class is not magic! Being thread safe just means, individual method calls to an instance of that class are thread safe. So for example if two threads do add at the same time to same instance, it will not corrupt anything, erase one operation with the other, or anything like that. But if you have multiple threads doing multiple operations, then they can be interleaved, that's the whole point of many threads and pre-emptive multitasking after all! So what happens with interleaved operations, that depends on the operations. For example, many threads doing just add would add things at some unspecified order, but that's probably ok. But when you don't want operations to happen in "random" order, you need to use synchronization. As shown by above example, in this case "random" order can result to consumer waiting indefinitely even with data in queue. As a matter of fact, if you ever have sequence "do modification, notify waiters", and waiters doing "see if there's something to do, otherwise wait", you have this same problem, and must use synchronization around both modification-notify and check-wait. And you get error, because Java requires you to have the lock when notifying, because as explained above, it makes no sense without lock, it would always be an error, a bug. And this is not Java specific, this i…
has comment: http://stackoverflow.com/comment/40856363
downvote count: 0
has comment: http://stackoverflow.com/comment/40881681
upvote count: 2
has comment: http://stackoverflow.com/comment/40856613
type: Answer
answers question: http://stackoverflow.com/q/26075740

http://stackoverflow.com/q/26036889
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/40784999
tagged with: java
has body: I've added the exploded ear (with a war inside) to weblogic. I've set the "on frame deactivation" to: "update classes and resources" and finally I've started weblogic in debug modus. But it doesn't seem to work.. Weblogic doesn't seem to know when I change something in my xhtml pages since they are not updated automatically. What am I doing wrong?
has comment: http://stackoverflow.com/comment/40785308
type: Question
tagged with: weblogic
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/40785250
favorite count: 0
has title: Update resources (xhtml) intellij with weblogic
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/40805080
type: Comment
has text: Looks to me like you're giving all users admin rights -- that can't be very secure
type: QuestionComment
comment on: http://stackoverflow.com/q/26045882
score: 0

http://stackoverflow.com/q/26137909
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/40969408
favorite count: 0
has answer: http://stackoverflow.com/a/26138031
score: -1
has title: Count, how many rows will take given text string
has comment: http://stackoverflow.com/comment/40969970
has answer: http://stackoverflow.com/a/26163117
type: UnansweredQuestion
tagged with: string-formatting
downvote count: 1
has comment: http://stackoverflow.com/comment/40969490
tagged with: java
has body: I have a text String, information about font and row width in pixels. Is it possible to compute, how many rows will take this string. If a word is long, it will be writen in a next row, for example: some test string | very_very_long_word | and even if there will be many white space so very_very_long_word &lt;= this can't be on one row so | very_very_long_word | and if the word is too long, it will be separated at the end of row: veryveryverylonglong| word |
type: Question

http://stackoverflow.com/a/26190380
downvote count: 0
answers question: http://stackoverflow.com/q/26189167
has comment: http://stackoverflow.com/comment/41083997
has comment: http://stackoverflow.com/comment/41116655
upvote count: 2
has comment: http://stackoverflow.com/comment/41076889
has body: Actually no real idea, but maybe something helps. Eclipse uses its own compiler, while Maven probably uses javac. So you normally have to get noth running and these two things are unrelated. A single Eclipse restart was always sufficient for me. Look in Help / About Eclipse SDK: Is there an Lombok entry? My eclipse.ini contains absolute paths: -javaagent:/home/maaartin/eclipse/lombok.jar -Xbootclasspath/a:/home/maaartin/eclipse/lombok.jar but relative path must work too. The question is "relative to what?". Normally, Lombok can find your Eclipse install directory and install itself. You have to do it manually, only when using non-standard install directories. Open the Error Log View, maybe there's something bad going on. Just in case, look at the log files on the disk, too.
type: Answer
score: 2

http://stackoverflow.com/comment/41013960
type: AnswerComment
has text: I added this in build.gradle , but still I am getting the same errors.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26161579

http://stackoverflow.com/a/26155007
has body: There are typos in your connectionUrl. Try: Replace the ; after the 3306 port number with /. Replace all subsequent ; delimiters which separates the username and password parameters with &amp;. Replace your databaseName=data parameter with just /data. Confirm your endpoint URL. Like this: String connectionUrl = "jdbc:mysql://&lt;your_instance_endpoint&gt;:3306/" + "&lt;your_database_name&gt;?user=xx&amp;password=xxx";
type: Answer
has comment: http://stackoverflow.com/comment/41001238
has comment: http://stackoverflow.com/comment/41036692
score: 0
answers question: http://stackoverflow.com/q/26154920

http://stackoverflow.com/comment/41046367
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26179413
has text: That seccond method is that in a static method?

http://stackoverflow.com/a/26167115
type: Answer
score: 0
has body: This happends occasionaly and the usual way I fix this is to go into Projects -> Properties -> Android -> then choose appcompat from the list, apply, then go. The R cannot be resolved to a variable is usually because there is an error in one of your XML files which you have to resolve.
answers question: http://stackoverflow.com/q/26166664

http://stackoverflow.com/a/59792840
score: -1
has comment: http://stackoverflow.com/comment/130154094
has body: Try Editing your constructor. Or, perhaps theres a misplaced end curly bracket
type: Answer
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/26050764

http://stackoverflow.com/comment/41024643
has text: I would also recommend removing all those line breaks. it makes your code very hard to read. Rather than typing in line numbers, simply add a comment to the line where the issue occurs to indicate where we should look for the error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26167357
score: 0

http://stackoverflow.com/comment/40814937
score: 0
has text: You pretty much put the answer in your question! You wanted "The root is " + root + " after " + counter + " iterations." And that's legal Java, if `root` and `counter` are variables. I.e. `System.out.println("The root is " + root + " after " + counter + " iterations.");`. All you have to do is define variables `root` and `counter` and make sure they're set to the right values (`root` will be something you've already printed out, so that shouldn't be hard).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26052994

http://stackoverflow.com/comment/40999528
has text: In cases like this, it can be helpful to mock up a very simple example with two do-nothing classes in separate jars and figure out if they have the same problem when you load them. If not, continue increasing the complexity of the model until it mirrors the patterns used in your real-life app. For example, I've noticed (in an OSGi environment) that the classloader likes to resolve all of the classes referenced in one way or another from a class that I load directly, but it doesn't try to resolve classes referenced in the one-step-removed classes until they are invoked.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26153026

http://stackoverflow.com/a/26134497
type: Answer
answers question: http://stackoverflow.com/q/26131647
score: 2
accepted answer of: http://stackoverflow.com/q/26131647
upvote count: 2
has body: You can do simple "clipping" to a rectangle with the LibGDX ScissorStack. Because OpenGL is stateful and many of the LibGDX drawing APIs cache, be sure to "flush" or "end" your batches within the range of the scissors. See libgdx ScissorStack not working as expected and libgdx Cutting an image
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40818627
score: 0
type: Comment
type: QuestionComment
has text: Yes you can use this method.
comment on: http://stackoverflow.com/q/26044877

http://stackoverflow.com/a/26106669
answers question: http://stackoverflow.com/q/26106657
score: 3
has body: Your "constructor" has a void word which makes it a method. Constructor cannot have a return type. You need to remove it: public SavingsAccount(double bal, double intRate){ balance = bal; interestRate = intRate; }
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/40900014
has text: if A null reference is a reference to a String that is not existent,than how System.out.print(str) give output as like null
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26099668

http://stackoverflow.com/a/26185865
has body: Using Standard JAXB APIs In order to get the same element to appear multiple times in an XML document you are going to need a List property. Note in the example below label will have a property mapped to the text attribute. @XmlRootElement(name="flowPanel") @XmlAccessorType(XmlAccessType.FIELD) public class Image implements Serializable { @XmlElement(name="label"). private List&lt;Label&gt; labels; } @XmlPath extension in EclipseLink JAXB (MOXy) If you are using EclipseLink MOXy as your JAXB (JSR-222) provider then you could leverage the @XmlPath extension we added for this use case. @XmlRootElement(name="flowPane") public class Image implements Serializable { @XmlPath("label[1]/@text") public String name; @XmlPath("label[1]/@text") public String description; } For More Information I have written more about this on my blog: http://blog.bdoughan.com/2010/07/xpath-based-mapping.html
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26182517
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40859977
type: Comment
has text: I don't mean to be rude, but I think what you should do is write some code. Then show it to us and explain which part you're having difficulty with. Then we'll be able to help you make progress.
comment on: http://stackoverflow.com/q/26077697
score: 3
type: QuestionComment

http://stackoverflow.com/comment/40903788
type: Comment
type: QuestionComment
has text: You can post the result in onPostExecute of the aynChronous task as well
comment on: http://stackoverflow.com/q/26101626
score: 0

http://stackoverflow.com/q/26065933
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40838888
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40839004
has title: How to copy a zip file in Java
has answer: http://stackoverflow.com/a/26066116
accepted answer: http://stackoverflow.com/a/26066116
linked to: http://stackoverflow.com/q/1946298
has comment: http://stackoverflow.com/comment/40838940
downvote count: 0
type: AnsweredQuestion
has body: I have a zip file that gets created at runtime that I need to copy to another directory however whenever I run my code I get a DirectoryNotEmptyException. Is there some extra parameter I need to specify to copy into a non-empty directory? Here's the layout Path sourceZip = new File(path).toPath(); String destinDir = new File(System.getProperty("user.dir")).getParent(); Path target = Paths.get(destinDir); try { Files.copy(sourceZip, target, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) //DirectoryNotEmptyException occurs here {}
score: 1

http://stackoverflow.com/q/26090965
has title: HttpServlet missing even though servlet-api.jar is in class path
accepted answer: http://stackoverflow.com/a/26090993
favorite count: 0
has answer: http://stackoverflow.com/a/26090993
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/15039852
tagged with: java
tagged with: servlets
type: Question
upvote count: 2
downvote count: 2
has body: I am trying to compile a simple servlet and I am getting an exception that HttpServlet, among other classes, is missing. Please note that I am including servlet-api.jar. What am I missing here? jdk1.8.0.05/bin/javac -cp "/usr/share/tomcat7/lib/servlet-api.jar" StockLookup.java StockLookup.java:4: error: package javax.servlet.html does not exist import javax.servlet.html.*; ^ StockLookup.java:8: error: cannot find symbol public class StockLookup extends HttpServlet { ^ symbol: class HttpServlet StockLookup.java:10: error: cannot find symbol public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ^ symbol: class HttpServletRequest location: class StockLookup StockLookup.java:10: error: cannot find symbol public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ^ symbol: class HttpServletResponse location: class StockLookup
answer count: 1
tagged with: jsp
linked to: http://stackoverflow.com/q/15039852
has comment: http://stackoverflow.com/comment/40884620
score: 0

http://stackoverflow.com/comment/41005083
comment on: http://stackoverflow.com/q/26157055
type: QuestionComment
type: Comment
has text: @Lorien what Kurt said is that you cannot do this in Java: if (addressBook[i] != person), check how to compare 2 objects!
score: 0

http://stackoverflow.com/comment/40826977
type: QuestionComment
score: 0
has text: Why don't you just copy `iter1` into `iter2`? Or if you can't do that, do `.next().prev()`.
comment on: http://stackoverflow.com/q/26059849
type: Comment

browser
tags question: http://stackoverflow.com/q/26186261
tags question: http://stackoverflow.com/q/26119783
tags question: http://stackoverflow.com/q/26183485
tag name: browser
tags question: http://stackoverflow.com/q/26053241
tags question: http://stackoverflow.com/q/26038333
type: Tag

algorithm
tags question: http://stackoverflow.com/q/26128067
tags question: http://stackoverflow.com/q/26147375
tag name: algorithm
tags question: http://stackoverflow.com/q/26102473
tags question: http://stackoverflow.com/q/26107036
tags question: http://stackoverflow.com/q/26080970
tags question: http://stackoverflow.com/q/26085302
tags question: http://stackoverflow.com/q/26042139
tags question: http://stackoverflow.com/q/26188714
tags question: http://stackoverflow.com/q/26109985
tags question: http://stackoverflow.com/q/26185728
tags question: http://stackoverflow.com/q/26158031
tags question: http://stackoverflow.com/q/26074754
tags question: http://stackoverflow.com/q/26083674
tags question: http://stackoverflow.com/q/26166440
tags question: http://stackoverflow.com/q/26068216
tags question: http://stackoverflow.com/q/26141239
type: Tag
tags question: http://stackoverflow.com/q/26037506
tags question: http://stackoverflow.com/q/26149028
tags question: http://stackoverflow.com/q/26088567
tags question: http://stackoverflow.com/q/26149016
tags question: http://stackoverflow.com/q/26119232
tags question: http://stackoverflow.com/q/26042525
tags question: http://stackoverflow.com/q/26047945
tags question: http://stackoverflow.com/q/26070605
tags question: http://stackoverflow.com/q/26128550
tags question: http://stackoverflow.com/q/26084966
tags question: http://stackoverflow.com/q/26091505
tags question: http://stackoverflow.com/q/26159993
tags question: http://stackoverflow.com/q/26108796
tags question: http://stackoverflow.com/q/26086402
tags question: http://stackoverflow.com/q/26084158
tags question: http://stackoverflow.com/q/26061553
tags question: http://stackoverflow.com/q/26087539
tags question: http://stackoverflow.com/q/26125557
tags question: http://stackoverflow.com/q/26157987
tags question: http://stackoverflow.com/q/26160360
tags question: http://stackoverflow.com/q/26125963
tags question: http://stackoverflow.com/q/26123279
tags question: http://stackoverflow.com/q/26187548
tags question: http://stackoverflow.com/q/26083139

http://stackoverflow.com/q/26109968
tagged with: java
upvote count: 1
type: Question
has body: I am writing a program for class which will allow the user to calculate the area of an isosceles trapezoid. Here is my code: import java.util.Scanner; import java.lang.Math; public class CSCD210Lab2 { public static void main (String [] args) { Scanner mathInput = new Scanner(System.in); //declare variables int topLength, bottomLength, height; //Get user input System.out.print("Please enter length of the top of isosceles trapezoid: ") ; topLength = mathInput.nextInt() ; mathInput.nextLine() ; System.out.print("Please enter length of the bottom of isosceles trapezoid: ") ; bottomLength = mathInput.nextInt() ; mathInput.nextLine() ; System.out.print("Please enter height of Isosceles trapezoid: ") ; height = mathInput.nextInt() ; mathInput.nextLine() ; double trapArea = ((topLength + bottomLength)/2*(height)); System.out.println(); System.out.printf("The area of the isosceles trapezoid is: "+trapArea); } } If I enter say, 2 for topLength, 7 for bottomLength, and 3 for height, I will get an answer of 12.0, when it should result in an answer of 13.5. Does anyone know why my code is printing out wrong answers and not printing the .5?
has answer: http://stackoverflow.com/a/26110051
tagged with: math
has title: Math equation result loses decimals when displayed
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26110051
type: AnsweredQuestion

http://stackoverflow.com/a/26139191
has comment: http://stackoverflow.com/comment/40977810
has comment: http://stackoverflow.com/comment/40979202
type: Answer
has comment: http://stackoverflow.com/comment/40972149
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40977833
has body: So many questions these days abount not working examples from tutorialspoint :( Those tutorials are old, many things have changed. Change the old FilterDispatcher to the new StrutsPrepareAndExecuteFilter; Include commons-lang3-3.x.jar in your project; Change the version of your Servlet API according to a) your servlet-api-x.x.jar and b) your Servlet Container capabilities (eg. you need to ensure your Application Server is suporting Servlet API 3.0 if you want to use them... remember to not include the servelt-api jar in your WAR / EAR): you have a mixed config, specifying both 2.5 and 3.0 &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt; , fix that; Ensure you have all the required Struts2 libraries, all aligned to the latest version (2.3.16.3 currently), with all their dependences. Then it should work. After that, you can start looking for best practices, like using &lt;s: (default prefix for Struts2) instead of &lt;html: (default prefix for Struts1), and connecting to a database from a business/DAO layer instead that from the controller (Action).
answers question: http://stackoverflow.com/q/26138162
upvote count: 1
has comment: http://stackoverflow.com/comment/40976066
has comment: http://stackoverflow.com/comment/40974739
has comment: http://stackoverflow.com/comment/40975708

http://stackoverflow.com/a/26177836
has comment: http://stackoverflow.com/comment/41057119
has comment: http://stackoverflow.com/comment/41043537
accepted answer of: http://stackoverflow.com/q/26177772
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26177772
type: Answer
upvote count: 6
score: 6
has body: start() starts a new thread. The control of that new thread reaches your run() method. Your expectation for the control in the thread which executed start() to reach run() is illogical and, if it were met, would be self-defeating.
has comment: http://stackoverflow.com/comment/41053281

http://stackoverflow.com/comment/42950344
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26616549
has text: Yes, a login handler doesn't set any attributes except the principal name, typically.
type: AnswerComment

http://stackoverflow.com/q/26124506
has answer: http://stackoverflow.com/a/26124594
tagged with: java
type: UnansweredQuestion
has body: I recently developed a need to understand what's happening in JVM and I was looking for some documents or tutorials that would explain things like: What threads are being created on start and why? How GC is generally handling the memory, what is GC responsible for and how does it fit into JVM standards? How does JVM handle different types of invoke* opcodes? How does it perform method lookup? How is method area organised, what is exactly stored there? How do method stacks work with method areas? How does JVM handle threads, prepare and execute? I know that it will differ for different implementations, but I will take whatever materials you will give me. Something more closer to code than general overview of architecture. There are people that know cool sh*t and I don't know where to find it. I know that this question might sound naive :)
upvote count: 0
tagged with: jvm
favorite count: 0
type: Question
has title: JVM lifecycle description
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/26124552
downvote count: 1
has comment: http://stackoverflow.com/comment/40945098

http://stackoverflow.com/q/26125408
possible better answer: http://stackoverflow.com/a/26125502
has comment: http://stackoverflow.com/comment/40946852
linked to: http://stackoverflow.com/q/10775709
has comment: http://stackoverflow.com/comment/40947114
score: 6
has answer: http://stackoverflow.com/a/26125901
accepted answer: http://stackoverflow.com/a/26125901
type: AnsweredQuestion
has title: de/serialize java objects across different applications using different package names
downvote count: 0
tagged with: java
has body: I want to share java objects across different applications. As long as I use the same package names in the different projects it works fine. But if I change the package names it doesn't work anymore. I tried to solve this by extend the ObjectInputStream class and overriding the readClassDescriptor method. But by doing so I get the following error: java.io.StreamCorruptedException: invalid type code: 00 ... dont know how to solve this problem. Here is the code I use for the extended ObjectInputStream class: public class MyObjectInputStream extends ObjectInputStream { public static Map&lt;String, Class&gt; classNameMapping = initclassNameMapping(); private static Map&lt;String, Class&gt; initclassNameMapping(){ Map&lt;String, Class&gt; res = new HashMap&lt;String, Class&gt;(); //ipxTest is the name of the package where the objects got serialized res.put("ipxTest.IPX", interprojectxchangeTest.IPX.class); res.put("ipxTest.A", interprojectxchangeTest.A.class); return Collections.unmodifiableMap(res); } public MyObjectInputStream(InputStream in) throws IOException { super(in); enableResolveObject(true); } protected MyObjectInputStream() throws IOException, SecurityException { super(); enableResolveObject(true); } @Override protected java.io.ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass desc = super.readClassDescriptor(); if (classNameMapping.containsKey(desc.getName())) return ObjectStreamClass.lookup(classNameMapping.get(desc.getName())); return desc; } } The IPX and A classes both look equal in the different projects and have each the same serialID.
linked to: http://stackoverflow.com/q/9217010
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26125502
answer count: 2
upvote count: 6
tagged with: serializable

http://stackoverflow.com/a/26072115
answers question: http://stackoverflow.com/q/26071567
has comment: http://stackoverflow.com/comment/40850033
type: Answer
score: 3
upvote count: 3
has body: There is nothing wrong with your second solution. Assuming the use of Java 1.5 or above, I would use generics. For example: public abstract class Question&lt;T&gt; { public void addChoice(T newChoice); } public class MultipleChoice extends Question&lt;String&gt; { @Override public void addChoice(String newChoice) { // Do whatever you want here } } You could use Boolean for True/False questions. As Keale suggested, you could also just add all the choices to the Question before you add the Question to the list. Have you considered perhaps using a constructor where you supply all the items up front? Typecasting in the way you suggest for your first solution could eventually result in runtime errors if you attempt to cast something incorrectly. Say you have the following list of Question objects, by type: MultipleChoice MultipleChoice Boolean MultipleChoice Question When you loop over this list, you only know you have a list of Question objects. You have to check the type of each question before attempting to cast (using instanceof), or somehow keep track of which item in the list is of which type. Have a think about what will happen if you try to execute (MultipleChoice)list.get(2).
downvote count: 0
has comment: http://stackoverflow.com/comment/40849938

http://stackoverflow.com/comment/40969980
has text: Well it's not the correct answer I need to be able to log in to the original app on Facebook. There is an iOS app connected to it already with a lot of users. So I really need to fix the error on it
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26124693
type: AnswerComment

http://stackoverflow.com/comment/40952289
comment on: http://stackoverflow.com/a/26126344
score: 0
type: AnswerComment
has text: I was thinking this and change the underlying adapter data and thencall notifydatasetchanged
type: Comment

http://stackoverflow.com/a/26135744
has body: You can not cast array types. short[] can not be cast to byte[], etc. However, I think you could use generics to solve your problem: public &lt;T&gt; void foo(T[] ... params) { Class&lt;?&gt; clazz = params[0].getClass(); if (clazz.equals(short[].class)) { //... } else if ( ... ) { //... } else { throw new Exception("expected short[] or int[]"); } } You can't put clazz into switch, but if-else if-else sequence will be just a bit slower.
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40984324
accepted answer of: http://stackoverflow.com/q/26135629
type: Answer
has comment: http://stackoverflow.com/comment/40965591
answers question: http://stackoverflow.com/q/26135629
has comment: http://stackoverflow.com/comment/40965945
upvote count: 1

http://stackoverflow.com/comment/41010652
type: QuestionComment
comment on: http://stackoverflow.com/q/26159907
type: Comment
has text: yes, there is an **idiots's way** 1. add field `private isFinished = false;` 2. before postDelayed put `isFinished = false;` 3. after `allBt[x] [y]...` inside run put `isFinished = true;` and 4. before PART 3 add `while(!isFinished) { Thread.sleep(10); }` ... as i said **only idiots will do this** ... normal way it to put the PART 3 inside run() ... but it's your choice ...
score: 0

http://stackoverflow.com/a/26132163
has comment: http://stackoverflow.com/comment/40968270
type: Answer
has body: It isn't possible with DefaultHTTPClient, because the trust matching happens at a lower level, in the SSL stack (JSSE or OpenSSL or whatever Android uses). The simplest and cheapest solution is not to use a self-signed certificate at all. Use a CA-signed certificate. You've already spent more than it will cost, and you will spend far more in time that it can possibly be worth. Pay the money to a CA.
answers question: http://stackoverflow.com/q/26132046
score: 0

http://stackoverflow.com/comment/41001629
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26147123
type: Comment
has text: Additional note the Model is always created and merged with the one you add/create with `ModelAndView` or when using data binding the `BindingResult`. So it will always be there but you can choose to receive it or not.

http://stackoverflow.com/comment/40945363
comment on: http://stackoverflow.com/q/26124372
type: Comment
type: QuestionComment
has text: this.simpleJdbcCall = new SimpleJdbcCall(this.datasource);
score: 0

http://stackoverflow.com/a/26036451
has body: There are ways to do it. 1) JButton has inbuilt API setIcon. You could set ImageIcon here. 2) You could add mouse listener (Mouse entered, Mouse exited) change the icons to the needed ones. 3) Make a button round - Refer for creating the curvy buttons.
downvote count: 0
answers question: http://stackoverflow.com/q/26036002
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/26085079
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26085008
answers question: http://stackoverflow.com/q/26085008
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: You have to download the library folder! Then import it in your Eclipse from the File menu! After you have done this, you have to right click your project and reference the imported library as a library project in your original project! http://www.androidbegin.com/tutorial/implementing-actionbarsherlock-in-android/ This is a link for another library but the steps are the same.

http://stackoverflow.com/q/26131429
tagged with: reactive-programming
has title: Combining 'n' Observables of the same type (RxJava)
upvote count: 2
answer count: 1
tagged with: java
tagged with: observable
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40965750
score: 2
downvote count: 0
has body: I have a code flow that generates an Iterable of Observables of the same type. I then go through them all, combining them and returning the result as an Observable. At the moment I'm using zip with a FuncN, which seems horrible and I think I've missed the point somewhere. Here's an example that uses a Map, it's obviously nonsense but you get the idea. final ImmutableList.Builder&lt;Map&lt;String, Object&gt;&gt; observables = ImmutableList.builder(); for (String key: keys) { if (someTest(key)) { observables.add(generateObservableMap(key)); } } return Observable.zip(observables.build(), data -&gt; { final Map&lt;String, Object&gt; result = Maps.newHashMap(); // THIS IS REALLY UGLY for (Object d: data) { for (Object e: ((Map) d).entrySet()) { final Map.Entry entry = (Map.Entry) e; final String key = (Model) entry.getKey(); final Object value = (AuthData) entry.getValue(); result.put(key, value); } } return ImmutableMap.copyOf(result); }); I'm sure there's a better way of doing this.
favorite count: 0
has comment: http://stackoverflow.com/comment/40965810
type: Question
tagged with: rx-java
has answer: http://stackoverflow.com/a/26167503
tagged with: asynchronous

http://stackoverflow.com/a/26190834
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26190690
has body: This is easy to do, add the mouse listener to the table and use columnAtPoint and rowAtPoint to determine what has been clicked. If you want a table cell to look like a button, set a renderer that uses JButton.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26190690
type: Answer

http://stackoverflow.com/a/26137494
type: Answer
upvote count: 1
has body: I'm assuming you want the format "Result = a" which would be System.out.println("Result = " + result); Or you could use a since you set them to the same value
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26137469

http://stackoverflow.com/comment/40818636
has text: oh..i see, so is there a way i can make the row fit the whole tab/table.. thanks you for your help
comment on: http://stackoverflow.com/q/26055187
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26174219
downvote count: 2
has answer: http://stackoverflow.com/a/33065386
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/33065386
linked to: http://stackoverflow.com/q/25385173
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/36552377
type: Question
has comment: http://stackoverflow.com/comment/41037231
has answer: http://stackoverflow.com/a/26174283
tagged with: arrays
has comment: http://stackoverflow.com/comment/41037186
score: -1
has answer: http://stackoverflow.com/a/63079705
answer count: 6
has body: I've been trying to solve the warmup challenges on Hackerrank. For this particular challenge - https://www.hackerrank.com/challenges/cut-the-sticks - I've written some code, and although it seems logically correct to me, I'm not getting the right answer. My Code - import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int lengths[] = new int[n]; List&lt;Integer&gt; output = new LinkedList&lt;Integer&gt;(); for (int i = 0; i &lt; n; i++) lengths[i] = sc.nextInt(); sc.close(); Arrays.sort(lengths); for (int i = 0; i &lt; n; i++) { if (lengths[i] == 0) continue; else { output.add(n - i); for (int j = i; j &lt; n; j++) { // This loop isn't working like it should lengths[j] -= lengths[i]; // System.out.print(lengths[j] + " "); // For debugging purposes } // System.out.println(""); } } for (int i = 0; i &lt; output.size(); i++) System.out.println(output.get(i)); } } For the following input - 6 5 4 4 2 8 2 The output I get is - 6 5 4 3 2 1 The correct output should be - 6 4 2 1 I tried to display the values of the lengths array throughout the runs of the for loop marked in the code (with a comment), and this is what i get for the same inputs as above - 0 2 4 4 5 8 0 4 4 5 8 0 4 5 8 0 5 8 0 8 0 6 5 4 3 2 1 I'm totally stumped as to why this would happen.
has comment: http://stackoverflow.com/comment/46912366
favorite count: 0
has title: Cut the sticks: Hackerrank warmup challenge
accepted answer: http://stackoverflow.com/a/26174283
has comment: http://stackoverflow.com/comment/58215880
has answer: http://stackoverflow.com/a/37502583
has answer: http://stackoverflow.com/a/35667688

http://stackoverflow.com/q/26096059
tagged with: if-statement
tagged with: javascript
has answer: http://stackoverflow.com/a/26096246
score: 0
has answer: http://stackoverflow.com/a/26096220
has body: import java.util.Scanner; public class grade { public static void main(String args[]) { Scanner input = new Scanner(System.in); double no; System.out.print("Please enter your CPA: "); no = input.nextDouble(); if (2.00&lt;=no)//2.00&lt;=CPA&lt;= 2.49 System.out.println("forth class"); else if (2.50&lt;=no)//2.50&lt;=CPA&lt;=2.99 System.out.println("third class"); else if (3.00&lt;=no)//3.00&lt;=CPA&lt;=3.74 System.out.println("second class"); else if (3.74&lt;=no)//(no&gt;=3.75) System.out.println("first class"); else System.out.println("You did not follow the order."); } } if i enter for example i enter the grade 3.5 it will print out the forth class, also if i gave 4.00 also it will print out the forth class. Why it didnt print out the exact answer?
possible better answer: http://stackoverflow.com/a/26096137
answer count: 7
has answer: http://stackoverflow.com/a/26096137
has answer: http://stackoverflow.com/a/26096102
has answer: http://stackoverflow.com/a/26096181
has comment: http://stackoverflow.com/comment/40894848
has answer: http://stackoverflow.com/a/26098286
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40894378
has comment: http://stackoverflow.com/comment/40894811
type: Question
has answer: http://stackoverflow.com/a/26096212
has title: grading with if else statement
accepted answer: http://stackoverflow.com/a/26096102

http://stackoverflow.com/a/26076770
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26076542
has body: You can use this: String.valueOf(valueLong);

http://stackoverflow.com/comment/40911770
has text: remove and reinstall your app
comment on: http://stackoverflow.com/q/26106032
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40963086
has text: I copy/paste your code and everything is ok while I change filepaths... be sure to have access to "D:\Eman Hamed\Academics\Fall 14\Computer Vision\flower.jpg" and "D:\Eman Hamed\Academics\Fall 14\Computer Vision\flower2.jpg"
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26132926

http://stackoverflow.com/q/26126828
tagged with: maven-plugin
has body: I am using activation based on file exists in my pom.xml. However, my profile is ALWAYS executed, no matter what. Here is the profile description: copy file.xml org.apache.maven.plugins maven-antrun-plugin 1.7 copy-resources validate <copy file="${basedir}/src/main/resources/application.${env}.properties" tofile="${basedir}/src/main/fabric8/io.fabric8.system.properties" /> run I call my profile like this: mvn package -Pcopy But the profile is always called, no matter if the file is present or not. What am I doing wrong? Thanks Romain.
favorite count: 0
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: activation
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40957078
type: Question
has title: Activation in my maven profile is ignored (profile always executed) using file exist
upvote count: 2
has answer: http://stackoverflow.com/a/26128586
accepted answer: http://stackoverflow.com/a/26128586
answer count: 1

http://stackoverflow.com/comment/40963720
score: 0
type: Comment
type: QuestionComment
has text: Yes, sorry, I must have made a mistake when changing the variable names. In the original code there are no "". When removing them the problem still persists.
comment on: http://stackoverflow.com/q/26130624

http://stackoverflow.com/a/26113185
has comment: http://stackoverflow.com/comment/40927207
score: 0
upvote count: 1
type: Answer
downvote count: 1
has body: If an instance of class A has a reference to an instance of class B and that instance of class B has a reference to the same instance of class A, both would not be eligible for GC as long as those references exist. BTW, in your example, the Child instance is assigned to a local method variable inside the Parent class, so once that method is done, the Child instance would be eligible for GC, regardless of whether or not it holds a reference to the Parent instance that created it. Now, if you'd store the Child instance reference in a member of the Parent class, you'd have a circular reference. Then, if the code that cerated the Parent instance loses all references to the Parent instance, the circular references can never be removed, so both objects won't become eligible for GC. Consider this exmaple : public class Parent{ private Child child; public Parent { child = new Child(this); } public static void main (String[] args) { while (true) { parent = new Parent(); } } } public class Child{ Parent parent; public Child(Parent parent){ this.parent = parent; } } Here, the main method's infinite loop would create in each iteration a new instance of Parent and Child that would never be eligible for GC, so it would eventually run out of memory.
has comment: http://stackoverflow.com/comment/40924479
has comment: http://stackoverflow.com/comment/40927067
answers question: http://stackoverflow.com/q/26113146
has comment: http://stackoverflow.com/comment/40924685
has comment: http://stackoverflow.com/comment/40926897
has comment: http://stackoverflow.com/comment/40924606

http://stackoverflow.com/q/26038771
type: AnsweredQuestion
upvote count: 3
has body: i have a list View which contains imageView, TextView and two Buttons what i want is when i click on the button for example for the third item in the list view i want to get the text that in the textview when i click on the button which is in the same position as the text view.. how to do that in my list view adapter inside getView() in the onclicklistener ? here is my SimpleArrayAdapter.java public class MySimpleArrayAdapter extends ArrayAdapter&lt;String&gt; { private final Context context; private final String[] values; public MySimpleArrayAdapter(Context context, String[] values) { super(context, R.layout.my_listview, values); this.context = context; this.values = values; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.my_listview, parent, false); Button d=(Button) rowView.findViewById(R.id.d); Button a=(Button) rowView.findViewById(R.id.a); TextView textView = (TextView) rowView.findViewById(R.id.label); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); textView.setText(values[position]); // Change the icon for Windows and iPhone String s = values[position]; if (s.startsWith("Windows7") || s.startsWith("iPhone") || s.startsWith("Solaris")) { imageView.setImageResource(R.drawable.no); } else { imageView.setImageResource(R.drawable.ok); } d.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // here where i want to get the current textview text Log.d(null, ""); /*Intent intent = new Intent(context, MainActivity2.class); context.startActivity(intent);*/ } }); a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d(null, "aaaaaaaaaaaaaaaaa"); } }); return rowView; } }
has answer: http://stackoverflow.com/a/26038861
has title: how to get textView text in onclicklistener inside listView adapter
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26038826
tagged with: eclipse
tagged with: listview
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26038831
accepted answer: http://stackoverflow.com/a/26038826
has answer: http://stackoverflow.com/a/26038831
has answer: http://stackoverflow.com/a/26038891
tagged with: android
answer count: 4

http://stackoverflow.com/a/26119276
upvote count: 3
answers question: http://stackoverflow.com/q/26080818
downvote count: 0
has body: to remove data from an array of a Parse Tab List&lt;String&gt; ary_users = new ArrayList&lt;String&gt;(); ParseQuery&lt;ParseObject&gt; queryPart1 = ParseQuery.getQuery("Channel"); queryPart1.whereEqualTo("objectId",channel_id); queryPart1.findInBackground(new FindCallback&lt;ParseObject&gt;() { @Override public void done(List&lt;ParseObject&gt; list, ParseException e) { if (e==null) { if (list.size()&gt;0) { ParseObject p = list.get(0); if (p.getList("usersArray")!=null) { ary_users = p.getList("usersArray"); } else { ary_users = null; } if (ary_users!=null) { if (ary_users.contains(frnd_objid)) { ary_users.remove(frnd_objid); p.put("usersArray",ary_users); p.saveInBackground(new SaveCallback() { @Override public void done(ParseException arg0) { Toast.makeText(activity,frnd_name+ "is successfully removed in the channel"+channel_name,Toast.LENGTH_LONG).show(); } }); } } } } } }); } Here "usersArray" is an Array of table "Channel" .And I am removing "frnd_objid" from the "usersArray"
score: 3
type: Answer

http://stackoverflow.com/comment/41059907
has text: Please explain the actual problem. Not only is this a case where something like a map will do what you described, it isn't indexing.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26186338

http://stackoverflow.com/comment/40854364
comment on: http://stackoverflow.com/q/26074717
has text: @headsvk hmm thats strange, because i got it to work with side to side. (left to right) and then i used for(;;) to make it loop.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40817620
type: Comment
comment on: http://stackoverflow.com/q/26054657
type: QuestionComment
has text: Old school approach: put your receiver logic in some Servlet, which may start threads at it's discretion. Then invoke the EJB when all messages have arrived.
score: 0

http://stackoverflow.com/comment/40913336
comment on: http://stackoverflow.com/a/26106792
type: AnswerComment
has text: @Pokechu22 I understand, see second link - that's what you need
score: 0
type: Comment

database
tags question: http://stackoverflow.com/q/26157804
tags question: http://stackoverflow.com/q/26125128
tags question: http://stackoverflow.com/q/26156171
tags question: http://stackoverflow.com/q/26189180
tags question: http://stackoverflow.com/q/26117619
tags question: http://stackoverflow.com/q/26137083
tags question: http://stackoverflow.com/q/26079072
tags question: http://stackoverflow.com/q/26110164
tags question: http://stackoverflow.com/q/26122006
tags question: http://stackoverflow.com/q/26068865
type: Tag
tags question: http://stackoverflow.com/q/26093997
tags question: http://stackoverflow.com/q/26092608
tags question: http://stackoverflow.com/q/26047486
tags question: http://stackoverflow.com/q/26063913
tags question: http://stackoverflow.com/q/26096227
tags question: http://stackoverflow.com/q/26172994
tags question: http://stackoverflow.com/q/26073604
tags question: http://stackoverflow.com/q/26094841
tags question: http://stackoverflow.com/q/26076124
tags question: http://stackoverflow.com/q/26173181
tags question: http://stackoverflow.com/q/26176139
tag name: database
tags question: http://stackoverflow.com/q/26111350
tags question: http://stackoverflow.com/q/26084657
tags question: http://stackoverflow.com/q/26154920
tags question: http://stackoverflow.com/q/26170370
tags question: http://stackoverflow.com/q/26123161
tags question: http://stackoverflow.com/q/26155609
tags question: http://stackoverflow.com/q/26143415
tags question: http://stackoverflow.com/q/26044877
tags question: http://stackoverflow.com/q/26084797
tags question: http://stackoverflow.com/q/26124223
tags question: http://stackoverflow.com/q/26147412
tags question: http://stackoverflow.com/q/26052064

http://stackoverflow.com/q/26125334
has comment: http://stackoverflow.com/comment/40952278
favorite count: 0
tagged with: ajax
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40951737
linked to: http://stackoverflow.com/q/19295746
tagged with: playframework-2.0
answer count: 0
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40946616
tagged with: java
tagged with: multiple-file-upload
has title: Example of using Ajax to upload multiple files in Play framework 2.3.0 (Java)
downvote count: 0
has body: I am looking for an example of using Ajax to upload multiple files in Play java framework. This is the HTML form: Upload And this is the only thing I found in Play documentation: public static Result upload() { File file = request().body().asRaw().asFile(); return ok("File uploaded"); } I don't know how to send the files via Ajax and how to split them in Play. BTW, I was able to do it via the form action.

http://stackoverflow.com/a/26127258
has comment: http://stackoverflow.com/comment/40962333
downvote count: 0
score: 1
has body: Your serlvet class must extend the javax.servlet.http.HttpServlet class, public class calc extends the javax.servlet.http.HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException { ..... For your second error, I,m not sure why are you getting this error could be another config for inject objects, but to solve this problem you must create a public constructor with no arguments. public class calc extends the javax.servlet.http.HttpServlet { public calc() {} public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException { .....
has comment: http://stackoverflow.com/comment/40962454
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26126425
has comment: http://stackoverflow.com/comment/40951068
has comment: http://stackoverflow.com/comment/40951614
accepted answer of: http://stackoverflow.com/q/26126425
has comment: http://stackoverflow.com/comment/40982314
type: Answer

http://stackoverflow.com/q/26174622
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26174749
accepted answer: http://stackoverflow.com/a/26174631
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26174749
has title: Android: Format string to html - add new lines
upvote count: 1
duplicate of: http://stackoverflow.com/q/3056834
type: Question
has comment: http://stackoverflow.com/comment/41038409
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/26174631
linked to: http://stackoverflow.com/q/3056834
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26175176
has comment: http://stackoverflow.com/comment/41038460
has body: I need to format text coming from user to HTML, but the input is multiple line and I have to replace all "enters" from that string to HTML &lt;br /&gt; tags. String message = messageEditText.getText().toString(); This is the message I want to format. How can I format the string accordingly?
tagged with: string-formatting
tagged with: android

http://stackoverflow.com/comment/40862612
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26078617
has text: The problem is that the limiting factor is not the speed of your system but the connection bandwith. So executing more threads in paralel will make each http request go slower and in the end it will take the same time.
type: Comment

http://stackoverflow.com/comment/41064582
comment on: http://stackoverflow.com/q/26188665
score: 0
has text: @Jonatan Cloutier, I added my code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40972775
score: 0
type: AnswerComment
type: Comment
has text: List<Image>. Shouldn't it stay generic `Object` ?
comment on: http://stackoverflow.com/a/26138964

http://stackoverflow.com/a/26172868
score: 0
type: AcceptedAnswer
type: Answer
has body: So I figured out what I was doing wrong. It's really a silly mistake. I apologize. Here's the solution for those interested: Original code: return inflater.inflate(R.layout.score_collection, container, false); I was returning the view all over again when I should have just returned v (View v). So I changed the return statement above to return v; instead and it works. Silly me.
accepted answer of: http://stackoverflow.com/q/26169249
answers question: http://stackoverflow.com/q/26169249

http://stackoverflow.com/a/26048907
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40807377
has comment: http://stackoverflow.com/comment/40808387
downvote count: 0
has comment: http://stackoverflow.com/comment/40807680
accepted answer of: http://stackoverflow.com/q/26048702
has comment: http://stackoverflow.com/comment/40808667
type: Answer
has comment: http://stackoverflow.com/comment/40807543
upvote count: 1
has body: Where does your startTime within the onTick() method come from? If it's an instance-variable of your MyTimer-class, you have forgotten to mention that. Furthermore, it's a long, a time-value in milliseconds just as the millisInFuture-value. That means, you should do something like this: timeElapsed = (startTime - millisUntilFinished) / 1000; And you can make timeElapsed a local variable of the onTick()-method. Update after disclosure of full code: Please add a startTime instance variable to your MyTimer-class, which you initialize properly in the MyTimer-constructor, because you use MyTimer in two places with two different start times, but in onTick(), you use the startTime instance variable from the outer class, which is only valid for the first instance (countDownTimer).
has comment: http://stackoverflow.com/comment/40808489
has comment: http://stackoverflow.com/comment/40808551
has comment: http://stackoverflow.com/comment/40808248
score: 1
answers question: http://stackoverflow.com/q/26048702
has comment: http://stackoverflow.com/comment/40808309

http://stackoverflow.com/a/26102469
answers question: http://stackoverflow.com/q/26102187
has body: If I understand your question, one solution is to call setTimeZone() in your convertedTime DateFormat and pass it the result of getTimeZone() from your fileDateImport DateFormat. That is, something like - DateFormat fileDateImport =new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); try { Date d = fileDateImport.parse("Wed, 24 Sep 2014 00:00:00 BST"); final SimpleDateFormat convertedTime =new SimpleDateFormat("ddMMyyyyHHmmss"); convertedTime.setTimeZone(fileDateImport.getTimeZone()); if ("24092014000000".equals(convertedTime.format(d))) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (ParseException e) { e.printStackTrace(); } Which outputs Passed because it passes your unit test. The primary differences are using the TimeZone from the parser (and using HH instead of hh for hours).
has comment: http://stackoverflow.com/comment/40905947
score: 3
has comment: http://stackoverflow.com/comment/40906078
has comment: http://stackoverflow.com/comment/40905670
upvote count: 3
has comment: http://stackoverflow.com/comment/40907377
has comment: http://stackoverflow.com/comment/40905397
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40906007
has comment: http://stackoverflow.com/comment/40905429

http://stackoverflow.com/q/26069704
linked to: http://stackoverflow.com/q/20646022
has comment: http://stackoverflow.com/comment/40846089
has comment: http://stackoverflow.com/comment/40885503
has comment: http://stackoverflow.com/comment/40846093
has comment: http://stackoverflow.com/comment/40885768
has comment: http://stackoverflow.com/comment/40845792
has comment: http://stackoverflow.com/comment/40845669
has comment: http://stackoverflow.com/comment/40846440
has comment: http://stackoverflow.com/comment/40885531
tagged with: java
linked to: http://stackoverflow.com/q/145110
tagged with: new-operator
type: Question
tagged with: object
score: 5
has comment: http://stackoverflow.com/comment/40846355
has comment: http://stackoverflow.com/comment/40845741
upvote count: 5
tagged with: arrays
tagged with: runtime
has comment: http://stackoverflow.com/comment/40878656
has comment: http://stackoverflow.com/comment/40845691
has comment: http://stackoverflow.com/comment/40845762
has comment: http://stackoverflow.com/comment/40847143
has answer: http://stackoverflow.com/a/26077472
has comment: http://stackoverflow.com/comment/40873777
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40845641
favorite count: 0
has comment: http://stackoverflow.com/comment/40846040
has comment: http://stackoverflow.com/comment/40845851
has body: This query is posted to basically understand points like An object is class instance or an array; An array is a subclass of Object class; Everything that is instantiated other than primitive is an object in Java. Here is my understanding of working with arrays in Java. Considering the below program, /* dummy.java */ class C { private int i; public C() { i = 1; System.out.println("Am in constructor"); } } public class dummy { public static void main(String[] args) { C[] c = new C[2]; // Line 11 c[0] = new C(); System.out.println(c); } } An object of type class [LC is created in run-time after running, C[] c = new C[2]; //Line 11 In the above code. class [LC is an immediate subclass of Object class. Reference variable c points to this object (shown in red boundary below) after running Line 12 in the above code. Reference variables sit in stack and an object of type class C will go in heap. For a below change of line 11 &amp; 12 in the above code C[][] c = new C[2][2]; c[0][0] = new C(); will make the representation as shown below. Is my understanding correct? If yes, Can you please explain more on usage of class [LC in run time to instantiate an object? Note: C[].class gives the actual type in run-time, which is class [LC.
has comment: http://stackoverflow.com/comment/40847022
has comment: http://stackoverflow.com/comment/40846920
has comment: http://stackoverflow.com/comment/40845654
type: UnansweredQuestion
has title: How array works internally in Java?
has comment: http://stackoverflow.com/comment/40845708
has comment: http://stackoverflow.com/comment/40845975

http://stackoverflow.com/comment/40831234
has text: possible duplicate of [What is the reason behind "non-static method cannot be referenced from a static context"?](http://stackoverflow.com/questions/290884/what-is-the-reason-behind-non-static-method-cannot-be-referenced-from-a-static)
score: 0
comment on: http://stackoverflow.com/q/26062051
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40877772
has text: Decompose your problem in smaller ones. Create a method `boolean isIntContainedInList(int i, OrderedIntList list)`. Then create a method boolean isIntContainedInAllTheLists(int i, OrderedIntList[] listArray), that uses the previous method. Those should be very simple methods, but once you have them, the algorithm becomes much easier to implement.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26087278

http://stackoverflow.com/comment/40819217
comment on: http://stackoverflow.com/q/26055630
type: QuestionComment
has text: Shame the JVM doesn't have the equivalent of an AppDomain (Isolate what?) .. anyway the approach mentioned, of starting a separate process/JVM and using IPC to transfer the data, sounds like a "suitable" hack; barring actually using a library that is implemented half-correctly. (But maybe there are some methods that can be called *manually* to release the underlying resources? These should be documented if they exist.)
score: 0
type: Comment

http://stackoverflow.com/a/36636765
answers question: http://stackoverflow.com/q/26042753
has body: extglob can match a number of regex constructs (pattern-list is a list of alterations): extglob regex -------------- ----------------- ? [^/] * [^/]* . \. ** . ?(pattern-list) (pattern-list)? *(pattern-list) (pattern-list)* +(pattern-list) (pattern-list)+ @(pattern-list) (pattern-list) !(pattern-list) (?!pattern-list) There are some things that regex does that cannot be done in extglob, as far as I know, too: ?????????????? [^abc] ?????????????? \1 ?????????????? most look arounds Assuming all of the constructs in the regex have extglob equivalents, it would be possible to convert it to extglob form. It would be difficult, because regexes are represented by a CFG. And you're using Java, which forces you to use the evil escaped escape \\. Why not just use a different bash utility that supports regexes? Like this.
score: 0
type: Answer

http://stackoverflow.com/q/26193924
tagged with: java
has comment: http://stackoverflow.com/comment/41073373
has comment: http://stackoverflow.com/comment/41073275
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41073844
has comment: http://stackoverflow.com/comment/41073607
upvote count: 0
downvote count: 5
possible better answer: http://stackoverflow.com/a/26208837
has title: Simple Coding Problems
has comment: http://stackoverflow.com/comment/41073292
has comment: http://stackoverflow.com/comment/41073679
favorite count: 0
has answer: http://stackoverflow.com/a/26208837
has body: In the country of Rahmania, the cost of mailing a letter is 40 sinas for letters up to 30 grams. Between 30 g and 50 g, it is 55 sinas. Between 50 g and 100 g, it is 70 sinas. Over 100 g, it costs 70 sinas plus an additional 25 sinas for each additional 50 g (or part thereof). For example, 101 grams would cost 70 + 25 = 95 sinas. 149 g would also cost 95 sinas, because both of these packages only use the first 50 g over 100 g. Write a program that prompts the user for a mass and then gives the cost of mailing a letter having that mass. This is the question and the only part I don't know how to do is the last part with the additional 25 sinas for each additional 50g. Can someone show me how to write this part of the code? I use netbeans btw. Scanner input = new Scanner(System.in); double l; l = input.nextInt(); x = l &gt;= 100 / 50 * 25 + 70; if (l &lt;= 30) { System.out.println("40 Sinas"); } if (l &gt; 30 &amp;&amp; l &lt; 50) { System.out.println("55 Sinas"); } if (l &gt; 50 &amp;&amp; l &lt; 100) { System.out.println("70 Sinas"); } if (l &gt;= 100) { System.out.println(""); } Here's the important part of the code. As you can see I need help on the last part.
has answer: http://stackoverflow.com/a/26194167
accepted answer: http://stackoverflow.com/a/26194167
has comment: http://stackoverflow.com/comment/41073808
type: AnsweredQuestion
score: -5

http://stackoverflow.com/comment/40950027
score: 0
type: AnswerComment
type: Comment
has text: i had an idea that the problem is due to version mix. but the link to owl 4 api example brings about 404 error. can u refer link to correct example?
comment on: http://stackoverflow.com/a/26126955

http://stackoverflow.com/a/26123065
has comment: http://stackoverflow.com/comment/40945732
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40947296
has comment: http://stackoverflow.com/comment/40944531
has comment: http://stackoverflow.com/comment/40983298
has comment: http://stackoverflow.com/comment/40946977
has comment: http://stackoverflow.com/comment/40947170
has comment: http://stackoverflow.com/comment/40947108
accepted answer of: http://stackoverflow.com/q/26122523
has comment: http://stackoverflow.com/comment/40979562
has comment: http://stackoverflow.com/comment/40943699
type: Answer
answers question: http://stackoverflow.com/q/26122523
has comment: http://stackoverflow.com/comment/40945874
has body: In the persistence context annotation add another attribute like this: @PersistenceContext(unitName = "AbcPU", type = PersistenceContextType.EXTENDED) Then it may work.
has comment: http://stackoverflow.com/comment/40948337
has comment: http://stackoverflow.com/comment/40946545
has comment: http://stackoverflow.com/comment/40960281
has comment: http://stackoverflow.com/comment/40980723
has comment: http://stackoverflow.com/comment/40945261
has comment: http://stackoverflow.com/comment/40982626
has comment: http://stackoverflow.com/comment/40982522
score: 0

http://stackoverflow.com/comment/40961257
has text: The easiest solution is just to re-roll Perlin noise (with slightly changed values, obviously) any time you don't hit within the map. Not sure what that'll do to your total distribution of points though. And it may take a while to get out of that "bad" area.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26132410

http://stackoverflow.com/comment/40793885
score: 0
has text: you shouldn't have capitalized the variable "URL" cuz there exist a class called `java.net.URL`
type: QuestionComment
comment on: http://stackoverflow.com/q/26041628
type: Comment

http://stackoverflow.com/comment/40877642
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26087278
has text: your question is good, yet your code looks :(

http://stackoverflow.com/a/26095333
score: 3
has comment: http://stackoverflow.com/comment/40983207
has comment: http://stackoverflow.com/comment/40948496
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26093460
has comment: http://stackoverflow.com/comment/40953651
has comment: http://stackoverflow.com/comment/40946817
type: Answer
has body: Sometimes we can't see the forest for the trees... and JLabel can't display rich text If your need is having rich text in a table renderer, then (maybe) that's the question! JLabel in fact does render rich text through HTML [Doc], and even you can use JXLabel from SwingX for further functionality (rotation! line break!). Considering that DefaultTableRenderer is in fact a JLabel maybe you can extend it and do a simple modification: public class AATableRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { DefaultTableCellRenderer c = (DefaultTableCellRenderer) super .getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); String text = c.getText(); // Do some style transformations maybe... c.setText("&lt;html&gt;" + text + "&lt;/html&gt;"); return c; } } or you can modify your JTable in the prepareRenderer() method public class AATable extends JTable { public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); if (c instanceof JLabel) { JLabel l = (JLabel) c; String text = l.getText(); // Do some style transformations maybe... l.setText("&lt;html&gt;" + text + "&lt;/html&gt;"); } return c; } } But maybe you can't use the HTML thing... In that case, if you have to stick to your custom component you might have to do it per look and feel as each is managed on their own way. For instance note that sometimes this properties are set in the system and most Swing L&amp;Fs respect them (Windows 7 configures this in My Computer > Properties > Advanced System Configuration > Performance > Smooth fonts (a check in the list)). I don't think you can reuse the LabelUI (the basic one) because maybe all that magic interferres in the way you want to paint when you just want the smoothing... Not sure, it's not impossible but I can't tell. THIS IS THE ANSWE…
upvote count: 3
has comment: http://stackoverflow.com/comment/41005288
answers question: http://stackoverflow.com/q/26093460

http://stackoverflow.com/comment/40872263
type: Comment
has text: @arnobpl Drawing at (x-1,y-1) is a nice and simple solution, assuming that the actual size does not matter. (And that's what SHE said...). It would probably also be possible to draw all images with their original size into another, large `BufferedImage` (with a size of (screenSizeX/10,screenSizeY/10), and then draw this image on the screen (with a graphics that is scaled by (10,10)). But this may also be a bit fiddly, and it's hard to say whether this has potential drawbacks for your application case. (It should not affect performance too much, but one has to think about how well it may work)
score: 1
comment on: http://stackoverflow.com/a/26075922
type: AnswerComment

http://stackoverflow.com/comment/40858730
comment on: http://stackoverflow.com/q/26076404
type: QuestionComment
type: Comment
has text: Can you place the stacktrace as well ??
score: 0

http://stackoverflow.com/comment/40835308
comment on: http://stackoverflow.com/a/26064104
type: Comment
has text: They scaled down properly for me always. make sure the asset you provide is a good one, thats's it!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40871391
type: Comment
comment on: http://stackoverflow.com/a/26081284
type: AnswerComment
score: 0
has text: @ChristianEscobarF 0.1 cannot be represented as a finite sum of negative powers of 2 ([good reading on the subject](http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/)).

http://stackoverflow.com/q/26104557
has comment: http://stackoverflow.com/comment/40913626
has comment: http://stackoverflow.com/comment/40914868
has comment: http://stackoverflow.com/comment/40912078
answer count: 0
has body: I am working on screen fading in and out transition and currently my stage only consist of a background image and a image button (will have one more button in future). The problem now is the background fading work but not the imagebutton. Any idea how I can easily "group" the stage all together and fadeout all at once? This is my current code: public class MyActor extends Actor { @Override public void draw( SpriteBatch batch, float parentAlpha ) { batch.setColor( 1, 1, 1, 1*parentAlpha ); batch.draw( AssetLoader.bg, 0, 0, ZBGame.VIRTUAL_WIDTH, ZBGame.VIRTUAL_HEIGHT ); batch.draw( AssetLoader.zbLogo, ZBGame.VIRTUAL_WIDTH / 2-140, ZBGame.VIRTUAL_HEIGHT-AssetLoader.zbLogo.getRegionHeight(), AssetLoader.zbLogo.getRegionWidth(), AssetLoader.zbLogo.getRegionHeight()); TextureAtlas buttons = new TextureAtlas( Gdx.files.internal("data/texture.txt") ); Skin skin = new Skin( buttons ); ImageButtonStyle btnStyle = new ImageButtonStyle(); btnStyle.up = skin.getDrawable("startBtn"); ImageButton button = new ImageButton(btnStyle); button.addListener(new InputListener( ) { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { stage.addAction( Actions.sequence( Actions.fadeOut(.5f), Actions.run( new Runnable( ) { @Override public void run() { game.setScreen(new OptionScreen( game ) ); } }) ) ); return true; } stage.addActor(button); } } @Override public void show() { stage = new Stage( ); Gdx.input.setInputProcessor(stage); MyActor myActor = new MyActor( ); stage.addActor(myActor); stage.addAction( Actions.sequence( Actions.alpha(0), Actions.fadeIn(1)) ); } @Override public void render(float delta) { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); stage.act(delta); stage.draw(); }
tagged with: java
has comment: http://stackoverflow.com/comment/40920474
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/40909773
score: 0
has comment: http://stackoverflow.com/comment/40910251
has title: Imagebutton not fading out
tagged with: imagebutton
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/40978872
type: Comment
comment on: http://stackoverflow.com/q/26141110
type: QuestionComment
score: 0
has text: Okay ... Please tell me one thing if I am using secured API(HTTPS Based) then how may I get valid certificate for that ? As for now I am generating keystore file using keytool

http://stackoverflow.com/comment/40819831
comment on: http://stackoverflow.com/q/26055881
score: 0
type: QuestionComment
type: Comment
has text: try replase `T` to `EntityBase<T>` in `EntityBase.createNewEntity` declaration

http://stackoverflow.com/comment/40848351
type: Comment
comment on: http://stackoverflow.com/a/26066523
score: 0
type: AnswerComment
has text: Hii @walkeros, thanks for your valuable suggestion. But I want to avoid(if possible) **http overhead** (serialization and de-serialization )because these two apps are closely related to each other, hence always going to be on same server. I am interested it something like **Unix Domain Sockets**. But don't have idea how to achieve this(or something like this).

http://stackoverflow.com/comment/40960997
type: Comment
comment on: http://stackoverflow.com/a/26133175
has text: Yes, but as you are not calling it, it is continuing on to `System.out.println ( "I don't have a teacher in that room." );`
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40960564
has text: That's interesting. Can you elaborate on the breaking into multiple arrays method in an answer? Thanks!
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26132734

http://stackoverflow.com/comment/40788663
has text: The link didn't help me. Sorry.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26036587
type: QuestionComment

http://stackoverflow.com/comment/40898438
comment on: http://stackoverflow.com/q/26098633
type: Comment
type: QuestionComment
has text: Of course, an Spring + Hibernate web app. I can understand it can take some second to load, but what a big difference between a startup load and a delayed start!
score: 0

http://stackoverflow.com/a/26053719
score: 0
answers question: http://stackoverflow.com/q/26046308
type: Answer
has body: In the end I've loaded the studentId only and modified the mapping inside the recipient to include the studentId as well: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "STD_ID", insertable=false, updatable = false) private Student student; @Column(name = "STD_ID", nullable = false) private Long studentId; now I can simply set the studentId and the performance is much better.

http://stackoverflow.com/comment/41055109
score: 0
type: AnswerComment
has text: How exactly is that implemented?
type: Comment
comment on: http://stackoverflow.com/a/26183784

http://stackoverflow.com/q/26138587
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41224904
has comment: http://stackoverflow.com/comment/41223664
has comment: http://stackoverflow.com/comment/40973569
favorite count: 0
has comment: http://stackoverflow.com/comment/41225988
has comment: http://stackoverflow.com/comment/41226355
has title: Android Alarm Manager Set Repeating at Specific Timing
has comment: http://stackoverflow.com/comment/41211767
tagged with: android
has body: I am having some problem with alarm manager in Android. So what I am trying to do is set the alarm to repeat to run the DB insertion every day around 12.01AM. Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0 ); calendar.set(Calendar.MINUTE, 1); notificationCount = notificationCount + 1; AlarmManager mgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent notificationIntent = new Intent(context, ReminderAlarm.class); notificationIntent.putExtra("NotifyCount", notificationCount); PendingIntent pi = PendingIntent.getBroadcast(context, notificationCount, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi); So basically I've came up with these code. However, the alarm manager execute again after the minute I set it. Let's say I run the apps on 01/10/2014 5.48PM. I wanted this to run the DB insertion when onReceive every day after I set it around 12.01AM only. But somehow, the alarm manager execute at 01/10/2014 5.49PM which is one minute after I set it and it stopped working. I wonder which part I did wrongly. Thanks in advance. EDIT Recurring class For this class, it will trigger the alarm manager everyday and pass the variables along to reminder alarm class for DB insertion. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recurring); context = this; buildListView(); if(!alarmInitialized(this)) { scheduleAlarms(this); } } // And the few methods you suggested to schedule the alarm public static void scheduleAlarms(Context context) { Calendar calendar = Calendar.getInstance(); if (hasRunnedToday(context)) { // if the alarm has run this day calendar.add(Calendar.DATE, 1); // schedule it to run again starting // tomorrow } long firstRunTime = calendar.getTimeInMillis(); AlarmManager mgr = (Alar…
has comment: http://stackoverflow.com/comment/40973328
type: UnansweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12034357
upvote count: 1
type: Question
tagged with: date
tagged with: recurring
tagged with: alarmmanager
has comment: http://stackoverflow.com/comment/41222599
has answer: http://stackoverflow.com/a/26277222
has comment: http://stackoverflow.com/comment/40971639
has comment: http://stackoverflow.com/comment/40973365
has comment: http://stackoverflow.com/comment/40971218
has comment: http://stackoverflow.com/comment/41225234
has comment: http://stackoverflow.com/comment/40971278

http://stackoverflow.com/q/26043085
tagged with: java
has comment: http://stackoverflow.com/comment/40796538
tagged with: eclipse
type: Question
tagged with: debugging
answer count: 2
has title: Debug Exception Breakpoints in multiple sub packages
has comment: http://stackoverflow.com/comment/40801310
score: 0
accepted answer: http://stackoverflow.com/a/26043228
tagged with: exception
favorite count: 0
upvote count: 1
has body: I get the following error in my application: Error has occured with message: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction. Somewhere in my code I expect there is an exception being thrown that is being swallowed without re-throwing or printing the stacktrace and that marks my transaction as dirty. The set of code under suspicion is quite large (very large) so just stepping through it won't cut it. Eclipse supports breaking whenever a exception is thrown, caught or uncaught. Problem is that I'm running in the context of JBoss which also throws exceptions. Is there a way with the exception filtering to tell Eclipse to only break on code that is in a certain package and its sub packages. The keyword here being sub packages. I can't add just the packages I want because the list of packages is large. Hundreds of potential ones. All of our packages start with za.co so was wondering if there was a way to specify something like za.co.** which would match za.co and all of the sub packages.
possible better answer: http://stackoverflow.com/a/26043169
downvote count: 1
has answer: http://stackoverflow.com/a/26043169
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26043228

http://stackoverflow.com/comment/41014019
comment on: http://stackoverflow.com/q/26075614
has text: @OliverCharlesworth Why don't you post it as an answer?
score: 0
type: Comment
type: QuestionComment

smartgwt
tags question: http://stackoverflow.com/q/26034859
tags question: http://stackoverflow.com/q/26143031
type: Tag
tags question: http://stackoverflow.com/q/26176483
tag name: smartgwt

http://stackoverflow.com/q/26094183
has comment: http://stackoverflow.com/comment/40897396
tagged with: cookies
linked to: http://stackoverflow.com/q/1106377
tagged with: java
type: Question
has title: Set cookie in java, read in javascript
tagged with: javascript
has comment: http://stackoverflow.com/comment/40891731
upvote count: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40898313
has answer: http://stackoverflow.com/a/26112800
has comment: http://stackoverflow.com/comment/40891207
favorite count: 0
type: UnansweredQuestion
has body: I'm trying something similar to this: Detect when browser receives file download I'm using Chromes Developer Tools to monitor my cookies and my problem is that the cookies I set in my server side code (java in my case) are only visible on the request. Not when I check the Resources tab in Chrome Dev Tools. I think it might have something to do with the fact that my request is submitted by constructing a hidden form and submitting this (I'm using ExtJS 4.2.2). All I can see in my Resources tab is the JSESSIONID cookie from Tomcat. Can anyone help me set cookies from java that I can read in JavaScript after the request completes? Screenshots:
score: 2

http://stackoverflow.com/a/37447260
type: Answer
has body: Check the answer, Installer for Jitsi SIP Communicator and modify the bat file with below content: set JAVA_HOME=&lt;Your Java Home&gt; set PATH=%JAVA_HOME%\bin;&lt;ApacheBinPath&gt;;c:\mingw\bin;c:\MinGW\msys\1.0\bin;c:\Program Files (x86)\WiX Toolset v3.10 set ANT_HOME=&lt;Ant Home&gt; set BZ2_HOME=altel\src\native\windows\setup set LZMA_HOME=c:\mingw\xz set MINGW_HOME=c:\mingw start /B /LOW /WAIT ant build-installation-wix It worked for me
answers question: http://stackoverflow.com/q/26133676
has comment: http://stackoverflow.com/comment/62397077
score: 0

http://stackoverflow.com/q/26159214
has comment: http://stackoverflow.com/comment/41009066
score: 2
tagged with: java-7
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41009175
has title: JDK6 -> JDK7 cant use com.sun.xml.internal.stream.XMLInputFactoryImpl
has answer: http://stackoverflow.com/a/36282691
favorite count: 0
has comment: http://stackoverflow.com/comment/41008949
type: Question
upvote count: 2
tagged with: maven
answer count: 1
has body: we have the following case in the code which causes tests to fail when running with JAVA_HOME set to JDK7 instead of JDK6 (maven with source/target = 1.6) javax.xml.stream.FactoryConfigurationError: Provider for com.sun.xml.internal.stream.XMLInputFactoryImpl cannot be found at javax.xml.stream.XMLInputFactory.newFactory(XMLInputFactory.java:239) the code itself private static final String SUN_XML_INPUT_FACTORY = "com.sun.xml.internal.stream.XMLInputFactoryImpl"; private final XMLInputFactory xmlInputFactory; public theConstructor() { // When deployed to WebLogic 10.3.5 it will use "weblogic.xml.stax.XMLStreamInputFactory" which will // cause a StreamReader exception as it requires some input stream other than null. xmlInputFactory = XMLInputFactory.newFactory(SUN_XML_INPUT_FACTORY, this.getClass().getClassLoader()); } I suppose I should use something else than private static final String SUN_XML_INPUT_FACTORY = "com.sun.xml.internal.stream.XMLInputFactoryImpl"; but i don't know what.
tagged with: jdk6
has comment: http://stackoverflow.com/comment/41008955
tagged with: java

http://stackoverflow.com/q/26184453
accepted answer: http://stackoverflow.com/a/26210479
has comment: http://stackoverflow.com/comment/41056384
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/454908
tagged with: java
has answer: http://stackoverflow.com/a/26210479
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26184499
has comment: http://stackoverflow.com/comment/41056363
favorite count: 0
has comment: http://stackoverflow.com/comment/41056345
has body: The following regular expression matches the character a: "a" The following regular expression matches all characters except a: "[^a]" The following regular expression matches a ton of characters: "." How do I match everything that is not matched by "."? I can't use the same technique as above: "[^.]" because inside the brackets, the . changes meaning and only stands for the character . itself :(
downvote count: 2
has title: Can I negate the dot?
tagged with: regex
upvote count: 4
has comment: http://stackoverflow.com/comment/41056409
has comment: http://stackoverflow.com/comment/41056434
has comment: http://stackoverflow.com/comment/41056395
possible better answer: http://stackoverflow.com/a/26184499

http://stackoverflow.com/comment/40818447
type: QuestionComment
score: 3
has text: It's already is expanded the full size. You just need to add more rows. What you are seeing is the scoll pane's view port that is reserving space for the table. If rows are more than will fit in the view, you will see the scroll bars.
comment on: http://stackoverflow.com/q/26055187
type: Comment

http://stackoverflow.com/comment/40892893
score: 0
comment on: http://stackoverflow.com/q/26087826
type: Comment
type: QuestionComment
has text: Do you really need to decode the image, before encoding it (ie., are you planning to do any image processing on the image, or need to convert it to JPEG)? If not, this is easily avoided by just copying the bytes from the file to the servlet `OutputStream`. As a bonus, it's also much faster.

http://stackoverflow.com/comment/40864168
comment on: http://stackoverflow.com/a/26079844
type: Comment
has text: How would i get the keys/values from my original map from this?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41000398
has text: @SotiriosDelimanolis give me a working solution. What to write inside JSP file?
score: 0
comment on: http://stackoverflow.com/q/26154487
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40800407
score: 2
has text: You don't have to switch to maven when developing in Java. sbt can do the job very well. Just place your `.java` files under `src/main/java` and give `run` a go! You don't even have to have `build.sbt` in a project to use sbt provided the project follows the standard project structure with `src/main/{scala|java}`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26044705

http://stackoverflow.com/q/26039047
has body: This is how I have organized my data: I've created an Application class in my Android project In the Application Class I have an ArrayList Of Objects In the other Activities I call some methods of Application Class that return to me a portion of the aforementioned list Now the scenario that puzzles me: In a certain Activity If a button is pressed I check if there is an internet connection If there isn't one I start an Intent to open Settings for the user to enable mobile networks or WiFi when It returns though it seem that the application is destroyed because onCreate is called again but at that time the arrayList in my Application class is this time null. So my questions are why is my activity destroyed and not just paused ? If it is destroyed why my app won't start itself from the beginning but it starts only from the Activity that started Activity Action.Settings? If only the latest Activity is Destroyed and not the whole app, how come the data in Application are lost? this Is how I've declared the ArrayList of objects in my Application class private static ArrayList&lt;PointOfInterest&gt; pois; EDIT: I put a Log.i() on onDestroy() of the Activity and it was never printed. But on When I returned from the Settings, onCreate() was called (without onDestroy having been called), how is that possible?
accepted answer: http://stackoverflow.com/a/26039380
has title: An Android scenario that puzzles me
linked to: http://stackoverflow.com/q/9541688
score: 0
tagged with: java
answer count: 1
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40789904
has answer: http://stackoverflow.com/a/26039380
type: Question
has comment: http://stackoverflow.com/comment/40789695
tagged with: android

http://stackoverflow.com/a/26104526
type: Answer
answers question: http://stackoverflow.com/q/26104411
has comment: http://stackoverflow.com/comment/40909043
has body: Are you using javascript or jsp? Any Case is easy, this will return your value: $("#MyId").val(); In your case it would be: $("#indicator").val();
has comment: http://stackoverflow.com/comment/40909309
has comment: http://stackoverflow.com/comment/40908929
downvote count: 1
has comment: http://stackoverflow.com/comment/40908856
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/40909241

http://stackoverflow.com/q/26174975
has comment: http://stackoverflow.com/comment/41038585
has body: I am using this code: ProcessBuilder builder = new ProcessBuilder("cmd.exe","java","invalidArg"); builder.redirectErrorStream(true); try { Process p = builder.start(); BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()),10240); String line; if(processIsTerminated(p)){ line = r.readLine(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Is there a way to have the cmd window open as well when I use the .start() function? Currently it runs hidden and if there is no response I don't know if my command was ran successfully or it didn't run at all.
tagged with: processbuilder
tagged with: cmd
has answer: http://stackoverflow.com/a/26176563
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26176563
tagged with: java
type: Question
score: 0
has title: Fire a cmd.exe command through ProcessBuilder with visual window
answer count: 1

http://stackoverflow.com/a/26202664
has body: Use the Job Explorer as suggested by Luca Basso Ricci. Because you do not know the job parameters you need to look up by instance. Look for the last instance of job named searchExportJob Look for the last execution of the instance above This way you use Spring Batch API only //We can set count 1 because job instance are ordered by instance id descending //so we know the first one returned is the last instance List&lt;JobInstance&gt; instances = jobExplorer.getJobInstances("searchExportJob",0,1); JobInstance lastInstance = instances.get(0); List&lt;JobExecution&gt; jobExecutions = jobExplorer.getJobExecutions(lastInstance); //JobExcectuin is ordered by execution id descending so first //result is the last execution JobExecution je = jobExecutions.get(0); if (je != null &amp;&amp; je.getEndTime() != null) { endTime = new DateTime(je.getEndTime()); } Note this code only work for Spring Batch 2.2.x and above in 2.1.x the API was somewhat different
accepted answer of: http://stackoverflow.com/q/26166992
type: Answer
has comment: http://stackoverflow.com/comment/122330276
answers question: http://stackoverflow.com/q/26166992
downvote count: 0
score: 6
type: AcceptedAnswer
upvote count: 6

executorservice
type: Tag
tags question: http://stackoverflow.com/q/26080044
tags question: http://stackoverflow.com/q/26138537
tag name: executorservice
tags question: http://stackoverflow.com/q/26098927
tags question: http://stackoverflow.com/q/26142063

http://stackoverflow.com/a/26096236
has comment: http://stackoverflow.com/comment/40894922
score: 0
has comment: http://stackoverflow.com/comment/40894559
type: Answer
has body: I'll write an example in a singleton but I recommend using spring or container equivalent to use 1 single bean to do this. public class Counter { private static Counter instance; private static int COUNT_MAX_VALUE = 1000000; public static synchronized Counter getInstance() { if (instance == null) { instance = new Counter(); } return instance; } // -- end of static features -- private int counter; public Counter() { this.counter = 0; } // return result public synchronized int getCount() { return counter; } // increment by 1, then return result public synchronized int addAndGetCount() { addCount(); return getCount(); } // increment by 1 public synchronized int addCount() { if (++counter &gt;= COUNT_MAX_VALUE) { counter = 0; } } }
answers question: http://stackoverflow.com/q/26095752

http://stackoverflow.com/q/26166554
upvote count: 1
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26167201
answer count: 2
tagged with: intellij-idea
has title: This version of the rendering library is more recent than your version of IntelliJ IDEA
downvote count: 0
has answer: http://stackoverflow.com/a/26166982
favorite count: 0
possible better answer: http://stackoverflow.com/a/26166982
tagged with: android
has body: I know this has been asked a million times before on StackOverflow and I tried all the solutions but this only started to occur after I added the Android support library jar to my libs folder and I recently added a view like such below: &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:id="@id/viewPager" &gt; &lt;/android.support.v4.view.ViewPager&gt; Here's the error log I'm getting: org.jetbrains.android.uipreview.RenderingException: This version of the rendering library is more recent than your version of IntelliJ IDEA. Please update IntelliJ IDEA at org.jetbrains.android.uipreview.LayoutLibraryLoader.load(LayoutLibraryLoader.java:90) at org.jetbrains.android.sdk.AndroidTargetData.getLayoutLibrary(AndroidTargetData.java:149) at com.android.tools.idea.rendering.RenderService.create(RenderService.java:167) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:583) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1900(AndroidLayoutPreviewToolWindowManager.java:80) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6$1.run(AndroidLayoutPreviewToolWindowManager.java:528) at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178) at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6.run(AndroidLayoutPreviewToolWindowManager.java:523) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) at…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26167201

http://stackoverflow.com/comment/40818076
has text: use : `Scanner sc = new Scanner(System.in)`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26055052

http://stackoverflow.com/comment/40804351
type: Comment
has text: Bingo! You need to wait until the thread is done before calling ' finish(); '.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26047266

http://stackoverflow.com/comment/40897277
has text: yeah, it is opensource but I guess only jar is available, no source code I could find
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26097290

exception
tags question: http://stackoverflow.com/q/26043085
tags question: http://stackoverflow.com/q/26104171
tags question: http://stackoverflow.com/q/26170716
tags question: http://stackoverflow.com/q/26068809
tags question: http://stackoverflow.com/q/26138714
tags question: http://stackoverflow.com/q/26067684
tags question: http://stackoverflow.com/q/26034483
tags question: http://stackoverflow.com/q/26130913
tags question: http://stackoverflow.com/q/26178156
tags question: http://stackoverflow.com/q/26092458
tags question: http://stackoverflow.com/q/26163971
tags question: http://stackoverflow.com/q/26130608
tags question: http://stackoverflow.com/q/26191801
tags question: http://stackoverflow.com/q/26189274
tags question: http://stackoverflow.com/q/26157850
tags question: http://stackoverflow.com/q/26102185
tags question: http://stackoverflow.com/q/26158337
tags question: http://stackoverflow.com/q/26192929
type: Tag
tags question: http://stackoverflow.com/q/26116141
tags question: http://stackoverflow.com/q/26192847
tags question: http://stackoverflow.com/q/26184510
tags question: http://stackoverflow.com/q/26081809
tags question: http://stackoverflow.com/q/26145841
tags question: http://stackoverflow.com/q/26179103
tags question: http://stackoverflow.com/q/26078106
tags question: http://stackoverflow.com/q/26193893
tags question: http://stackoverflow.com/q/26037807
tags question: http://stackoverflow.com/q/26106719
tags question: http://stackoverflow.com/q/26117958
tags question: http://stackoverflow.com/q/26193918
tags question: http://stackoverflow.com/q/26134896
tags question: http://stackoverflow.com/q/26178774
tags question: http://stackoverflow.com/q/26137995
tags question: http://stackoverflow.com/q/26105318
tag name: exception
tags question: http://stackoverflow.com/q/26054460
tags question: http://stackoverflow.com/q/26179702
tags question: http://stackoverflow.com/q/26148571
tags question: http://stackoverflow.com/q/26182024
tags question: http://stackoverflow.com/q/26097173
tags question: http://stackoverflow.com/q/26087708
tags question: http://stackoverflow.com/q/26038092
tags question: http://stackoverflow.com/q/26090706
tags question: http://stackoverflow.com/q/26138531
tags question: http://stackoverflow.com/q/26123711
tags question: http://stackoverflow.com/q/26137573
tags question: http://stackoverflow.com/q/26048321

http://stackoverflow.com/q/26110926
type: Question
has comment: http://stackoverflow.com/comment/40920689
has comment: http://stackoverflow.com/comment/40920670
has comment: http://stackoverflow.com/comment/40920950
score: 0
has comment: http://stackoverflow.com/comment/40920907
has title: Is this a good solution for comparing String to Date?
answer count: 0
has comment: http://stackoverflow.com/comment/40920740
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40920613
tagged with: java
has body: Ok, I am building app for mobile phone so the app needs to very little memory. In Database I have the string in yyyy-MM-dd format, example "1980-11-17". I also have a list of 121 consecutive dates like this: "1977-12-12", "1978-11-13", "1979-12-14","1980-12-16",... I compare string rather than convert the String to Date. if(yyyyMmDd.compareTo("1977-12-12")&gt;=0 &amp;&amp; yyyyMmDd.compareTo("1978-11-13")&lt;=0){ return 1; } else if(yyyyMmDd.compareTo("1979-12-14")&lt;=0){ return 2; } else if(yyyyMmDd.compareTo("1980-12-16")&lt;=0){ return 3; } ..... need to do another 119 times The goal is to let the computer to use as little energy as possible. Others may require to convert String to java Date but i am not sure if it is better than compareTo String
has comment: http://stackoverflow.com/comment/40920622

http://stackoverflow.com/a/26039325
has comment: http://stackoverflow.com/comment/40789379
has body: You can either forward it or redirect it. To forward, you can use RequestDispatcher RequestDispatcher rd = request.getRequestDispatcher("abc.jsp"); rd.forward(request, response); To redirect, response.sendRedirect("abc.jsp"); FYI, Difference between the two, In Forwarding, the same request object is forwarded to the next resource (Servlet or JSP) and in Redirecting client (browser) is asked to send a new request to the server for the next resource (servlet or JSP).
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40789316
downvote count: 0
answers question: http://stackoverflow.com/q/26039313

http://stackoverflow.com/comment/40801309
has text: @DavidConrad: My question comes from the fact that the documentation for that class on the Android platform says only: `Convenient access to the most important built-in charsets.`
type: Comment
comment on: http://stackoverflow.com/a/26043877
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40850559
has text: @MeenaChaudhary Why not a List? Your lift is like an index on a sorted list of floors...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26058700
score: 0

http://stackoverflow.com/a/26087686
answers question: http://stackoverflow.com/q/26087652
upvote count: 2
has body: Create a new folder C:\Test\ptest, move Test.class to c:\Test\ptest\Test.class. cd\Test, then java -cp . ptest.Test The package structure corresponds to the output directory structure. From Managing Source and Class Files (The Java Tutorials), Put the source code for a class, interface, enumeration, or annotation type in a text file whose name is the simple name of the type and whose extension is .java. For example: //in the Rectangle.java file package graphics; public class Rectangle { ... } Then, put the source file in a directory whose name reflects the name of the package to which the type belongs: .....\graphics\Rectangle.java The qualified name of the package member and the path name to the file are parallel, assuming the Microsoft Windows file name separator backslash (for UNIX, use the forward slash). class name – graphics.Rectangle pathname to file – graphics\Rectangle.java
has comment: http://stackoverflow.com/comment/40878329
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26087652
score: 2
downvote count: 0

http://stackoverflow.com/q/26146731
has comment: http://stackoverflow.com/comment/40987216
accepted answer: http://stackoverflow.com/a/26147300
has comment: http://stackoverflow.com/comment/40985930
answer count: 4
has comment: http://stackoverflow.com/comment/40986193
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40986566
possible better answer: http://stackoverflow.com/a/26147070
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26147070
has answer: http://stackoverflow.com/a/26147415
type: Question
has comment: http://stackoverflow.com/comment/40985954
has body: Right, vague as that topic might have been, let me just start by confessing that this is a homework related question. So if you have some fun vendetta against those kinds of questions, be warned. I've been sitting with it for a good few hours though, and I'm quit embarrassed to not have "gotten it" yet. So I was hoping some of you could show me what I'm missing. I am to make a class, which stores a variable, and remembers the next object of that class. The following is my main class: public class SticksAndStones { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String response = "n"; Stick currentStick = null; int numberOfSticks = 0; while (response.equals("n")) { System.out.println("What diameter should the stick have?"); response = Integer.toString(scan.nextInt()); currentStick = new Stick(Integer.parseInt(response), currentStick); numberOfSticks++; System.out.println("Are you done adding sticks? ('n' or 'y')"); response = scan.next(); while (!response.equals("y") &amp;&amp; !response.equals("n")) { System.out.println("Please type 'y' for yes, or 'n' for no."); response = scan.next(); } } for (int i = 0; i &lt; numberOfSticks; i++) { System.out.println(currentStick.getDiameter()); currentStick = currentStick.getNext(); } } } My Stick class looks like: public class Stick { int diameter; Stick stick; public Stick(int diameter, Stick stick) { this.diameter = diameter; this.stick = stick; } public int getDiameter() { return diameter; } public Stick getNextStick() { return stick; } Now as you can see, my class seems able to remember the previous stick, but not the next one in any way. The reason this is a problem, is because at the bottom of my SticksAndStones class, I try to print the diameters of each stick out, but they don't come out in the correct order. In other words, the first stick comes out last, and the last stick comes out first. Which I don't need. I need them to come out the other way around. First stick in, as first stick …
has comment: http://stackoverflow.com/comment/40986307
has answer: http://stackoverflow.com/a/26147300
has title: Having an object remember the next object of its kind
has comment: http://stackoverflow.com/comment/41076176
has comment: http://stackoverflow.com/comment/40985897
has answer: http://stackoverflow.com/a/26147033
has comment: http://stackoverflow.com/comment/40985925
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26137539
score: 2
tagged with: performance
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40968707
has comment: http://stackoverflow.com/comment/40968740
type: Question
has title: Optimize two lists comparison
has body: I have two lists (A and B ) of Contacts, coming from an SQL DB. On my application I need to display a comparison table of these lists, based on the contact name. If a Contact with name A exists in list A but not B, the details of contact A are marked green and next to it I have empty red space (for missing entry from list B. If a contact name exists in B and not in A, B is marked green. If a contact name exists in both lists, but with a difference in address, both contacts are marked yellow. I am generating both a CSV comparison, and a paginated interface. Currently, my not-so-optimal solution will first create a third list with all the contact names from A and B, removing duplicates. Next (if paginating) I will apply the offset + size. Finally with the remaining entries, I will search A and B by contact name (from new list), and call a comparison method that will tell me what color marking to do. This was working ok for the datasizes I got, up to 4 -5k, with 2sec delays in pagination. Although I know this is not an ideal solution, but can't think of a better one. Also I got some new features (filter changes/additions/deletions) coming which will not work optimally with this method. What other approach can I use to this comparison problem? Update Controller code: //createCompareList() based on parameters generate HQL query and pull contacts from Contact table def listA = createCompareList(params) def listB = createCompareList(params) def unionList = listA.collect{it.details.name}.plus(listB.collect {it.details.name}) unionList = unionList.unique() result.unionListSize = unionList.size() unionList.sort() And the rest comparison happens in GSP (this will be moved to the controller, and pass something that requires less processing in GSP) C ontact name List A List B <g:each in="${unionList}" var="unionName"> <g:set var="listAContact" value="${listA.find {it.details.name.equals(unionName)}}"/> <g:set var="listBContact" value="${listB.find {it.details.name.equals(unionNa…
tagged with: comparison
tagged with: grails
upvote count: 2
has comment: http://stackoverflow.com/comment/40968679
tagged with: groovy
has answer: http://stackoverflow.com/a/26138193
has answer: http://stackoverflow.com/a/26137825
has answer: http://stackoverflow.com/a/26198300
favorite count: 0
has comment: http://stackoverflow.com/comment/40968846
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40968890
has answer: http://stackoverflow.com/a/26137854
has answer: http://stackoverflow.com/a/26137759

http://stackoverflow.com/q/26094013
has comment: http://stackoverflow.com/comment/40891526
has comment: http://stackoverflow.com/comment/40891722
has comment: http://stackoverflow.com/comment/40891149
has answer: http://stackoverflow.com/a/26095153
accepted answer: http://stackoverflow.com/a/26095153
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to write out a 2-dimensional array in java so that a C program can read it
type: Question
has comment: http://stackoverflow.com/comment/40893200
tagged with: arrays
tagged with: http://stackoverflow.com/tag/c
upvote count: 3
downvote count: 2
answer count: 1
linked to: http://stackoverflow.com/q/6599548
has body: I am writing to write out a 2-dimensional binary array in Java so that a legacy program written in C can read it. But if I use ObjectOutputStream's writeObject method it adds more bytes . What I mean is that output file contains more bytes than required. I guess I could write out the 2-dimensional array in C or C++ but before I do that wanted to know what the other possibilities are.
favorite count: 0

http://stackoverflow.com/q/26114296
score: 0
tagged with: ejb-3.1
tagged with: session-scope
has body: I have a @SessionScoped Bean which stores information about the logged in user: @SessionScoped public class LoggedInUser implements Serializable { private static final long serialVersionUID = 1L; private String id; private String firstName; private String lastName; private String email; private Country country; private List&lt;String&gt; groups; private Set&lt;Role&gt; roles; ... } AuthenticationFilter: public class AuthenticationFilter implements Filter { @Inject private LoggedInUserTo loggedInUser; public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; // initial = setting log in user informations // afterwards several checks (role, same user) } This session scoped bean is injected in several @Stateless beans: @Inject private LoggedInUser loggedInUser; Now I want to logout a user: public void logout() { // this.httpServletRequest.getSession(false).invalidate(); this.loggedInUser = new LoggedInUserTo(); } After that the next time my AuthenticationFilter (also have an injected LoggedInUser) get called, the loggedInUser object is empty and I set new user information. But afterwards if a @Stateless bean get called which contains an injected LoggedInUser object the object is not set correctly. But if I called the service twice the new LoggedInUser informations are set correctly. What I have to do that all @Stateless beans getting the new LoggedInUser informations?
tagged with: java
has comment: http://stackoverflow.com/comment/40926913
type: Question
has comment: http://stackoverflow.com/comment/40927024
tagged with: ejb
has comment: http://stackoverflow.com/comment/40926792
has title: EJB 3.1 - @SessionScoped Bean holding Logged In Information - Logout Issue
has comment: http://stackoverflow.com/comment/40930327
has comment: http://stackoverflow.com/comment/40927090
tagged with: resteasy
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40826619
score: 0
comment on: http://stackoverflow.com/q/26059533
has text: Guys, please don't down vote a person who has no reputation
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40862744
comment on: http://stackoverflow.com/q/26074023
score: 0
type: Comment
type: QuestionComment
has text: There is no such thing like “templatized” in Java. `GetTypeInfo` will always perform the same action regardless of the Generic type arguments, i.e. read the same `static` field in your case. Since you have only one field in your code, it is only good for detecting whether the initializer of `Subclass` which overwrites that field has been executed. [fabian explained why it hasn’t](http://stackoverflow.com/a/26074392/2711488)

http://stackoverflow.com/comment/77172280
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26098399
has text: Good question. Maybe it's a simple trick to avoid trying to double the size of a 0-length array. If you find out, please let me know.
type: AnswerComment

http://stackoverflow.com/q/26096132
has answer: http://stackoverflow.com/a/33561382
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
has title: Set the image duration with jcodec in android
has body: i am making an app that makes a video with few pictures. my problem is that the video with 20 or 30 images have a 1 second duration. I create the encoder in my OnCreate method and in a Timer, i use this encoder.encodeNativeFrame(pic); The Timer run each second. And when i press a finish button, i add this code encoder.finish(); But when i view the video, i view all images in one second. Can i set the duration? For example, add one image every second? Thanks in advance
has comment: http://stackoverflow.com/comment/40894180
tagged with: jcodec
score: 0
has answer: http://stackoverflow.com/a/49104772
has comment: http://stackoverflow.com/comment/40895549
tagged with: android

complexity-theory
tags question: http://stackoverflow.com/q/26088747
type: Tag
tag name: complexity-theory
tags question: http://stackoverflow.com/q/26089948

http://stackoverflow.com/comment/40907416
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26102194
has text: @user1990950 You could set `angle = angleTo` if the distance is less than `deltaSeconds * 200`, and put the rest of your code in an `else`-statement. (I.e. if the distance is not less than `deltaSeconds * 200`)
type: Comment

http://stackoverflow.com/comment/40813338
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26052268
type: Comment
has text: He told us that we HAVE to use a "for" loop and I've tried almost everything I know but still stuck

http://stackoverflow.com/comment/40986783
has text: In the end no there isn't. However the `Model` gets pre-populated with some values (especially if you use path variables) whereas the second doesn't. Also returning a `String` instead of a `ModelAndView` is a lot easier.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26147123

http://stackoverflow.com/comment/41034857
comment on: http://stackoverflow.com/a/26170404
has text: @newacct They accept the same class of arguments but if you want to refer to the generic type, you'll need the more verbose syntax. Since in the OP, `test` returns `void` and has an empty body, you could argue that we don't want to refer to the type anyway, but speaking generally, the verbose syntax is also more powerful.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26151428
has body: I'm making a program that will take an input string and decode it using the Rot13 encryption method. This takes the alphabet, and rotates it by 13. I'm having a hard time getting the index of a letter in the list, and every time I run it it gives me -1 as if the item is not in the list. I looked in the java documentation, and indexOf() asks for an object. I tried explicitly typing my input as an object but that didn't work either. This is the code I have so far: package rot13; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; /** * * @author andrewjohnson */ public class CipherKey { List&lt;String&gt; alpha = Arrays.asList("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " "); List&lt;String&gt; alphaRev = Arrays.asList("Z", "Y", "X", "W", "V", "U", "T", "S", "R", "Q", "P", "O", "N", "M", "L", "K", "J", "I", "H", "G", "F", "E", "D", "C", "B", "A", " "); public String codeDecode(String s) { System.out.println(s); for (int i = 0; i &lt; s.length(); i++) { char ch = s.charAt(i); //System.out.println(ch); int x = alpha.indexOf(ch); //System.out.println(x); String y = alphaRev.get(x); System.out.print(y); } return null; } public static String readInput() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter message to be encoded or decoded"); String s = br.readLine().toUpperCase(); //System.out.println(s); return s; } } And my main(): /** * * @author andrewjohnson */ public class Rot13 { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { CipherKey x = new CipherKey(); x.codeDecode(x.readInput()); } } I'm not sure why it is not working, but I've narrowed it down to the line: int x = alpha.indexOf(ch); Not being able to find ch in alpha. I'm new to Java and I've tried everything tha…
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26151517
tagged with: encryption
upvote count: 1
type: AnsweredQuestion
tagged with: list
has title: Iterate through List of single character strings using indexOf()
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26151487
has answer: http://stackoverflow.com/a/26151515
tagged with: indexof
downvote count: 0
accepted answer: http://stackoverflow.com/a/26151487
possible better answer: http://stackoverflow.com/a/26151515

http://stackoverflow.com/q/26053697
tagged with: jersey
answer count: 1
tagged with: jersey-2.0
downvote count: 0
favorite count: 0
tagged with: rest
has body: I have used Jersey 2 to expose functionality (restful API). Where I want to access form parameter at filter level, the way we have accessed pathparam,queryparam from `ContainerRequestContext. Filter:- public class SecurityFilter implements ContainerRequestFilter, ContainerResponseFilter { private ResourceInfo ResourceInfo; // ignore this public SecurityFilter(ResourceInfo ResourceInfo) { } @Override public void filter(ContainerRequestContext ctx) throws IOException { MultivaluedMap<String, String> pathparam = ctx.getUriInfo().getPathParameters(); MultivaluedMap<String, String> queryparam = ctx.getUriInfo().getQueryParameters(); // Here I want all form parameters } // ignore this @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { } } So how can I get the form parameters from ContainerRequestContext in above filter? EDIT : I have one way to get form data is ((ContainerRequest) context).bufferEntity(); // Read entity FormDataMultiPart multiPart = ((ContainerRequest) context).readEntity(FormDataMultiPart.class); String myValue = multiPart.getField("foo").getValue(); But this won't work for large file because ((ContainerRequest) context).bufferEntity() contain entity in memory so Exceptionorg.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: Java heap space exception occur.
tagged with: form-submit
upvote count: 3
type: UnansweredQuestion
has title: How to get form data parameters from ContainerRequestContext
has comment: http://stackoverflow.com/comment/41725401
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26551708

http://stackoverflow.com/comment/40989663
type: Comment
has text: Post your OrderCon class.
comment on: http://stackoverflow.com/q/26148637
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40848852
type: QuestionComment
has text: @Sotirios Delimanolis i haven't done mapping yet. This was an exercise on understanding 2d arrays. i know different data types aren't possible in a single array. The requirement was creating an object with a 2d array. one for string representing country and the other representing integer. How do you go about that?
comment on: http://stackoverflow.com/q/26071073
score: 0
type: Comment

http://stackoverflow.com/comment/40831270
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26061971
has text: @Yann4 Of course. I ran the code in a debug-mode and the end of the string differs from that there is in the file.
score: 0

http://stackoverflow.com/comment/95098189
has text: The link to Either seems to have been deleted. Are you sure the project is still being supported ?
comment on: http://stackoverflow.com/a/26163151
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26186747
upvote count: 2
has body: Figured it out. The two places I tripped over my shoelaces were: Needed to register https with the PoolingHttpClientConnectionManager Set TLSv1 as the only supported protocol in the SSLConnectionSocketFactory package httpcomponents; import java.io.IOException; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpHead; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.LayeredConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLContexts; import org.apache.http.conn.ssl.TrustStrategy; import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; /** * * @author mark.jones */ public class HttpTest3 { public static void main(String[] args) { CloseableHttpClient closeableHttpClient = null; CloseableHttpResponse closeableHttpResponse = null; try { HttpHead httpHead = null; TrustStrategy trustStrategy = null; SSLContext sslContext = null; X509HostnameVerifier x509HostnameVerifier = null; LayeredConnectionSocketFactory sslConnectionSocketFactory = null; Registry&lt;ConnectionSocketFactory&gt; registry = null; PoolingHttpClientConnectionManager poolingHttpClientConn…
answers question: http://stackoverflow.com/q/26166121
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26166121
score: 2

http://stackoverflow.com/comment/41019096
type: Comment
type: QuestionComment
has text: possible duplicate of [Changing Cell Color without changing color in other cells (Jtable)](http://stackoverflow.com/questions/24555289/changing-cell-color-without-changing-color-in-other-cells-jtable)
comment on: http://stackoverflow.com/q/26161702
score: 0

http://stackoverflow.com/q/26104101
score: 0
tagged with: client
has comment: http://stackoverflow.com/comment/40923950
has title: Jersey Client resulting in 415 Unsupported media type
accepted answer: http://stackoverflow.com/a/26173093
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40923877
type: Question
tagged with: jersey
answer count: 1
tagged with: media
has comment: http://stackoverflow.com/comment/40908090
has body: The obvious reason for this would be not providing proper content type. But I am providing. Still i am getting Unsupported Media Type. Not sure why. Any help greatly appreciated. Client c = Client.create(); WebResource resource = c.resource(HOST+"/test"); Gson gson = new Gson(); Test test = new Test(); test.setTestName("TEST AUTOMATION"); resource.header("Content-Type", "Application/json"); String testStr = gson.toJson(test); System.out.println("Request Str: "+testStr); ClientResponse response = resource.post(ClientResponse.class, testStr); System.out.println("POST response : "+response); POST response : POST http://host:8888/test returned a response status of 415 Unsupported `enter code here`Media Type
has comment: http://stackoverflow.com/comment/40908540
has answer: http://stackoverflow.com/a/26173093

http://stackoverflow.com/a/26132764
type: Answer
has body: I would prefer the Java built-in routines when possible - as I said in my comment Integer.parseInt(numberInput, 2);. By convention, Java method names begin with a lower case letter. Finally, you can fix your code (and I added a small test harness) with something like, public static int binaryToNumber(String numberInput) { if (numberInput == null) { return 0; } int ret = 0; char[] ni = numberInput.trim().toCharArray(); for (int i = 0; i &lt; ni.length; i++) { if (ni[i] == '1') { // This is 2 ^ (n) where (n) is based on the position from the right. ret += 1 &lt;&lt; ni.length - i - 1; } } return ret; } public static void main(String[] args) { for (int i = 0; i &lt; 10; i++) { String t = Integer.toBinaryString(i); System.out.printf("%s = %d%n", t, binaryToNumber(t)); } }
answers question: http://stackoverflow.com/q/26132591
score: 0

http://stackoverflow.com/q/26163281
has comment: http://stackoverflow.com/comment/41018273
has body: I would like to to make a http request though a socket connection. Here's how I am forming my proxy. SocketAddress addr = new InetSocketAddress(proxyHost, proxyPort); Proxy proxy = new Proxy(Proxy.Type.HTTP, addr); socket = new Socket(proxy); If I change the proxy type to socks and point it to a socks proxy, then it works. So I am not too sure why it's not working when I set the type to http and point it to an http proxy server. The error I receive lies within the Socket.class and the error is Invalid Proxy.
score: 0
answer count: 1
tagged with: proxy
type: UnansweredQuestion
has title: Java HTTP Proxy thought Socket connection
has comment: http://stackoverflow.com/comment/41017274
tagged with: java
has answer: http://stackoverflow.com/a/50475158
has comment: http://stackoverflow.com/comment/41017128
type: Question

http://stackoverflow.com/comment/40904396
has text: from activity , show me the parameter you are passing in the constrcutor.May be you are passing getAppicationContext().If so, pass the "activityname.this" in the constructor
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26101159
score: 0

http://stackoverflow.com/comment/40863839
comment on: http://stackoverflow.com/q/26079112
type: Comment
type: QuestionComment
has text: Sorry again. It would be nice if Stack Overflow had the option for sending the "forgive me" gift.
score: 0

http://stackoverflow.com/q/26148322
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26148337
has title: Java String Conditional Break Not Working
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/7520432
tagged with: conditional-statements
tagged with: java
has body: I wrote a simple program which prompts the user to enter a sentence, word, or number, and then prints input is art. I put the program on an infinite loop so that the prompt would repeat. However, now I'm trying to add a way to quit by saying if (input == "quit") break; however it does not seem to be working. It just continues the infinite loop. Here is the full code: import java.util.Scanner; public class Art { public static void main(String [] args) { Scanner input = new Scanner(System.in); String a; for ( ; ; ) { System.out.println("Please enter something: "); a = input.nextLine(); if (a == "quit") break; System.out.print("\n"); System.out.println(a + " is art."); System.out.print("\n"); } } } Any help would be lovely, thanks!
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/2265503
score: 1
possible better answer: http://stackoverflow.com/a/26148339
favorite count: 0
has answer: http://stackoverflow.com/a/26148339
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26148337
tagged with: break

http://stackoverflow.com/a/26087791
answers question: http://stackoverflow.com/q/26087763
score: 0
has body: The answer is correct. The empty string "" is a substring of any String. Just like the empty set is a subset of any set. If you evaluate "name".substring(0,0) you get "". Therefore, "" is a substring of "name".
type: Answer

http://stackoverflow.com/q/26137784
has comment: http://stackoverflow.com/comment/40969176
tagged with: java
has comment: http://stackoverflow.com/comment/40969386
tagged with: split
has body: So I'm trying to make a fan java program for a game for a few of my friends, I'm trying to read the contents of a text file to store into an array/arraylist in the future but I'm unable to get string split working the way I hoped it would. I tried examples from this place that worked for people just to see if it will work but I get the same output. importCards.java BufferedReader in = null; try { in = new BufferedReader(new FileReader("dark.txt")); String read = null; while ((read = in.readLine()) != null) { read = in.readLine(); String[] splited = read.split("||"); for (String part : splited) { System.out.println(part); } } } catch (IOException e) { System.out.println("There was a problem: " + e); e.printStackTrace(); } finally { try { in.close(); } catch (Exception e) { } } The text file is formatted as follows 17||Dark Soul Endor||Dark||2||1||Human||Main Characters||5|500000||833||126||78||23||Release of Spirit - Dark||Dissolve all Light Runestones to inflict Dark on all enemies||Power of Dark||Dark Attack x 150% However when I tried and printed it I got this 1 8 | | D a r k and so on
has answer: http://stackoverflow.com/a/26137892
possible better answer: http://stackoverflow.com/a/26137833
has comment: http://stackoverflow.com/comment/40969359
has answer: http://stackoverflow.com/a/26137833
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: string
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26137832
has title: Java string splitting, not working the way I envisioned it to be
accepted answer: http://stackoverflow.com/a/26137832
has answer: http://stackoverflow.com/a/26137837
upvote count: 2

http://stackoverflow.com/comment/40802899
type: QuestionComment
score: 5
comment on: http://stackoverflow.com/q/26046514
has text: Have you written any code, pseudo or otherwise, to demonstrate what you're thinking?
type: Comment

http://stackoverflow.com/q/26183287
answer count: 1
linked to: http://stackoverflow.com/q/1036754
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/41054543
accepted answer: http://stackoverflow.com/a/26183487
has title: Java paint 'stuttering' -list concurrency
tagged with: paintevent
tagged with: multithreading
has answer: http://stackoverflow.com/a/26183487
has comment: http://stackoverflow.com/comment/41055169
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41055017
tagged with: java
has comment: http://stackoverflow.com/comment/41054399
tagged with: concurrency
type: Question
has body: One of my applications paints objects to a screen by reading an array List: simple code summary: @Override public synchronized void paintComponent(Graphics g) { for(Object gO:paintList) { g.drawImage( gO.getObjImage(), gO.getXLoc(), gO.getYLoc(), outer.getTransparent(), null); } } The problem is I add more objects every time the user clicks the mouse, so if if the user clicks fast enough, I can cause the program painting to stutter since it cannot read while it is writing (the arrayList is synchronized). What is the common practice developers use to deal with this concurrency issue? edit: here is the code that calls the repaint: byte ticks = 0; while(true) { currentTime = System.nanoTime(); if(ticks == 25) { drawPanel.repaint(); ticks = 0; } else if (ticks%5 == 0) {//if ticks is a multiple of 5 (5,10,15,...) drawPanel.operations(); ticks++; } else if(ticks &lt; 25) { ticks++; } try { /* Refer to: 'http://stackoverflow.com/questions/1036754/difference-between-wait-and-sleep' on differences between Thread.sleep() and wait() */ wait(1);//old timings: (long)(refreshRate*1000) } catch (InterruptedException ex) { Logger.getLogger(DeathWish.class.getName()).log(Level.SEVERE, null, ex); } //Debugging //System.out.println(ticks); currentTime = System.nanoTime(); *where operations() calculates changes in 'paintable' object's properties, removes objects that meet certain conditions and adds new objects to the paint list. Logically to me, the adding and writing should be separated? I can post the operations() method, if there isn't enough information, but I'm trying not to post huge sections of code so it is easier to interpret.
has comment: http://stackoverflow.com/comment/41063853
has comment: http://stackoverflow.com/comment/41054943

http://stackoverflow.com/comment/139635789
type: Comment
has text: is there other ways to define a normal `main` entrypoint other than CommandLineRunner?
comment on: http://stackoverflow.com/a/37706836
type: AnswerComment
score: 0

http://stackoverflow.com/a/26113859
type: Answer
has body: [Here][1] is a perfect example. [1]: http://tush.wordpress.com/2014/07/15/android-google-contact-api-3-0-example/ Use the authentication process from this example. And also in your code clientID is blank it can't be empty for debug mode it should be empty for only release mode of your application
answers question: http://stackoverflow.com/q/26086468
score: 0

http://stackoverflow.com/a/26105765
downvote count: 0
has comment: http://stackoverflow.com/comment/43684944
has body: In general, the answer is yes, but it may depend on the JVM you're using and the settings you provide. In early versions of Java (1.1), so called "green threads" were used which were managed by the JVM. On more recent virtual machines, native threads are used, where each thread in the JVM corresponds to an actual operating system thread. But there may be options on some virtual machines to switch to "green threads". (I'm not aware of any JVM implementation that still uses green threads, though.) With recent versions of the 64-bit Oracle HotSpot Server JVM on Windows 7, I ran a test similar to yours and saw that the number of threads did go up in the Windows Task Manager. You would probably see similar results. The "handles" are object handles, which correspond to various system resources (files, threads, windows, etc.) that the operating system has allocated to running programs.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26065262
upvote count: 1
has comment: http://stackoverflow.com/comment/43685027
accepted answer of: http://stackoverflow.com/q/26065262
type: AcceptedAnswer

http://stackoverflow.com/a/26382420
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26114624
accepted answer of: http://stackoverflow.com/q/26114624
type: Answer
downvote count: 0
has body: I figured out the error. I wasnt closing the writer. writer.close(); And the file was completely written. Don't know why it doesnt complete writing the file otherwise.
score: 1

http://stackoverflow.com/q/26059300
has comment: http://stackoverflow.com/comment/90281315
type: AnsweredQuestion
score: 12
possible better answer: http://stackoverflow.com/a/26059722
type: Question
upvote count: 12
has answer: http://stackoverflow.com/a/26125483
has body: I have a series of asynchronous operations private void doSomething(){ get("/something", new Callback(){ void onComplete(String data){ updateUi(something, data); doSomethingElse(); } }); } private void doSomethingElse(){ get("/something/else", new Callback(){ void onComplete(String data){ updateUi(somethingElse, data); doYetAnotherThing(); } }); } private void doYetAnotherThing(){ get("/yet/another/thing", new Callback(){ void onComplete(String data){ updateUi(yetAnotherThing, data); allDone(); } }); } This suffers from few problems: Cannot reuse any of the callbacks elsewhere since each is intrinsically tied to the "next step" Re-ordering operations or inserting another operation is non-intuitive and involves jumping all over the place. I have looked at the following options to mitigate this: ExecuterService#invokeAll - I don't see how this solution can be used without blocking. RxJava - I would prefer to avoid such a paradigm shift in my application if I can! Guava's ListenableFutures and its transform method. I saw this referred to in few places around the interwebs nut I honestly don't see how this would solve my problem. So, the question is: What would be a good pattern to chain a series of asynchronous calls in Java? Looking for a solution that works with Java 7 since I need this for an Android app.
tagged with: java
has answer: http://stackoverflow.com/a/37903834
has title: Chain a series of asynchronous calls
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26125483
answer count: 3
has answer: http://stackoverflow.com/a/26059722
tagged with: asynchronous

http://stackoverflow.com/q/26096058
tagged with: upload
has body: I am using the following code: http://androidexample.com/Upload_File_To_Server_-_Android_Example/index.php?view=article_discription&amp;aid=83&amp;aaid=106 IT WORKS! I want know that the picture I will send is a picture taken a few seconds ago with the camera. So.. I've created a simple method to take the picture and then this OnActivityResult: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAMERA_PIC_REQUEST) { //2 Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); //3 ByteArrayOutputStream bytes = new ByteArrayOutputStream(); thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, bytes); //4 File file = new File(Environment.getExternalStorageDirectory()+File.separator + "guasto.jpg"); try { file.createNewFile(); FileOutputStream fo = new FileOutputStream(file); //5 fo.write(bytes.toByteArray()); fo.close(); uploadFile(uploadFilePath + "" + uploadFileName); //this should call the working method to upload the picture } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } The problem is that the upload won't work and it stops right before executing this line of code: dos = new DataOutputStream(conn.getOutputStream()); What should I do to resolve the problem...? Thank you very much
tagged with: image
score: 0
has title: Upload picture to server
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26096278
tagged with: java
type: Question
tagged with: camera

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26081813
tags question: http://stackoverflow.com/q/26152716
tags question: http://stackoverflow.com/q/26148418
tags question: http://stackoverflow.com/q/26193471
tags question: http://stackoverflow.com/q/26190555

http://stackoverflow.com/comment/40976471
type: Comment
comment on: http://stackoverflow.com/q/26139094
type: QuestionComment
has text: @bwilcox I am using Java 1.7 version with JVM 64 bit server
score: 0

http://stackoverflow.com/comment/40831932
has text: Actually, what I meant by "emit items once" is that after the fisrt emission (1 red marble for example... marble diagrams) the Observable product of the BehaviorSubject should complete itself (onComplete()) and stop emitting items.
type: AnswerComment
comment on: http://stackoverflow.com/a/26055456
score: 0
type: Comment

http://stackoverflow.com/comment/40947183
type: QuestionComment
comment on: http://stackoverflow.com/q/26125155
has text: What is the observed behavior in cobtrast to what you expect?
score: 0
type: Comment

http://stackoverflow.com/comment/41564324
comment on: http://stackoverflow.com/q/26110918
has text: Interesting, thanks for the bug report.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26060020
answers question: http://stackoverflow.com/q/26058192
score: 0
has body: did you extract your eclipse folder in same drive where it download ? if yes than move it to another drive. I think that is the problem you are facing. i had same problem with my eclipse juno.
type: Answer

http://stackoverflow.com/comment/40877658
type: Comment
type: QuestionComment
has text: Sure, but the amount of garbage generated is going to be the same in both cases --- all I did was increase the maximum heap size --- so why is so much more "work" being done when the heap size is limited? And what is the general takeaway here? Should the heap size always be made as large as possible? Why doesn't Java do this by default?
score: 0
comment on: http://stackoverflow.com/q/26078600

http://stackoverflow.com/comment/40795346
comment on: http://stackoverflow.com/q/26042373
score: 0
has text: The increment of i is supposed to be two times the previous i
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40803437
type: Comment
comment on: http://stackoverflow.com/q/26046577
type: QuestionComment
has text: sorry, i am first time to use...
score: 0

http://stackoverflow.com/a/70736147
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26152642
has comment: http://stackoverflow.com/comment/125049801
has body: import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.stage.Stage; import java.io.Closeable; public class Sizing extends Application { @Override public void start(Stage stage) { var label = new Label(); var labelHeight = label.getHeight(); System.out.println(labelHeight); try (var s = new SizingSandbox(label)) { labelHeight = label.getHeight(); } System.out.println(labelHeight); } public static void main(String[] args) { launch(args); } } class SizingSandbox extends Group implements Closeable { public SizingSandbox(Node... nodes) { new Scene(this); getChildren().addAll(nodes); layItOut(); } @Override public void close() { try { getChildren().removeAll(); } catch (Exception e) { } } private void layItOut() { applyCss(); layout(); } } // output: // 0.0 // 17.0
downvote count: 0

http://stackoverflow.com/comment/40812026
has text: you must separate you bean fields and caching, bean must consist of its element Car (platnumber , model , name, etc ) list of cars should be / somehow must be in the main. plus if you are using static fields, theres no need to encapsulate it (getter/setter) you should access it directly,
score: 0
comment on: http://stackoverflow.com/q/26051412
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26098459
has comment: http://stackoverflow.com/comment/40898255
has body: Try this way,hope this will help you to solve your problem. strings.xml ValueName0 ValueName1 ValueName2 ValueName3 ValueName4 0 1 2 3 4 private ArrayList<String> countryList; private ArrayList<String> countryValueList; countryList = new ArrayList<String>(Arrays.asList(getResources().getStringArray(R.array.country_arrays))); countryValueList = new ArrayList<String>(Arrays.asList(getResources().getStringArray(R.array.country_value_arrays))); option.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(AvpMain.this,"Loading Wait : " + "\n Search : "+ sbox1 + "\n("+countryValueList.get(position)+") Result",Toast.LENGTH_SHORT).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); OR Toast.makeText(AvpMain.this,"Loading Wait : " + "\n Search : "+ sbox1 + "\n("+option.getSelectedItem().toString().charAt(option.getSelectedItem().toString().length())+") Result",Toast.LENGTH_SHORT).show();
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26098359
has comment: http://stackoverflow.com/comment/40897917
upvote count: 2
type: Answer

http://stackoverflow.com/comment/40847948
type: AnswerComment
comment on: http://stackoverflow.com/a/26070584
has text: @MikeM. So can i assume that I just change the setInExact() to setExact() for my codes and it will run precisely at 12.01am?
type: Comment
score: 0

http://stackoverflow.com/a/26165708
upvote count: 2
has body: Your second pointcut @Before("target(com.xyz.WithSession) &amp;&amp; @annotation(com.xyz.WithAuthorization)") fails in two ways. First the target(com.xyz.WithSession) matches only classes, not methods. So like @Xstian pointed out you should use something along the lines of execution(* com.whatever.MyService.*(..)) to match all methods inside the MyService class. Second problem is the @annotation(com.xyz.WithAuthorization) where the argument should be name that matches the argument name in the advice. So you use @annotation(someArgumentName) and then have com.xyz.WithAuthorization someArgumentName as your advice methods argument.
answers question: http://stackoverflow.com/q/26158913
has comment: http://stackoverflow.com/comment/41039368
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41026558
has comment: http://stackoverflow.com/comment/41021966

http://stackoverflow.com/comment/40904673
type: Comment
comment on: http://stackoverflow.com/a/26084730
type: AnswerComment
score: 0
has text: see the revised answer

http://stackoverflow.com/comment/40996116
score: 0
type: Comment
type: QuestionComment
has text: Yup that worked... like I said above, something simple that I was missing. Thanks a lot!
comment on: http://stackoverflow.com/q/26152073

http://stackoverflow.com/comment/40812421
type: QuestionComment
has text: So how do you know it's meant to represent that latitude?
comment on: http://stackoverflow.com/q/26051698
score: 2
type: Comment

http://stackoverflow.com/a/26049218
has comment: http://stackoverflow.com/comment/40808001
has comment: http://stackoverflow.com/comment/40808716
score: 0
has body: If your x value is in range but your y value is not in range, then nothing will be printed, because the first if was followed but the second if was not followed. Change your if condition to one bigger condition, so that if either condition fails, then the else will be followed. if ((x &lt;= 5 &amp;&amp; x &gt;= -5) &amp;&amp; (y &lt;= 2.5 &amp;&amp; y &gt;= -2.5)) { System.out.println("Yes"); }else { System.out.println("no"); }
type: Answer
answers question: http://stackoverflow.com/q/26049191

http://stackoverflow.com/q/26060322
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/26139278
has answer: http://stackoverflow.com/a/26063478
has answer: http://stackoverflow.com/a/26139278
score: 0
answer count: 2
tagged with: api
has title: Where is the Article AccountedTime Set function in Otrs soap api?
accepted answer: http://stackoverflow.com/a/26063478
tagged with: soap
type: AnsweredQuestion
has body: I want to create otrs articles(of specific tickets) via soap api. I also need to set the accounted time of the created otrs articles. In the api docs I find only functions to DELETE or GET the accounted time. Am I missing something? This cannot be true, right? http://otrs.github.io/doc/api/otrs/stable/Kernel/System/Ticket/Article.pm.html I'm using a Java soap client and otrs version 3.1 - 3.3. Maybe someone also knows how to do that via the rest api of OTRS?
tagged with: otrs
tagged with: web-services

http://stackoverflow.com/q/26150574
type: Question
has title: Not able to update a value in JLabel filed .. in second frame while clicking a button on first frame
has comment: http://stackoverflow.com/comment/40993405
upvote count: 0
answer count: 1
favorite count: 0
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/40993461
has answer: http://stackoverflow.com/a/26151099
has comment: http://stackoverflow.com/comment/40993215
type: UnansweredQuestion
downvote count: 3
score: -3
tagged with: swing
has body: I have two windows opened at the same time ,so now on clicking a Jbutton in first window frame My Jlabel value should get updated or change in second window frame.... My problem is I am using observer pattern in my case code is working pretty fine I am able to catch latest updated value but while updating the label giving settext its not getting updated 1] This is my function (called when temp value is changed and I click update button in first frame) .. This function I am using in Observable class -- public void updatetemp(int temp) { System.out.println("when temp is updated "+temp); this.temp = temp; setChanged(); // it says that we have changed somethoing so you need to notify observers System.out.println("uiyh"); notifyObservers(temp); //notify System.out.println("notified"); } 2] Now it will notify the observer that there is change in temperature here , I am expecting that my curTempLbl.setText("" + curTempupd); in the code should update the changed value in the second frame ... but it is not getting updated ... Note : If you see I have given system.out.println before and after setting the the jlabel I am able to catch the correct updated value ... but itsnot getting updated in Jlabel please help public void update(Observable obj, Object arg1) { // TODO Auto-generated method stub if(arg1 instanceof Integer){ int curTempupd = ((Integer)arg1).intValue(); System.out.println("inside update value --------"+curTempupd); WeatherTablePanel frame = new WeatherTablePanel(weatherDb); frame.setVisible(true); curTempLbl.setText("" + curTempupd); //curTempLbl.repaint(); System.out.println("after update value --------"+curTempupd); } This is the code for frame Where I want my Jlabel to get uupdated public WeatherTableFrame(WeatherDb weatherdb) { weatherTblUI = new WeatherTableUI(weatherdb); WindowListener exitListener = new FrameTerminator(); addWindowListener(exitListener); setTitle("Weather Table"); setSize(575,265); add(weatherTblUI); } // another class public WeatherTable…
tagged with: java
tagged with: observable
has comment: http://stackoverflow.com/comment/40994929

http://stackoverflow.com/q/26145429
type: Question
tagged with: arrays
has title: Java Comparing two list models
score: 0
tagged with: jlist
has answer: http://stackoverflow.com/a/26145782
answer count: 1
has comment: http://stackoverflow.com/comment/40983425
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26145782
tagged with: java
has body: I would like to ask is there any way to differentiate the containing elements of two DefaultListModel. For example : there are 2 models, 1st contain a,b,c,d, and the 2nd model contain a,b, so i would like a way to compare both models and return "d" and "c" in an array.Thank you.
tagged with: defaultlistmodel

swixml
type: Tag
tags question: http://stackoverflow.com/q/26036024
tag name: swixml

http://stackoverflow.com/comment/41023419
type: QuestionComment
comment on: http://stackoverflow.com/q/26166663
has text: You should really look at the indentation of your code as it hurts readability and might hide or obscure bugs. And there is really no need to declare all variables at the start of your method.
score: 0
type: Comment

http://stackoverflow.com/q/26179622
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26179817
upvote count: 1
answer count: 1
favorite count: 0
tagged with: unmarshalling
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
type: UnansweredQuestion
has body: I have met some trouble with JAXB unmarshalling xml file to Request object and sent it to servis. Instead of correct response it returns error - Unknown user. I'm using next schema: xml file with test date => parsing to RQ object => sent to servis => take response and check it. Here is source xml file: <OTA_AirLowFareSearchRQ EchoToken="50987" SequenceNmbr="1" Target="Production" TimeStamp="2003-11-19T19:44:10-05:00" Version="2.001" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_AirLowFareSearchRQ.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opentravel.org/OTA/2003/05"> <TPA_Extensions> <TPA_Extension> <PromoRatesRequired Value="false"/> <UserName Value="342561"/> <UserPassword Value="1234"/> <ClearCache Value="true"/> </TPA_Extension> </TPA_Extensions> <OriginDestinationInformation> 2015-04-13T00:00:00 <OriginLocation LocationCode="DUB"/> <DestinationLocation LocationCode="CDG"/> </OriginDestinationInformation> <CabinPref PreferLevel="Preferred" Cabin="Economy"/> <PassengerTypeQuantity Code="ADT" Quantity="1"/> <PassengerTypeQuantity Code="CHD" Quantity="0"/> <PassengerTypeQuantity Code="INF" Quantity="1"/> </OTA_AirLowFareSearchRQ> I'm using JAXB to parse and cast to my RQ object. It returns strange error instead of responce. I just write unparsed request to xml file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns1:OTA_AirLowFareSearchRQ xmlns:ns1="http://www.opentravel.org/OTA/2003/05" Version="2.001" EchoToken="50987" SequenceNmbr="1" TimeStamp="2003-11-20T00:44:10.000Z" Target="Production" DirectFlightsOnly="false"> <ns1:POS> <ns1:TPA_Extensions> <ns1:TPA_Extension> <ns1:PromoRatesRequired Value="false"/> <ns1:UserName Value="342561"/> <ns1:UserPassword Value="1234"/> <ns1:ClearCache Value="true"/> </ns1:TPA_Extension> </ns1:TPA_Extensions> </ns1:POS> <ns1:OriginDestinationInformation> <ns1:DepartureDateTime>2015-04-13T00:00:00</ns1:DepartureDateTime> <ns1:OriginLocation LocationCode="DUB" CodeContext=…
has title: How to customise the xml namespace with JAXB unmarshalling?
score: 1
tagged with: java

http://stackoverflow.com/comment/40979734
comment on: http://stackoverflow.com/q/26142760
has text: @BilalDja: unfortunately, still this is not working. I copied the path and used it but still no. Let me investigate more.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26058417
accepted answer of: http://stackoverflow.com/q/26054823
type: Answer
score: 2
upvote count: 2
has body: Lets state the question as "how many Thursdays are there in a given month"? (ISO-8601 does not describe an approach for weeks within months - it only describes an approach for weeks within years). We can use the approach to find the 5th occurrence of Thursday, and see if it is in the same month: LocalDate date = ... LocalDate fifthThu = date.with(TemporalAdjusters.dayOfWeekInMonth(5, THURSDAY)); int thursdays = (fifthThu.getMonth() == date.getMonth() ? 5 : 4);
answers question: http://stackoverflow.com/q/26054823
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41003890
comment on: http://stackoverflow.com/a/26113457
type: Comment
has text: hello..i have almost done with my app.only two problems are there.can u help me to resolve it..1)if user does not select any option and timer finishes then it should move to next question by making the missed question answer as Wrong. 2) When i m clicking next button without selecting any of the option it is showing me toast message but timer is gettting restarted. I have edited my QuizActivity.java file with recent code..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40878815
type: Comment
type: QuestionComment
has text: Use, eg, `;` instead of `.`.
score: 0
comment on: http://stackoverflow.com/q/26087701

bufferedinputstream
tags question: http://stackoverflow.com/q/26083414
type: Tag
tag name: bufferedinputstream

http://stackoverflow.com/comment/41016711
score: 0
has text: Why not use `Integer.toBinaryString(Integer.parseInt(userInput, 16))`?
comment on: http://stackoverflow.com/q/26163306
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26114468
has body: I am doing a validation for fields in an android form.I am checking with server whether the username is available in the server or not.But the main thread goes to the next page before the async checking completes. The code: btnnext1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { isallValid=true; //check second time for username validation(first time was in onfocus changed) // if(txtusername.getText().toString().trim().equals("achuthan")){ // txtusername.setError("Username exsists!"); // isUsernameValid=false; // } // // else // { // isUsernameValid=true; // } try { Void async_result=new validateusername().execute().get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(txtfullname.getText().toString().trim().length()==0) { txtfullname.requestFocus(); txtfullname.setError("Field required"); isallValid=false; } if(txtdob.getText().toString().trim().length()==0) { txtdob.requestFocus(); txtdob.setError("Field required"); isallValid=false; } if(txtoccupation.getText().toString().trim().length()==0) { txtoccupation.requestFocus(); txtoccupation.setError("Field required"); isallValid=false; } if(txtusername.getText().toString().trim().length()&lt;6){ txtusername.requestFocus(); txtusername.setError("Minimum length of 6 characters"); isallValid=false; } if(txtpassword.getText().toString().trim().length()==0) { txtpassword.requestFocus(); txtpassword.setError("Field required"); isallValid=false; } if(txtconfirmpassword.getText().toString().trim().length()==0) { txtconfirmpassword.requestFocus(); txtconfirmpassword.setError("Field required"); isallValid=false; } else if(!txtpassword.getText().toString().trim().equals(txtconfirmpassword.getText().toString().trim())) { //txtconfirmpassword.requestFocus(); txtconfirmpassword.setError("Passwords not equal"); txtpassword.setError("Passwords not equal"); isallV…
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26114605
has answer: http://stackoverflow.com/a/26114576
has answer: http://stackoverflow.com/a/26114605
tagged with: android
has title: UI thread runs before async class runs in android
type: AnsweredQuestion
tagged with: java
tagged with: ui-thread
accepted answer: http://stackoverflow.com/a/26114576
type: Question

jtextfield
tags question: http://stackoverflow.com/q/26062414
tags question: http://stackoverflow.com/q/26134554
tags question: http://stackoverflow.com/q/26190119
tags question: http://stackoverflow.com/q/26082090
tags question: http://stackoverflow.com/q/26080000
tag name: jtextfield
type: Tag

http://stackoverflow.com/q/26122780
has title: Get value from custom html attribute
tagged with: java
has answer: http://stackoverflow.com/a/26123076
type: Question
tagged with: javascript
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26123076
tagged with: jsp
has body: I took the maintenance of a really old java web application. (Recently it was passed from tomcat 4 to tomcat 6, and maybe this caused the problem.) In the jsp there is a table that have inside this column (where elenco is a java array of objects and elenco[y] means a different object for each row of the table). So basically it is a radio button for every row: &lt;form name="index" action="elencoRichiesteFotoImpronte.jsp"&gt; &lt;td width="5%"&gt;&lt;div align="center"&gt;&lt;input type="radio" value="&lt;%=elenco[y].getId()%&gt;" value1="&lt;%=state%&gt;" value2="&lt;%=elenco[y].getNameOp()%&gt;" data-val2="&lt;%=elenco[y].getNameOp()%&gt;" name="selrec" id="selrec" &gt;&lt;/div&gt;&lt;/td&gt; &lt;/form&gt; (I added the attributes data-val2, to make some attempts with html-5, but didn't worked. And I added too the id, because in the code that I inherit was not present). In the same jsp there're a lot of parts in javascript that access to the selected value of radiobutton, for example: alert(document.index.selrec.value2); But it shows that the value is undefined and so most of the code doesn't work. Does exist an easy way to access to the selected custom value of the radiobutton without making big changes to all the code (maybe some HTML tags)? (And possibly without using jquery.)
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion

layout-manager
tags question: http://stackoverflow.com/q/26183024
tags question: http://stackoverflow.com/q/26080696
tags question: http://stackoverflow.com/q/26184274
tags question: http://stackoverflow.com/q/26037863
tags question: http://stackoverflow.com/q/26194524
type: Tag
tags question: http://stackoverflow.com/q/26193256
tags question: http://stackoverflow.com/q/26170974
tags question: http://stackoverflow.com/q/26126786
tags question: http://stackoverflow.com/q/26111339
tags question: http://stackoverflow.com/q/26174832
tag name: layout-manager

http://stackoverflow.com/q/26182024
tagged with: java
has body: i'm implementing a client/server app with java RMI, client and server are in different packages in the same project (and of course they run on the same machine) and interfaces are defined in a "common" package.When i try to get one of the two remote object i get the aforementioned excepition. I've read some SO answers where people sugget to add a static reference to remote object so they can be never collected, but this doesn't work! here is the code of the client and server NotificheServiceProxy public class NotificheServiceProxy implements INotificheService { @Override public ArrayList &lt;NotificaDTO&gt; generaNotifiche(String autostrada, Date data, Date oraInizio, Date oraFine) { try { RMIClient client = new RMIClient ("localhost" , 1099); INotificheService service = (INotificheService) client.getService(INotificheService.class); return service.generaNotifiche(autostrada, data, oraInizio, oraFine); } catch (RemoteException ex) { Logger.getLogger(TrattaServiceProxy.class.getName()).log(Level.SEVERE, null, ex); return null; } catch (NotBoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } } RMIClient public class RMIClient { private Registry reg; public RMIClient (String url , int port) throws RemoteException { reg = LocateRegistry.getRegistry(url, port); } public Remote getService(Class service) throws NotBoundException, RemoteException { RMIMapping RMIMappingAnn = (RMIMapping) service.getAnnotation(RMIMapping.class); return reg.lookup(RMIMappingAnn.name()); } } NotificheService (server side) public class NotificheService implements INotificheService { private static NotificheService instance; @Override public ArrayList&lt;NotificaDTO&gt; generaNotifiche(String autostrada, Date data, Date oraInizio, Date oraFine) throws RemoteException { instance = this; return new NotificheBusinessLogic().generaNotifiche(autostrada, data, oraInizio, oraFine); } } scServerConfig (server main) public class SCServerConfig { public static RMISe…
type: Question
accepted answer: http://stackoverflow.com/a/26185093
has title: java.rmi.NoSuchObjectException but static reference added
answer count: 1
has comment: http://stackoverflow.com/comment/41051655
score: 0
has comment: http://stackoverflow.com/comment/41052791
tagged with: exception
has answer: http://stackoverflow.com/a/26185093
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41053010
has comment: http://stackoverflow.com/comment/41052758
tagged with: rmi

http://stackoverflow.com/a/26108031
accepted answer of: http://stackoverflow.com/q/26107921
answers question: http://stackoverflow.com/q/26107921
upvote count: 22
has comment: http://stackoverflow.com/comment/40915928
type: AcceptedAnswer
downvote count: 0
score: 22
has body: What is logic behind ordering object elements? how "(this.grade - s.grade)" if positive 1 moves "this.grade" front and puts "s.grade" next in order, why not other way around? Using negative numbers to say "this is less than that", positive numbers to say "this is more than that" and 0 to say "these 2 things are equal" has been in many computer languages for 30+ years. Who validates the compare result (+1, -1, 0) and then puts in ascending order / descending order respectively, is there any documentation that describes internal working of this part? There are several internal classes that use the return value to reorder elements in arrays or collections including Collections.sort() Arrays.sort() TreeSet EDIT To answer HOW that works you will have to look at the source code for each of the classes I listed above. Some of them are quite complicated to try to make the sorting as efficient as possible. But in general, it all boils down to code like this: if( data[i].compareTo(data[j]) &gt; 0 ){ // swap data[i] and data[j] }
has comment: http://stackoverflow.com/comment/40916246
type: Answer

http://stackoverflow.com/comment/41034655
type: Comment
comment on: http://stackoverflow.com/a/26172616
has text: I'm using the File inputSteam because its the only thing i took and i'm trying to understand it, but i'll look into the method you just mentioned, Thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40948187
score: 0
type: Comment
type: QuestionComment
has text: Take a look at [this example](http://howtodoinjava.com/2013/07/30/jaxb-exmaple-marshalling-and-unmarshalling-list-or-set-of-objects/) to see if it helps explain things.
comment on: http://stackoverflow.com/q/26125655

http://stackoverflow.com/comment/40999194
type: AnswerComment
type: Comment
has text: Aha, thanks @Alex. That's what I get for posting an answer right as I'm leaving for dinner. With that fix made (edited into my answer), I get a further 4x speedup from your code, and all reflection and boxing is gone: it should be basically the same bytecode as the java version expands to.
comment on: http://stackoverflow.com/a/26153263
score: 0

http://stackoverflow.com/q/26061820
has body: So adding some inputs: The error seems to come from the WSDL file. IWAB0399E Error in generating Java from WSDL: java.io.IOException: Error: missing type or ref attribute for node 'unknown' java.io.IOException: Error: missing type or ref attribute for node 'unknown' I simplified the web service and now I have this WDSL file: WSDL I'm trying to make a SOAP call from my java program, for which I used apache axis1. My client program is the following: import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; public class Client { public Client() { } public class QueryResult implements java.io.Serializable{ String type, name, revision, owner, current, description; public QueryResult() { super(); } public String getType() { return type; } public void setType(String s) { type = s; } public String getName() { return name; } public void setName(String s) { name = s; } public String getRevision() { return revision; } public void setRevision(String s) { revision = s; } public String getOwner() { return owner; } public void setOwner(String s) { owner = s; } public String getCurrent() { return current; } public void setCurrent(String s) { current = s; } public String getDescription() { return description; } public void setDescription(String s) { description = s; } } public static void main(String [] args) { try { Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(args[0]) ); call.setOperationName(new QName("urn:Ppap2Service", "evaluateOne")); QName qr = new QName("urn:Ppap2Service", "QueryResult"); BeanSerializerFactory bsf = new BeanSerializerFactory(QueryResult.class,qr); // step 2 BeanDeserializerFactory bdf = new BeanDeserializerFactory(QueryResult.class,qr); //…
accepted answer: http://stackoverflow.com/a/26304304
tagged with: java
tagged with: eclipse
tagged with: axis
tagged with: wsdl
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26304304
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41276810
has title: Cannot create Java Webservice in Eclipse - Client
tagged with: web-services
type: Question

http://stackoverflow.com/comment/134073672
comment on: http://stackoverflow.com/a/40710448
type: AnswerComment
score: 0
type: Comment
has text: This is not correct; remember that `ViewHolder`s are recycled, so setting the visibility to `GONE` will leave it set to `GONE` on some other item; also, RecyclerView does not actually respect the `GONE` property when laying out views.

utf8-decode
tags question: http://stackoverflow.com/q/26130752
tag name: utf8-decode
type: Tag

http://stackoverflow.com/comment/41023899
type: Comment
comment on: http://stackoverflow.com/a/26166149
has text: Thank you +1 for your precious time :)...this will help me in future
score: 0
type: AnswerComment

http://stackoverflow.com/a/26216156
upvote count: 1
has body: If it's for development's purpose, you can specify a folder into the "docBase" attribute of context file like this : <?xml version="1.0" encoding="UTF-8"?> <Resource ... /> By adding these context files directly into /conf/Catalina/localhost, everything is configured and should work like you want but you'll have to stop the tomcat server every time you'll want to clean and build your project.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26116827

http://stackoverflow.com/q/26034565
has body: I'm building a small in-memory file system in Java for a project, I'm currently using a binary search to locate nodes but when I was looking for bugs I noticed that nodes with capitals would be sorted to the beginning of the list because of their position in Unicode. This still works fine for finding nodes with binary search but while they should represent an alphabetically sorted list this is not acceptable, for example: Hosts.txt abc home settings.txt What I'm thinking would be the easiest solution (theoretically) would be to have the strings in a charset with the characters laid out something like this: aAbBcCdDeEfFgGhHiIjJkKlLmM... and so on with special characters and such included Is there some way to do this easily or perhaps a better way?
tagged with: search
answer count: 1
tagged with: sorting
has comment: http://stackoverflow.com/comment/40781940
score: 0
has comment: http://stackoverflow.com/comment/40781191
has title: Searching/sorting and string encoding in Java
has answer: http://stackoverflow.com/a/26035108
has comment: http://stackoverflow.com/comment/40780963
type: Question
has comment: http://stackoverflow.com/comment/40782094
accepted answer: http://stackoverflow.com/a/26035108
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40781762
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/40780775

http://stackoverflow.com/q/26163638
has answer: http://stackoverflow.com/a/26163682
type: Question
downvote count: 0
answer count: 1
tagged with: glassfish
favorite count: 0
accepted answer: http://stackoverflow.com/a/26163682
linked to: http://stackoverflow.com/q/26786155
tagged with: eclipse-luna
has title: eclipse luna doesnt support glassfish?
has body: I downloaded eclipse-jee-luna-SR1-x86_64 I went to servers view -> right clicked and add new server -> download additional server adapters -> there is nothing for glassfish
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/26149569
has comment: http://stackoverflow.com/comment/41015598
type: Question
has comment: http://stackoverflow.com/comment/41015242
has comment: http://stackoverflow.com/comment/41016954
score: -1
has comment: http://stackoverflow.com/comment/41010216
tagged with: spring-transactions
has title: JPA not merging neither flushing my entity
tagged with: jpa
downvote count: 1
accepted answer: http://stackoverflow.com/a/26168266
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40994817
has answer: http://stackoverflow.com/a/26168266
has comment: http://stackoverflow.com/comment/40995366
tagged with: spring
has body: I'm facing a trouble where I've my transactions controlled by Spring Tx and when I do a merge and after flush, my implementation does not print the command neither the Spring Tx commit them. Follows my code: @Named @Transactional(propagation = Propagation.MANDATORY, readOnly = false) class AverbacaoDAOImpl extends AbstractDAOImpl&lt;Averbacao, Long&gt; implements AverbacaoDAO{ private List&lt;Averbacao&gt; atualizarAverbacoes(final List&lt;Averbacao&gt; averbacoes, final EtapaAverbacao etapa) { int counter = 0; for(Averbacao averbacao : averbacoes) { averbacao.setEtapa(etapa); atualizar(averbacao); counter += 1; } entityManager.flush(); LOGGER.debug("Atualizado {} averbacoes para a etapa {}", counter, etapa); return averbacoes; } } private atualizar(Averbacao averbacao) { entityManager.merge(averbacao); } Every objects in the list are managed by JPA (or I think that they're) Follows logs: Spring Transaction/Hibernate: 08:37:06,102 DEBUG [BilhetagemProcessManagerExecutor-1hread] [AbstractFlushingEventListener] Processing flush-time cascades 08:37:07,576 DEBUG [BilhetagemProcessManagerExecutor-1hread] [AbstractFlushingEventListener] Dirty checking collections 08:37:08,703 DEBUG [BilhetagemProcessManagerExecutor-1hread] [Collections] Collection found: [br.com.company.bilhetagem.brms.model.Proposta.propostaTaxaAplicaveis#35340], was: [br.com.company.bilhetagem.brms.model.Proposta.propostaTaxaAplicaveis#35340] (initialized) 08:37:08,706 DEBUG [BilhetagemProcessManagerExecutor-1hread] [AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 26047 objects 08:37:08,707 DEBUG [BilhetagemProcessManagerExecutor-1hread] [AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 1 collections 08:37:08,707 DEBUG [BilhetagemProcessManagerExecutor-1hread] [EntityPrinter] Listing entities: 08:37:08,707 DEBUG [BilhetagemProcessManagerExecutor-1hread] [EntityPrinter] br.com.company.bilhetagem.brms.model.tarifas.TipoTarifaPercentual{perce…
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41016106
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40991473

http://stackoverflow.com/comment/40872352
type: AnswerComment
score: 0
type: Comment
has text: Can you please more elaborate. deployment time which files needs to carry and where to keep
comment on: http://stackoverflow.com/a/26083733

http://stackoverflow.com/comment/40869779
score: 0
type: Comment
type: QuestionComment
has text: This might help http://stackoverflow.com/questions/1834971/removing-a-row-from-an-excel-sheet-with-apache-poi-hssf
comment on: http://stackoverflow.com/q/26082978

http://stackoverflow.com/q/26139065
score: 5
accepted answer: http://stackoverflow.com/a/26139492
has answer: http://stackoverflow.com/a/26161102
tagged with: java-io
possible better answer: http://stackoverflow.com/a/26139377
tagged with: jai
has answer: http://stackoverflow.com/a/26139377
answer count: 3
has body: Let's say I have a very large TIFF image as input. I am not able to load this image entirely because of memory specification I must comply with. So the following is not an option : BufferedImage data = ImageIO.read(image); Is there any Java library allowing to read a specific part of the image without buffering the whole image ? Or some ways to get TIFF tiles from a stream ?
upvote count: 6
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/26139492
type: AnsweredQuestion
tagged with: java
has title: How to read a TIFF file by tiles with Java?
type: Question
tagged with: tiff

console
tags question: http://stackoverflow.com/q/26078106
tags question: http://stackoverflow.com/q/26079330
type: Tag
tag name: console

http://stackoverflow.com/comment/40944627
type: QuestionComment
score: 0
has text: What if there is a mixture of odd and even? what must it return?
comment on: http://stackoverflow.com/q/26121687
type: Comment

http://stackoverflow.com/q/26113553
has comment: http://stackoverflow.com/comment/40927311
tagged with: java
tagged with: character-encoding
tagged with: pdfbox
has title: Java is unable to compare ö (Swedish character) from pdfbox
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40926718
has answer: http://stackoverflow.com/a/26119269
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/26114218
has comment: http://stackoverflow.com/comment/40927807
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40928030
tagged with: itext
type: Question
has body: I used pdfbox to get data from a pdf file I am comparing that data to the data of webpage using selenium webdriver. I am able to get data from both. I used contains method to comparing both data. Java is able to compare glädjande type of data but when Kommunstyrelsens ordförande used as in sentence its not able to match. However ordförande as a single word can be matched. I also tried PDFTextStripper pdfStripper = new PDFTextStripper("ISO8859_1"); but not able to match data using contains method.

http://stackoverflow.com/a/26110274
has body: The reason is most likely that your domain only allows at maximum read-only acls to users outside your domain. I suggest you take a look at the delegation of domain authority to service accounts, it might be what you are looking for: https://developers.google.com/drive/web/delegation
score: 0
answers question: http://stackoverflow.com/q/26066540
type: Answer
has comment: http://stackoverflow.com/comment/67746161

http://stackoverflow.com/q/26134656
has answer: http://stackoverflow.com/a/26134697
has comment: http://stackoverflow.com/comment/40963601
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26135180
tagged with: instantiation
tagged with: object
tagged with: java
has answer: http://stackoverflow.com/a/26134710
has answer: http://stackoverflow.com/a/26134703
has body: If I have a class A{ } class B extends A{ } and I instantiate a reference variable "var" A var = new B(); Is "var" then considered to be instantiated as a "B" Object? Where A is the variable reference type and not the Object instantiated for "var".
type: Question
has comment: http://stackoverflow.com/comment/40963563
tagged with: class
score: 0
has title: Is a Class the same thing as an Object
has answer: http://stackoverflow.com/a/26134801

http://stackoverflow.com/comment/41032713
type: QuestionComment
has text: The source is available on their website man.
comment on: http://stackoverflow.com/q/26171583
score: 0
type: Comment

http://stackoverflow.com/q/26151667
accepted answer: http://stackoverflow.com/a/26262895
has comment: http://stackoverflow.com/comment/41134041
has answer: http://stackoverflow.com/a/26198687
downvote count: 0
has title: Could it be related to proguard? -- Mysterious "NullPonterException" when querying the datastore, with "missing" classes
favorite count: 0
has body: Im developing a simple app to save data to the google app engine's datastore, then to call the datastore and list all entities. While I am able to store the data in the datastore, I am not able to "query" the datastore. When I try to build my query, I get the error: "java.lang.NullPointerException: No API environment is registered for this thread." This occurs on this line, no matter where I put it: Query query = new Query("myStoredBean"); Note: I do verify that the datastore connection is open and valid prior to calling the above line of code. Additionally, my logcat is reporting some odd issues in addition to the nullpointerexception and I have no idea how to resolve them: 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Link of class 'Lcom/google/appengine/repackaged/com/google/io/protocol/ProtocolMessage;' failed 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Unable to resolve superclass of Lcom/google/apphosting/api/DatastorePb$Transaction; (2168) 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Link of class 'Lcom/google/apphosting/api/DatastorePb$Transaction;' failed 10-01 18:11:38.884 32537-32537/com.myApp.MyModule E/dalvikvm﹕ Could not find class 'com.google.apphosting.api.DatastorePb$Transaction', referenced from method com.google.appengine.api.datastore.BaseDatastoreServiceImpl.a 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ VFY: unable to resolve new-instance 2597 (Lcom/google/apphosting/api/DatastorePb$Transaction;) in Lcom/google/appengine/api/datastore/BaseDatastoreServiceImpl; 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Link of class 'Lcom/google/appengine/repackaged/com/google/io/protocol/ProtocolMessage;' failed 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Unable to resolve superclass of Lcom/google/apphosting/api/DatastorePb$Transaction; (2168) 10-01 18:11:38.884 32537-32537/com.myApp.MyModule W/dalvikvm﹕ Link of class 'Lcom/google/apphosting/api/DatastoreP…
tagged with: google-app-engine
tagged with: android
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41202176
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26262895
has comment: http://stackoverflow.com/comment/41074331
has comment: http://stackoverflow.com/comment/41074480
type: Question
possible better answer: http://stackoverflow.com/a/26198687
answer count: 2

http://stackoverflow.com/q/26077488
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26077532
favorite count: 0
has body: public class MyTestClass { public static void main(String[] args) throws Exception { char c; InputStreamReader reader = (new InputStreamReader(System.in)); System.out.println("Enter chars:"); OutputStream outputStream = new BufferedOutputStream(System.out); int counter = 0; do { counter++; c = (char) reader.read(); outputStream.write(c); outputStream.flush(); System.out.println(counter); } while (c != 'q'); } } What I am trying is simple entering a character and then hitting enter.. What I will see is: Enter chars: a a1 2 b b3 4
type: Question
accepted answer: http://stackoverflow.com/a/26077498
score: 3
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/26077499
tagged with: java
has answer: http://stackoverflow.com/a/26077498
has title: Why is this simple counter in simple Java app incrementing twice?
possible better answer: http://stackoverflow.com/a/26077499

http://stackoverflow.com/q/26133085
upvote count: 1
type: Question
tagged with: lines
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26133108
linked to: http://stackoverflow.com/q/326390
tagged with: string
has title: Reading lines from a file in Java
favorite count: 0
has body: G'day: I'm trying to use this: List&lt;String&gt; lines = Files.readAllLines(Paths.get(path), encoding); from https://stackoverflow.com/a/326440/2698254 and http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllLines%28java.nio.file.Path,%20java.nio.charset.Charset%29 but I'm having a bit of trouble implementing it. My goal is to read all the lines from a file, then do some stuff with each line using that list (I imagine it works just like a vector...) A few questions, because I'm getting a bunch of errors: List&lt;String&gt; lines = Files.readAllLines(Paths.get("assets/unitsloc.txt"), Charset.defaultCharset()); This is what I've got so far, but the error markers are: "Files cannot be resolved" - but there's no useful suggested import to make, same with Paths. "The type List is not generic: it cannot be parametrized with arguments " -Do I need to initialise lines first?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26133108
score: 1
tagged with: java
tagged with: file

http://stackoverflow.com/comment/40951508
type: QuestionComment
has text: @KumarAbhinav: why would that matter in this use of `instanceOf`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26127934

http://stackoverflow.com/q/26131754
has title: Using the Color.brighter method to print red, green, and blue values
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: I cannot seem to figure out what I am doing wrong. Here is the exercise in the textbook: "In the Java library, a color is specified by its red, green, and blue components between 0 and 255 (see Table 4 on page 68). Write a program BrighterDemo that con- structs a Color object with red, green, and blue values of 50, 100, and 150. Then apply the brighter method of the Color class and print the red, green, and blue values of the resulting color" Here's the code I have so far: import java.awt.Color; import javax.swing.JFrame; public class BrighterDemo { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(200, 200); Color myColor = new Color(50, 100, 150); Color brighterRedColor = myColor.red.brighter(); Color brighterGreenColor = myColor.green.brighter(); Color brighterBlueColor = myColor.blue.brighter(); frame.getContentPane().setBackground(myColor); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } EDIT: I figured it out, here's the correct code: import java.awt.Color; public class BrighterDemo { public static void main(String[] args) { Color myColor = new Color(50, 100, 150); Color brighterColor = myColor.brighter(); System.out.println("Red - "); System.out.println(brighterColor.getRed()); System.out.println("Green - "); System.out.println(brighterColor.getGreen()); System.out.println("Blue - "); System.out.println(brighterColor.getBlue()); } }
tagged with: colors
type: Question
has answer: http://stackoverflow.com/a/26131853

http://stackoverflow.com/a/26129159
has body: I believe you want something like this: //first create an object that will parse your date as you have it ie 2014-09-28 SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); String dateOrder = fill_order_in.get(Variabel.KEY_DATE_ORDER); try { Date d = date.parse(dateOrder); //then use a different object to format the date as you want it ie 9/28/2014 dateOrder = new SimpleDateFormat("dd/MM/yy").format(d); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); }
downvote count: 0
answers question: http://stackoverflow.com/q/26129084
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26146620
tagged with: java
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/1021324
score: 0
has title: Calculating the number of days in a month without Calendar
has comment: http://stackoverflow.com/comment/40985806
has comment: http://stackoverflow.com/comment/40985977
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40985784
linked to: http://stackoverflow.com/q/8940438
has comment: http://stackoverflow.com/comment/40986079
has comment: http://stackoverflow.com/comment/40985892
has body: I'm trying to calculate the number of days in a month given a year and month number. Here is what I have so far. public static int daysInMonth(int m, int y) { int d; if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { d = 31; } else if (m == 4 || m == 6 || m == 9 || m == 11) { d = 30; } else if (y % 4 == 0 &amp;&amp; m == 2) { d = 29; } else if (m == 2) { d = 28; } else { d = 0; } return d; } Unfortunately, it doesn't work properly for the second month of leap years. How can I fix it without using the Calendar class?
has answer: http://stackoverflow.com/a/26147009
has comment: http://stackoverflow.com/comment/40986013
has answer: http://stackoverflow.com/a/26146849
answer count: 4
has answer: http://stackoverflow.com/a/26146990
has comment: http://stackoverflow.com/comment/40985869
has answer: http://stackoverflow.com/a/26146833

http://stackoverflow.com/q/26138557
tagged with: libgdx
has comment: http://stackoverflow.com/comment/40972431
linked to: http://stackoverflow.com/q/14208797
has body: I am trying to move a body by applying force on it. But instead of moving in horizontal direction and making a trajectory, it is just falling down like i have not applied force on it. Here is the code: public class Box2dTest implements ApplicationListener { private OrthographicCamera camera; World box2Dworld; Box2DDebugRenderer debugRenderer; private Body box2dBody; Sprite ball_sprite; SpriteBatch spriteBatch; @Override public void create() { camera = new OrthographicCamera(); camera.setToOrtho(false); box2Dworld = new com.badlogic.gdx.physics.box2d.World(new Vector2(0.0F, -10.0F), true); new BoundryWall(this.box2Dworld, new PointF(0.0F, 0.0F), 800.0F, camera); debugRenderer = new Box2DDebugRenderer(); createDynamicBody(110f, 150f); box2dBody.applyForce(new Vector2(30 * 1000, 0), box2dBody.getWorldCenter(), true); Texture ball_in_hand_Texture = new Texture(Gdx.files.internal("test/ball_in_hand.png")); ball_in_hand_Texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); ball_sprite = new Sprite(ball_in_hand_Texture); ball_sprite.setPosition(110f, 150f); spriteBatch = new SpriteBatch(); } @Override public void render() { Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); box2Dworld.step(1.0f/60.0f, 6, 2); //box2Dworld.clearForces(); camera.update(); debugRenderer.render(box2Dworld, camera.combined); spriteBatch.begin(); spriteBatch.draw(ball_sprite, 30 * box2dBody.getPosition().x, 30 * box2dBody.getPosition().y); spriteBatch.end(); } private void createDynamicBody(float x, float y) { // First we create a body definition BodyDef bodyDef = new BodyDef(); // We set our body to dynamic, for something like ground which doesn't move we would set it to StaticBody bodyDef.type = BodyType.DynamicBody; bodyDef.bullet = true; // Set our body's starting position in the world // bodyDef.position.set(x / 60.0f, y / 60.0f); //bodyDef.position.set(x / 30.0f, y / 30.0f); bodyDef.position.set(x, y); // Create our body in the world using our body…
upvote count: 2
has title: Applying force on box2d body not working
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26138628
score: 2
downvote count: 0
tagged with: java
tagged with: box2d
type: Question

http://stackoverflow.com/q/26119645
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40935991
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40936109
upvote count: 2
has answer: http://stackoverflow.com/a/26119820
tagged with: windowbuilder
answer count: 1
has comment: http://stackoverflow.com/comment/40935652
tagged with: java
has title: Java WindowBuilder on different screen resolution
has body: I am making a java program for Windows with GUI using windowbuilder. I set the sizes of the components so that it would match a screen resolution of 3200x1800. After I built the program I ran it on a different computer with a screen resolution of 1366x768. All of the components were much bigger than running the program in the high screen resolution screen. How can I set the components to be in the same size for all screen resolutions (the components will match the screen resolution)?
linked to: http://stackoverflow.com/q/10123735
tagged with: screen-resolution
accepted answer: http://stackoverflow.com/a/26119820

http://stackoverflow.com/q/26043402
answer count: 5
accepted answer: http://stackoverflow.com/a/26043676
has comment: http://stackoverflow.com/comment/40797053
has comment: http://stackoverflow.com/comment/40797000
has comment: http://stackoverflow.com/comment/40797413
tagged with: java
has answer: http://stackoverflow.com/a/34673551
downvote count: 1
upvote count: 16
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26043663
has body: I have both OpenJDK and Oracle Java installed on my Ubuntu. If the activated java is OpenJDK, is there a way to check the version of Oracle java in bash shell?
has answer: http://stackoverflow.com/a/26043460
tagged with: ubuntu
score: 15
has title: How to check Oracle Java version if multiple versions of Java installed on Ubuntu
has answer: http://stackoverflow.com/a/26043586
tagged with: bash
has comment: http://stackoverflow.com/comment/40797066
has answer: http://stackoverflow.com/a/26043676
possible better answer: http://stackoverflow.com/a/26043586
favorite count: 0
has comment: http://stackoverflow.com/comment/40797121

http://stackoverflow.com/q/26192355
answer count: 1
score: 0
tagged with: android
has title: What is the nicest way to use Otto (or simply callback design pattern) if i also want to pass data?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26192538
tagged with: java
tagged with: otto
type: Question
has body: My concern is that isn't creating an own class for each and every unique event considered bad practice? Feels like this approach is not sophisticated, even more so if i have dozens of events. Although it's an easy solution (unique fields for every event type) but comes with lots of almost empty classes. I'd rather have a generalized class and one @Subscribe-d method in which i can check the type of message sent (with an enum) and then act accordingly, but this approach requires me to create for example a map and put data inside it and then pass this map every time i want to post something, which also does not seem to be the best way to go. What do you think?

http://stackoverflow.com/comment/40936749
has text: If you have a class Sub and it's superclass Super, and you create an instance of Sub, that *does not* create a *separate* instance of Super. Rather, the instance of Sub incorporates all of the features of an instance of Super, so it can do anything a Super instance can do.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26117588

http://stackoverflow.com/comment/41048313
type: Comment
has text: This is very interesting and I tested it out and it does indeed work. My Only issue is that I was using MiG Layout. I removed that layout from the main panel to test this but I have to redo a lot of the layout I had done. Could I wrap the panel I want to swap into a `CardLayout` and then add in custom panels which use MiG?
comment on: http://stackoverflow.com/a/26170980
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40859557
score: 0
type: AnswerComment
type: Comment
has text: Well, maybe I didn't think thoroughly before saying that :p I mean, yeah, they could be useful. Depends on whether effects are applied to classes and are constant (annotations), or dynamically assigned to objects/entities and can be changed throughout the game (instance lists). My reaction was caused by the fact that annotations could easily be overused and/or misused if their usage is not well thought out.
comment on: http://stackoverflow.com/a/26073893

http://stackoverflow.com/comment/40997016
type: QuestionComment
has text: Hi, thanks for your advice. As of today I have set -Xms2048m -Xmx2048m and also -XX:MaxPermSize=512M. I am not very familiar with these settings but hop it will help. Just from initial observations it doesn't seem to imporve things but I'll observe performance over the next few days.
score: 0
comment on: http://stackoverflow.com/q/26112414
type: Comment

http://stackoverflow.com/comment/41071605
comment on: http://stackoverflow.com/a/26192038
score: 0
has text: @agonist_ how implementing service in place of normal java thread will make difference? bcz all of my background processes run on Java Threads, nothinh heavy runs on my UI thread except updating text areas for output and tree view .. While writing this comment i got one thing in my mind, i have to get all the text from textarea and then append my output to it each time, if i am printing millions of lines of output, may be javafx becoming unresponsive because of i am getting millions of text in Platorm.runlater and appending the text in same function... I think so....
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41012794
type: AnswerComment
has text: Get the text, convert to doubles, then pass the doubles to your Triangle constructor. Right now you are getting the text inside of `onCreate` and never anywhere else. You probably want some method to extract those numbers when the user presses a button, otherwise your Triangle will always have whatever values were in the text fields when `onCreate` ran.
comment on: http://stackoverflow.com/a/26153727
type: Comment
score: 0

http://stackoverflow.com/comment/40808323
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26048414
has text: Yes I did that before running the program , should I edit the answer too ?
score: 0

http://stackoverflow.com/q/26154657
type: Question
has comment: http://stackoverflow.com/comment/41000948
tagged with: mockito
answer count: 3
upvote count: 21
tagged with: junit
has answer: http://stackoverflow.com/a/26154882
favorite count: 0
has body: I have a problem when writing unit testing with mock. There is a object which I need to mock have a lot getter, which I do call them at the code. However, those are not the purpose of my unit test. So, is there is a way I can mock all the methods instead of mock them one by one. Here is the code example: public class ObjectNeedToMock{ private String field1; ... private String field20; private int theImportantInt; public String getField1(){return this.field1;} ... public String getField20(){return this.field20;} public int getTheImportantInt(){return this.theImportantInt;} } and this is the service class I need to test public class Service{ public void methodNeedToTest(ObjectNeedToMock objectNeedToMock){ String stringThatIdontCare1 = objectNeedToMock.getField1(); ... String stringThatIdontCare20 = objectNeedToMock.getField20(); // do something with the field1 to field20 int veryImportantInt = objectNeedToMock.getTheImportantInt(); // do something with the veryImportantInt } } within the test class, the test method is like @Test public void testMethodNeedToTest() throws Exception { ObjectNeedToMock o = mock(ObjectNeedToMock.class); when(o.getField1()).thenReturn(anyString()); .... when(o.getField20()).thenReturn(anyString()); when(o.getTheImportantInt()).thenReturn("1"); //This "1" is the only thing I care } So, is there a way that I can avoid writing all the "when" for the useless "field1" to "field20"
possible better answer: http://stackoverflow.com/a/26154882
has comment: http://stackoverflow.com/comment/41000916
has answer: http://stackoverflow.com/a/26154762
accepted answer: http://stackoverflow.com/a/26154762
type: AnsweredQuestion
downvote count: 0
has title: Mockito mock all methods call and return
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/57679779
tagged with: unit-testing

http://stackoverflow.com/q/26105618
linked to: http://stackoverflow.com/q/178479
type: Question
answer count: 2
downvote count: 0
has body: That is my query. String SELECT_USERS_FROM_GROUPS = "select * from user where group_id in ?"; I need to select users from groups that come in a list: For example, the list could be. long[] groupIdList = { 1, 2 }; Here is the my code: public List&lt;User&gt; getUsersFromGroups(long[] groupIdList) { ResultSet rs = null; PreparedStatement statement = null; Connection connection = null; List&lt;User&gt; userList = null; User user; try { connection = Connector.getConnection(); statement = connection.prepareStatement(SELECT_USERS_FROM_GROUPS); Array groupIdArray = connection.createArrayOf("LONG", groupIdList); statement.setArray(1, groupIdArray); rs = statement.executeQuery(); userList = new ArrayList&lt;User&gt;(); while (rs.next()) { user = new User(); user = fillUser(rs); userList.add(user); } } catch (SQLException e) { logger.error(e.getMessage(), e); } finally { ResourcesUtil.release(rs, statement, connection); } return userList; } But I get an exception trying line: Array groupIdArray = connection.createArrayOf("LONG", groupIdList); Can somebody help me to correct what is wrong, or guide to another possible solution. Thank you; -- EDIT The exception: ERROR UserDao:138 - java.sql.SQLFeatureNotSupportedException 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 java.lang.Class.newInstance(Unknown Source) at com.mysql.jdbc.SQLError.notImplemented(SQLError.java:1350) at com.mysql.jdbc.JDBC4Connection.createArrayOf(JDBC4Connection.java:55) at com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf(NewProxyConnection.java:589) at com.thehuxley.data.dao.UserDao.getUsersFromGroups(UserDao.java:120)
has answer: http://stackoverflow.com/a/26105844
has comment: http://stackoverflow.com/comment/40914015
has answer: http://stackoverflow.com/a/26107434
has comment: http://stackoverflow.com/comment/40912344
linked to: http://stackoverflow.com/q/17842211
favorite count: 0
tagged with: where-in
has comment: http://stackoverflow.com/comment/40911746
has title: How to fill WHERE IN parameter in PreparedStatement
has comment: http://stackoverflow.com/comment/40911172
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40911963
upvote count: 1
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/40911313
score: 1
tagged with: java

http://stackoverflow.com/a/26083754
answers question: http://stackoverflow.com/q/26082439
type: Answer
accepted answer of: http://stackoverflow.com/q/26082439
upvote count: 2
has body: I see only one error in you code, I am not sure that it causes the crash, but you should fix it in any way. gameWorld.deletingList.removeIndex(i); You must not remove items from array in the same time you looping thru the same array. This can result to unpredictable bugs, because every time you remove item, the array will change items order and decrease size. The solution is to create temporary array and loop thru it, so you will be able to remove items from original one. Also where do you call your deleteObjects() ? You should call in render(), after world.step() and not in beginContact() or endContact().
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41006832
type: QuestionComment
comment on: http://stackoverflow.com/q/26158023
has text: Nope, it's still run off the screen. But to the left this time
score: 0
type: Comment

http://stackoverflow.com/q/26107608
tagged with: substring
has answer: http://stackoverflow.com/a/26107716
has title: replacing characters of a string
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26107776
has comment: http://stackoverflow.com/comment/40914994
has comment: http://stackoverflow.com/comment/40914896
tagged with: string
tagged with: iteration
has comment: http://stackoverflow.com/comment/40914872
accepted answer: http://stackoverflow.com/a/26107660
has body: So I'm trying to iterate over a string and replace ever occurrence of a given substring with a new value. I can't seem to figure out what the problem with my code is because it doesn't seem to make any changes to the strings i run through it. i create a new string nS that starts out as just “”, and am iterating through the template viewing each character as a substring s. In in every case that something needs to be replaced with a value i append said value on to the nS, else it just appends the current substring as is. @Override public String format(String template) { String nS = ""; for (int i = 0, n = template.length(); i &lt; n; i++) { String s = template.substring(i, i + 1); switch (s) { case "%%": nS = nS.concat("%"); break; case "%t": nS = nS.concat(String.valueOf(inSeconds())); break; } } return nS; } the actual code has many more cases but i left them out so that its not as overwhelming.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26107660
possible better answer: http://stackoverflow.com/a/26107776
has comment: http://stackoverflow.com/comment/40915398
tagged with: java
has comment: http://stackoverflow.com/comment/40914844
has comment: http://stackoverflow.com/comment/40914979
has comment: http://stackoverflow.com/comment/40914930
type: Question

http://stackoverflow.com/comment/67866248
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/34826267
type: Comment
has text: It is what it is. Felt obligated to but needed a watch to develop on.

http://stackoverflow.com/comment/40910766
comment on: http://stackoverflow.com/a/26105531
type: AnswerComment
has text: Actually, semantically this is not true. What you mean is that calling any method on a null object will ALWAYS throw a NullPointerException
type: Comment
score: 1

http://stackoverflow.com/comment/40934825
score: 0
type: QuestionComment
type: Comment
has text: Try to run the mvn command with **-U** option
comment on: http://stackoverflow.com/q/26119169

http://stackoverflow.com/q/26104489
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/40909362
accepted answer: http://stackoverflow.com/a/26190355
has comment: http://stackoverflow.com/comment/40908788
has title: java.lang.UnsatisfiedLinkError: Native method not found:
type: AnsweredQuestion
type: Question
has body: I keep getting this error when making calls to my native methods compiled in an .SO file. i dont why its happening since everything seems to be set up right any help would be appreciated error: java.lang.UnsatisfiedLinkError: Native method not found: de.jurihock.voicesmith.dsp.Math.abs:(FF)F at de.jurihock.voicesmith.dsp.Math.abs(Native Method) cpp file: pastebin.com/aBHNz642 Math.java package de.jurihock.voicesmith.dsp; public final class Math { static { System.loadLibrary("Voicesmith"); } public static final float PI = (float) java.lang.Math.PI; public static int round(float value) { return java.lang.Math.round(value); } public static native float pow(float base, float exponent); public static native float log10(float value); public static native float min(float a, float b); public static native float max(float a, float b); public static native float floor(float value); public static native float ceil(float value); public static native float sin(float angle); public static native float cos(float angle); public static native float sqrt(float value); public static native float atan2(float y, float x); public native float abs(float real, float imag); public static native float arg(float real, float imag); public static native float real(float abs, float arg); public static native float imag(float abs, float arg); public static native float random(float min, float max); public static native float princarg(float phase); public static native short mean(short[] buffer, int offset, int length); public static native float rms(short[] buffer, int offset, int length); public static native float rms(short[] buffer, int offset, int length, short mean); public static native float rms2dbfs(float value, float min, float max); } android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Name of the library without prefix "lib" and file extension LOCAL_MODULE := Voicesmith # Optimization flags (see KissFFT makefile) LOCAL_ARM_MODE := arm LOCAL_CFLAGS := -Wall -O3 -ffast-math -…
tagged with: android
has answer: http://stackoverflow.com/a/26190355
tagged with: c++
score: 0
tagged with: java
answer count: 1
tagged with: android-ndk

http://stackoverflow.com/comment/40902920
score: 1
has text: It's the voters that contribute to reputation gain not directly the answer itself. At least 7 people disagree with you and think the answer is valuable. And yes, the oddness of `switch` does make it on-topic. If you disagree, vote to close. There is **certainly** no reason to downvote the answer.
comment on: http://stackoverflow.com/q/26101144
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40962057
score: 0
type: AnswerComment
type: Comment
has text: So do I have to retrieve every variable through this method?
comment on: http://stackoverflow.com/a/26133727

http://stackoverflow.com/comment/41020615
score: 0
type: Comment
type: QuestionComment
has text: where do you set `gameIsOver` to true? it might happen that your `gameIsOver` is set to `true` when we already passed that condition in your `Runnable`. To quickly check it, you can add the same `if` right between your `postDelayed`
comment on: http://stackoverflow.com/q/26163069

http://stackoverflow.com/a/26163807
answers question: http://stackoverflow.com/q/26162901
score: 0
has body: First close the version of application that is already running on the HTC device. OR best thing woulld be uninstall it and try again. It should work Also, set the content view setContView(R.layout.your XML file name);
type: Answer

http://stackoverflow.com/a/26074388
has comment: http://stackoverflow.com/comment/40872934
has comment: http://stackoverflow.com/comment/40872637
has comment: http://stackoverflow.com/comment/40867543
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26063889
has comment: http://stackoverflow.com/comment/40867523
has comment: http://stackoverflow.com/comment/40870281
answers question: http://stackoverflow.com/q/26063889
has comment: http://stackoverflow.com/comment/40872470
has comment: http://stackoverflow.com/comment/40872617
type: Answer
has body: You should never ever manually modify anything inside the graph.db directory unless you're 100% sure what you're doing. To prevent the datastore directory from continuously growing check your setting for keep_logical_logs in neo4j.properties, see http://docs.neo4j.org/chunked/stable/configuration-logical-logs.html. Unless you require logical logs for online backup or cluster synchronization, you might be save deleting nioneo_logical.log.v* files. Make sure to have a backup first! Also check your settings for open file limits, http://docs.neo4j.org/chunked/stable/linux-performance-guide.html#_setting_the_number_of_open_files. There used to be a outdated version of Neo4j having a bug that might corrupt your datastore when running out of disc space. If that has happened to you either need to manually fix it on a binary level (which requires a lot of knowledge on Neo4j internals) or restore a previous backup from a time before you run out of disc.
downvote count: 0
score: 1

http://stackoverflow.com/a/26088956
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/40880748
answers question: http://stackoverflow.com/q/26088763
score: 2
has body: Your typing on fails1 is being overly restrictive, which contradicts the relatively looser wildcard constraint being imposed on it at declaration. An upper-bounded wildcard of the form ? extends T implies that you are willing to accept T and all of its subtypes. However, you explicitly restrict the right-hand side to Object. In essence, you're trying to take: Set&lt;Set&lt;? extends Object&gt;&gt; which is a set of sets that contain something which is an Object or extends Object... ...and turn it into this: Set&lt;Object&gt; which is only a set of Object types. There's a reason why this situation doesn't happen with works1: it defines a Set which contains elements of something that is an Object or a descendant of Object, and since Object fulfills at least one of those requirements, the capture conversion being done in the background will fulfill this rule. Then again, this is Java 8 you're working with - unless Java's compiler cannot do the type inference here, there is little gain in you passing in those types at all.
downvote count: 1
has comment: http://stackoverflow.com/comment/40880676

http://stackoverflow.com/q/26162814
answer count: 1
type: UnansweredQuestion
has title: Need help - Java If/Else
tagged with: java
has body: I am fairly new to Java and am in need of help with my If/Else statement. Basically I want to make it so that if the person types in n or no do one thing, or if the person puts in y or yes, do another thing, and if the person doesn't put in n, no, yes or y than do a different thing. But no matter what the user puts in, it acts as if they did not put in n, no, yes or y. How can I fix this? This is my code so far: public class Main { public static void main (String[] args) { Scanner userInputScanner = new Scanner(System.in); String [] charName = {"John", "Bob", "Sam"}; Random random = new Random(); int charNameChoice = random.nextInt(charName.length); System.out.println("Random char selected: " + charName[charNameChoice]); System.out.println("Y N Question1"); System.out.println("You can input y, yes, n or no"); String questionOneAnswer = userInputScanner.nextLine(); if (questionOneAnswer == "n" || questionOneAnswer == "no") { System.out.println("I disagree"); } else if (questionOneAnswer == "y" || questionOneAnswer == "yes") { System.out.println("I agree"); } else { System.out.println("Invalid"); } } }
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/26162829
duplicate of: http://stackoverflow.com/q/513832
score: 0
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41015805

http://stackoverflow.com/comment/40937838
score: 0
type: Comment
type: QuestionComment
has text: Ok, my question might have been misunderstood @HareshChhelana I'm not planning on changing the gallery intent. When you open the gallery using the intent, in the top right corner, you have a camera button which will take you to the camera app BUT I would like instead of using the camera intent there, use my camera layout.
comment on: http://stackoverflow.com/q/26120628

http://stackoverflow.com/comment/41040170
comment on: http://stackoverflow.com/q/26175877
score: 0
type: QuestionComment
has text: Quick and Dirty - Tokenize on "_" and get elements with index 1 and 2; Also you can try crafting another method using Apache's StringUtils. Actually if your format is constant, you can substring on hardcoded index. Just avoid regex when you can ;)
type: Comment

http://stackoverflow.com/q/26182223
accepted answer: http://stackoverflow.com/a/26182264
upvote count: 0
has body: An Activity I have makes an API call, while it is making this call the activity displays ProgressDialog. My problem is that while the ProgressDialog is being displayed the page is still clickable, and if the user clicks on a clickable object during this, it crashes the app. How can I disable the onClick functions of the activity while the ProgressDialog is running? EDIT: I would like to do this without removing the ability to cancel the loading.
favorite count: 0
has title: Prevent onClick while Activity is displaying Progress Dialog (Android)
tagged with: android
has answer: http://stackoverflow.com/a/26182589
tagged with: java
has answer: http://stackoverflow.com/a/26182264
possible better answer: http://stackoverflow.com/a/26182589
downvote count: 1
type: Question
type: AnsweredQuestion
score: -1
answer count: 2

http://stackoverflow.com/a/26081742
has comment: http://stackoverflow.com/comment/40868333
score: 0
has comment: http://stackoverflow.com/comment/40867732
has comment: http://stackoverflow.com/comment/40867983
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40868513
answers question: http://stackoverflow.com/q/26081622
upvote count: 2
downvote count: 2
has body: Okay...the problem is you are creating a new dictionary object in this class and your array list is associated with an Object or it is defined at the object level. So, a new arraylist gets created everytime you instantiate a Dictionary object. Try, making the arraylist as static in your Dictionary class. for example, public static ArrayList&lt;String&gt; yourArrayList; Now, once you have added some elements in your Dictionary in the main method, you can access that array list from FindWord class like Dictionary.dict or, if you are not in a position to take that decision of making array list static in dictionary class then you need to initialize the list in FindWord class too as your FindWord class code shows that you are not adding elements in the dict list here. Here, let me try again. Why null? public class: FindWords { public static void main(String[] args) { Dictionary dictionary = new Dictionary();//1 /*** . your list initialization code should come here . It could be a code block or a method defined in Dictionary class itself . which can be called like dictionary.initializeList(); ***/ System.out.print(dictionary.getList()); //3 } } here, dictionary object has an arraylist associated with it(true) but it is not initialized yet. So, when you are saying dictionary.getList(); it is actually fetching you the uninitialized list.
type: Answer
accepted answer of: http://stackoverflow.com/q/26081622

http://stackoverflow.com/q/26090227
tagged with: java
type: Question
tagged with: android-fragments
has body: I have three tabs in my app. First and third are just fragments and second is a listfragment. But I'm getting the below error when referencing listfragment in main class. Error: Type mismatch: cannot convert from ItemFragment to Fragment Code: mainactivity.java import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.ActionBar.TabListener; import android.app.Activity; import android.app.FragmentTransaction; 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.app.ListFragment; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.Log; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends FragmentActivity implements TabListener { ViewPager viewpager; ActionBar actionbar; @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.activity_main); actionbar=getActionBar(); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); viewpager=(ViewPager) findViewById(R.id.pager); viewpager.setAdapter(new MyAdapter(getSupportFragmentManager())); viewpager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int arg0) { actionbar.setSelectedNavigationItem(arg0); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); ActionBar.Tab tab1=actionbar.newTab(); tab1.setText("Home"); tab1.setTabListener(this); ActionBar.Tab tab2=actionbar.newTab(); tab2.setText("Tracker"); tab2.setTabListener(this); ActionBar.Tab tab3=actionbar.newTab(); tab3.setText("Progress"); tab3.setTabListener(this); actionbar.addTab(tab1); actionbar.addTab(tab…
score: 0
has answer: http://stackoverflow.com/a/26090284
answer count: 1
has title: ListFragment and Fragment
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/40851348
score: 0
has text: Hold on, let me modify and test it. :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26072976

http://stackoverflow.com/q/26112515
has body: I'm working with RAP and want to add something look like this image into my view. But I have no idea to call this thing to search on internet. So sorry for unspecific question.
tagged with: eclipse-plugin
has title: What should I call this widget?
favorite count: 0
tagged with: eclipse-rap
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40925854
tagged with: java
tagged with: swt
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26114984
possible better answer: http://stackoverflow.com/a/26114595
has answer: http://stackoverflow.com/a/26114595
has comment: http://stackoverflow.com/comment/40924320
accepted answer: http://stackoverflow.com/a/26114984
has comment: http://stackoverflow.com/comment/40926102
answer count: 2
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40925698

http://stackoverflow.com/a/26038630
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26038285
type: Answer
answers question: http://stackoverflow.com/q/26038285
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40826326
downvote count: 0
has body: It seems that the version 4.0.2 at least has a dependency on okhttp. This is only true for the twitter4j-spdy-support package and not the other in twitter4j. The pom.xml has: com.squareup.okhttp okhttp 1.5.1 If you want to use the twitter4j-spdy-support then you need to have the okhttp JAR file(s). If you use maven the running your app with maven will solve the problem. And the other option is not to use the spdy support and not have it in the classpath.
has comment: http://stackoverflow.com/comment/40788453

http://stackoverflow.com/q/26162996
type: Question
has comment: http://stackoverflow.com/comment/41036930
has comment: http://stackoverflow.com/comment/41021571
score: 0
has body: @RequestMapping(method = RequestMethod.GET) public HttpEntity&lt;Object&gt; list(WebRequest req) { I have this code in my application, I want to subclass the class that has this method and create a new method like this: @RequestMapping(method = RequestMethod.GET) public HttpEntity&lt;Object&gt; list(WebRequest req, @RequestParam(defaultValue = "false", required= true) String includehardcoded) { Now I am getting: java.lang.IllegalStateException: Ambiguous mapping found when my beans are created. I get that the declaration is ambigous but is there any way to make the method in the parent class accept no request parameters at all? This works: @RequestMapping(method = RequestMethod.GET, params="!includehardcoded") public HttpEntity&lt;Object&gt; list(WebRequest req) { but then it is an ugly hack that uses information from the subclass in the parent class (and I inherit this parent class multiple times).
has comment: http://stackoverflow.com/comment/41016264
answer count: 0
type: UnansweredQuestion
tagged with: spring
has title: How to create a @RequestMapping that accepts no request parameters Spring
tagged with: java

http://stackoverflow.com/a/26070716
has body: You must use something like this: if(score &gt;= 10 &amp;&amp; &lt;= 19) { discount = 0.20; } else if(score &gt;= 20 &amp;&amp; &lt;= 49) { discount = 0.30; } And so on....
answers question: http://stackoverflow.com/q/26070605
type: Answer
score: 0

http://stackoverflow.com/comment/41099119
comment on: http://stackoverflow.com/q/26185826
type: QuestionComment
has text: Is it the client's GUI freezing?
score: 0
type: Comment

http://stackoverflow.com/comment/40946784
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26125440
has text: Already answered : http://stackoverflow.com/questions/11251289/how-to-read-a-properties-file-in-java-from-outside-the-class-folder http://stackoverflow.com/questions/8775303/read-properties-file-outside-jar-file

http://stackoverflow.com/a/26156411
has comment: http://stackoverflow.com/comment/41004103
upvote count: 14
has comment: http://stackoverflow.com/comment/41005134
answers question: http://stackoverflow.com/q/26156360
has comment: http://stackoverflow.com/comment/41003991
accepted answer of: http://stackoverflow.com/q/26156360
has comment: http://stackoverflow.com/comment/41006202
type: Answer
score: 14
has comment: http://stackoverflow.com/comment/41005952
has body: Reading/Parsing the file: The best way to handle large files, in any language, is to try and NOT load them into memory. In java, have a look at MappedByteBuffer. it allows you to map a file into process memory and access its contents without loading the whole thing into your heap. You might also try reading the file line-by-line and discarding each line after you read it - again to avoid holding the entire file in memory at once. Handling the resulting objects For dealing with the objects you produce while parsing, there are several options: Same as with the file itself - if you can perform whatever it is you want to perform without keeping all of them in memory (while "streaming" the file) - that is the best solution. you didnt describe the problem youre trying to solve so i dont know if thats possible. Compression of some sort - switch from Wrapper objects (Float) to primitives (float), use something like the flyweight pattern to store your data in giant float[] arrays and only construct short-lived objects to access it, find some pattern in your data that allows you to store it more compactly Caching/offload - if your data still doesnt fit in memory "page it out" to disk. this can be as simple as extending guava to page out to disk or bringing in a library like ehcache or the likes. a note on java collections and maps in particular For small objects java collections and maps in particular incur a large memory penalty (due mostly to everything being wrapped as Objects and the existence of the Map.Entry inner class instances). at the cost of a slightly less elegant API, you should probably look at gnu trove collections if memory consumption is an issue.
downvote count: 0
has comment: http://stackoverflow.com/comment/41004038
has comment: http://stackoverflow.com/comment/41033041
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41004336

http://stackoverflow.com/q/26037367
downvote count: 0
tagged with: url
favorite count: 0
tagged with: web.xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40814369
has comment: http://stackoverflow.com/comment/40785865
has body: How to restrict "web.xml" being called in URL ? for example: "http://localhost:8080/myapp/web.xml" When i make request like this then blank page will be displayed and response status is 200 OK. And when i trying to catch this url in my custom "Filter" then the request will not comes to the filter only for this request. if you make a request to some other xml like "http://localhost:8080/myapp/test.xml" then the request will come to my custom Filter. My custom filter mapping is in web.xml: SecureRequestResponseFilter package.path.SecureRequestResponseFilter SecureRequestResponseFilter /* Thanks.
upvote count: 1
has title: How to restrict "web.xml" being called in URL (Servlet)?
tagged with: servlet-filters
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/40805212
tagged with: java
has comment: http://stackoverflow.com/comment/40790714
type: Question
has comment: http://stackoverflow.com/comment/40785607
has comment: http://stackoverflow.com/comment/40787231
has comment: http://stackoverflow.com/comment/40786644
tagged with: servlets
has comment: http://stackoverflow.com/comment/40785850
has comment: http://stackoverflow.com/comment/40786372

http://stackoverflow.com/q/26167150
score: 0
possible better answer: http://stackoverflow.com/a/26167497
has answer: http://stackoverflow.com/a/26167371
accepted answer: http://stackoverflow.com/a/26167371
tagged with: atomic
type: AnsweredQuestion
has body: I have a JSONArray which I am iterating to populate my Map as shown below. My ppJsonArray will have data like this - [693,694,695,696,697,698,699,700,701,702] Below is my code which is having issues with thread safety as my static analysis tool complained - Map&lt;Integer, Integer&gt; m = new HashMap&lt;Integer, Integer&gt;(); ConcurrentMap&lt;String, Map&lt;Integer, Integer&gt;&gt; partitionsToNodeMap = new ConcurrentHashMap&lt;String, Map&lt;Integer, Integer&gt;&gt;(); int hostNum = 2; JSONArray ppJsonArray = j.getJSONArray("pp"); for (int i = 0; i &lt; ppJsonArray.length(); i++) { m.put(Integer.parseInt(ppJsonArray.get(i).toString()), hostNum); } Map&lt;Integer, Integer&gt; tempMap = partitionsToNodeMap.get("PRIMARY"); if (tempMap != null) { tempMap.putAll(m); } else { tempMap = m; } partitionsToNodeMap.put("PRIMARY", tempMap); But when I am running static analysis tool, it is complaining as - Non-atomic use of get/check/put on partitionsToNodeMap.put("PRIMARY", tempMap) Which makes me think my above code is not thread safe? How can I resolve this issue?
tagged with: multithreading
type: Question
has title: How to fix non-atomic use of get/check/put?
has answer: http://stackoverflow.com/a/26167497
tagged with: java
tagged with: thread-safety
answer count: 2
tagged with: static-analysis

http://stackoverflow.com/comment/41011096
has text: I don't get it. Can you give a concrete example?
score: 0
comment on: http://stackoverflow.com/q/26160360
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26183784
score: 4
answers question: http://stackoverflow.com/q/26183721
type: Answer
upvote count: 4
has body: The problem is in getResourses() method. You can't call getResources() before your activity class is "officially" instantiated (it's an instance method, and at that point you don't have an instance yet). Use getResourses() in onCreate() method.
downvote count: 0
has comment: http://stackoverflow.com/comment/41055109

http://stackoverflow.com/comment/40881447
has text: Then you'll need to save the logical entities and not an image. There are many ways to do this, including serialization or xml serialization such as with JAXB.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26089184

http://stackoverflow.com/a/26096388
has comment: http://stackoverflow.com/comment/40895567
answers question: http://stackoverflow.com/q/26096180
score: 0
type: Answer
has body: Method is an Object which you will have to get using reflection.As I see the problems in your code,you cannot get Method Object using method invocation.Change this in your Main class.Check the javadoc here for getting Method Object from Class Object(for class Object you can use Class.forName(String class_binary_name) or Class literal public class Main { Terminal commandLine = new Terminal(); Method method = Main.class.getMethod("test",String.class); commandLine.setMethod('h',method); commandLine.executeCommand('h', "This is a test"); public void test(String data){ Log.d("Test", data); } } Also,change the return type of test class to void if you are not planning to return anything

http://stackoverflow.com/comment/42333704
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26070286
has text: Hey @Tim - The UserDetailsServiceImpl class is the one that I put in there which implements the UserDetailsService provided by Spring. I see no reason that failing. Just make sure you have the right dependencies. Sure we can do that live. Thanks !
score: 0

http://stackoverflow.com/a/26035556
has comment: http://stackoverflow.com/comment/40784380
has comment: http://stackoverflow.com/comment/40783846
has comment: http://stackoverflow.com/comment/40784583
score: 0
has comment: http://stackoverflow.com/comment/40784239
has comment: http://stackoverflow.com/comment/40784679
has comment: http://stackoverflow.com/comment/40784811
has body: When exporting, you can flag "use existing manifest".
type: Answer
has comment: http://stackoverflow.com/comment/40784313
has comment: http://stackoverflow.com/comment/40784640
answers question: http://stackoverflow.com/q/26034592

http://stackoverflow.com/comment/40871513
comment on: http://stackoverflow.com/q/26084031
has text: Why do you use both a class and its annotations, and an xml file, todefine the mapping of the same class? Just use one of them (the class and its annotations, preferrably). Also note that both of the queries are incorrect. `*` is SQL, not HQL. HQL uses entity names (i.e. class names), and not table names. And `h` isn't defined in the second query.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/26118167
type: Question
score: 0
tagged with: udp
answer count: 1
accepted answer: http://stackoverflow.com/a/26295722
has title: Writting a Java server with multiple UDP connections for each client
has comment: http://stackoverflow.com/comment/40936170
has comment: http://stackoverflow.com/comment/40933272
has body: First of all I’m going to introduce the situation: I’ve created an application that sends video and audio between two Android devices (direct connect between client and server). Now I want to go one step further and use a dedicated Java server running in a computer; this server will have to bridge the traffic between those client and server applications. As an example, at first both android applications will connect with the computer server, then, all the video data obtained from the first device will be sent to the server, and then, sent to the second device. The quick answer probably will be: Inside the server, create two sockets for each socket existing, and then use them to bridge data. The problem is that I have like 5 UDP sockets: Audio Tx and Rx, video Tx and Rx and Orders Tx in the client side, and Audio Tx and Rx, video Tx and Rx and Orders Rx in the server side, I also have a TCP Socket to manage the communication. So the only option I have at this point is: Client APP-----------Computer server-------------Server APP Audio Tx --------------------------> Audio Rx | Audio Tx -------------------------> Audio Rx Audio Rx &lt;-------------------------- Audio Tx | Audio Rx &lt;------------------------ Audio Tx Video Tx --------------------------> Video Rx | Video Tx ------------------------> Video Rx Video Rx &lt;------------------------- Video Tx | Video Rx &lt;------------------------ Video Tx Orders Tx ----------------------> Orders Rx | Orders Tx -----------------------> Orders Rx TCP &lt;-----------------------------------> TCP | TCP &lt;-----------------------------> TCP Which is an absolute hell to manage/code/maintain. The second option is the usage of NIO, but it’s not recommended when sending large amounts of data. Is this the a best way to do this? If not, is there any way to reduce the number of UDP sockets in the server since they will only bridge data between both devices? Thanks for your time!
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/40934171
has comment: http://stackoverflow.com/comment/40935566
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26295722
tagged with: java

http://stackoverflow.com/comment/40903125
type: QuestionComment
has text: Why r u putting all the thing in the postexecute.Do the webservice call in the background and actvity call in the post execute and as well use the context as such as you are getting from the constructor, no need to call context.getApplcationContext().
comment on: http://stackoverflow.com/q/26101159
score: 0
type: Comment

http://stackoverflow.com/comment/40940602
score: 1
comment on: http://stackoverflow.com/q/26122192
type: Comment
type: QuestionComment
has text: Not really. I have neither control of the `wsdl` (I'm just the client), nor on the autogenerated classes (as they must be regenerated every time a wsdl update takes place).

filewriter
tags question: http://stackoverflow.com/q/26110068
tag name: filewriter
tags question: http://stackoverflow.com/q/26165386
tags question: http://stackoverflow.com/q/26125082
tags question: http://stackoverflow.com/q/26123594
type: Tag
tags question: http://stackoverflow.com/q/26082495

http://stackoverflow.com/a/26041113
type: Answer
has comment: http://stackoverflow.com/comment/40794005
upvote count: 1
score: 1
has body: I'll try to summarize all good points mentioned above. Your options are, Use multithreading wherever possible but keep it mind that multithreading comes with a cost of additional memory(heapdumps and application will be down). Another good option is use bulk update but again bulk update comes with cost of more lock time at database end. so use it wisely as threads will be waiting till one thread finishes with updating as update will take exclusive lock i.e. no sharing possible. Try threading in along with async jobs (specially for mails) try to use different server/process for mail handling and send mail requests to mail server asynchronously which is quite fast as your mail generation task is handled by other process (In real life mail exchange can accept some delay thus your slow mail server is allowed but application server is not.) If possible move your complete Db update logic in stored procedure on DB server which will save your lot of time (Rule of Thumb : Always let A handle tasks for which A is designed/optimized i.e. DB are designed for faster DB operations than pgming languages.) Couldn't give you answer specific to your need but I hope this was helpful in terms of improving it :)
answers question: http://stackoverflow.com/q/26037098
downvote count: 0

http://stackoverflow.com/a/26090309
has body: You have to initialize ArraysTZones
score: 0
answers question: http://stackoverflow.com/q/26090262
type: Answer

http://stackoverflow.com/comment/40944083
type: Comment
type: QuestionComment
score: 2
has text: you aren't using else statements so each if line is being evaluated even when a match is met.
comment on: http://stackoverflow.com/q/26124007

http://stackoverflow.com/q/26141822
tagged with: java
has comment: http://stackoverflow.com/comment/40976579
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40976654
has title: Not returning the correct Value
favorite count: 0
has comment: http://stackoverflow.com/comment/40976599
has body: Main Class: public class Student { private int numberOfQuizzes; private double newQuizScore; private double averageScore; private double totalScore; private double average; private double gpa; private double finalGpa; private double gpa1; private double gpa2; private String className; private double gpa3; private boolean addQuiz; private String studentName; public Student(String studentName) { this.studentName = studentName; } public void addQuiz(double newQuizScore) { this.newQuizScore = newQuizScore; if(newQuizScore &gt;= 0) { totalScore = totalScore + newQuizScore; numberOfQuizzes++; } } public void setAverageScore() { averageScore = totalScore/numberOfQuizzes; } public void resetScore() { averageScore = 0; totalScore = 0; numberOfQuizzes = 0; newQuizScore = 0; } public void setGpaValue(double average, String className) { if(className.equalsIgnoreCase("Biology")) { if( average &gt;= 93.0) { gpa1 = 4.0; } else if(average &lt; 93.0 &amp;&amp; average &gt;= 90.0) { gpa1 = 3.66; } else if(average &lt; 90.0 &amp;&amp; average &gt;= 87.0) { gpa1 = 3.33; } else if(average &lt; 87.0 &amp;&amp; average &gt;= 83) { gpa1 = 3.00; } else if(average &lt; 84.0 &amp;&amp; average &gt;= 80.0) { gpa1 = 2.66; } else if(average &lt; 80 &amp;&amp; average &gt;= 77) { gpa1 = 2.33; } else if(average &lt; 77 &amp;&amp; average &gt;= 73) { gpa1 = 2.00; } else if(average &lt; 73 &amp;&amp; average &gt;= 70) { gpa1 = 1.66; } else if(average &lt; 70 &amp;&amp; average &gt;= 67) { gpa1 = 1.33; } else if(average &lt; 67 &amp;&amp; average &gt;= 63) { gpa1 = 1.00; } else if(average &lt; 63 &amp;&amp; average &gt;= 60.0) { gpa1 = .66; } else if(average &lt; 60 &amp;&amp; average &gt;= 0) { gpa1 = .00; } } if(className.equalsIgnoreCase("Calculus")) { if( average &gt;= 93.0) { gpa2 = 4.0; } else if(average &lt; 93.0 &amp;&amp; average &gt;= 90.0) { gpa2 = 3.66; } else if(average &lt; 90.0 &amp;&amp; average &gt;= 87.0) { gpa2 = 3.33; } else if(average &lt; 87.0 &amp;&amp; average &gt;= 83) { gpa2…
has answer: http://stackoverflow.com/a/26141890
type: UnansweredQuestion
downvote count: 7
type: Question
score: -7

http://stackoverflow.com/q/26066049
has answer: http://stackoverflow.com/a/26067365
has answer: http://stackoverflow.com/a/26387658
has title: Spring MVC not populating model attribute
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26387658
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has body: I am trying to populate the object using model attribute. It's returning null from JSP to controller. <form:form method="post" action="addProduct" modelAttribute="product"> Product Name : <form:input path="productName"/> Parent Product Id: <form:input path="parentId"/> Category Id: <form:input path="categoryId"/> </form:form> @Autowired private ProductService productService; @RequestMapping(value = "addProduct", method = RequestMethod.GET) public ModelAndView productForm(@ModelAttribute("product") Product product){ return new ModelAndView("addProduct")); } @RequestMapping(value = "addProduct", method = RequestMethod.POST) public ModelAndView insertProduct(@ModelAttribute("product") Product product){ System.out.println(product.getProductName() + " : " + product.getParentId() + " : " + product.getCategoryId()); productService.insert(product); return new ModelAndView("success"); } While getting the values back in controller using modelAttribute it's coming as null. What am I doing wrong? Also there is one more thing I am doing same thing in my Catergory class, which is working perfectly fine. Not able to understand what's wrong in here.
possible better answer: http://stackoverflow.com/a/26067365

http://stackoverflow.com/comment/41114942
score: 0
type: Comment
has text: No, I say other thing. Focalizes now on one table (parkTable). With your implementation of **setValueAt**, I have two calls of **super.setValueAt** (if I have modified *TYPE*'s jcombobox). But in this way I generate two updates, and the corresponding *TableModelListener* is called two times.
type: AnswerComment
comment on: http://stackoverflow.com/a/26144157

http://stackoverflow.com/q/26081326
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40869421
has answer: http://stackoverflow.com/a/26082778
tagged with: floating-point
has comment: http://stackoverflow.com/comment/40871192
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40879595
has comment: http://stackoverflow.com/comment/40870532
linked to: http://stackoverflow.com/q/588004
linked to: http://stackoverflow.com/q/18031221
has body: When I run the following code: double x = 4.35; double y = x * 100; System.out.println(y); I get 434.99999999999994 which is expected due to the nature of floating point precision. However when I run: double x = 4.35; double y = x * 1000; System.out.println(y); I get 4350.0 in the console. Similarly when I replace the 1000 with 10, I get 43.5, which is peculiar, since there is no rounding error for these numbers. It seems that there is only rounding error when I mulptiply the double by 10 to the power of the number of decimal places. Why is it like that? Also, when I tried running the three blocks of code using 4.25 as my value for x, I got a nice 425.0 in the console. Does rounding error only apply to some decimal values? EDIT: Dividing 4.35 by 10 also gave me a wacky decimal (0.43499999999999994 to be exact). Also, if I set x to 43.5, there were no rounding errors at all. Multiplying by 10 gave me 435.0. EDIT 2: I think some people are misinterpreting my question. I'm asking why this happens and not how to avoid running into these errors.
tagged with: floating-point-precision
answer count: 2
duplicate of: http://stackoverflow.com/q/588004
duplicate of: http://stackoverflow.com/q/18031221
favorite count: 0
has comment: http://stackoverflow.com/comment/40868789
has answer: http://stackoverflow.com/a/26081402
has comment: http://stackoverflow.com/comment/40869384
type: UnansweredQuestion
tagged with: double
upvote count: 1
has comment: http://stackoverflow.com/comment/40874935
has comment: http://stackoverflow.com/comment/40866969
has title: Rounding error for double?

http://stackoverflow.com/comment/40927086
type: AnswerComment
has text: I was checking the code again but can´t find a further initialization of the table 'question'. I know it´s not clear to see in my code example but the creat table call is written into the onCreate() function. So this should only be called once right?
score: 0
comment on: http://stackoverflow.com/a/26089996
type: Comment

http://stackoverflow.com/a/26142916
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26142819
has body: public Question makeQuestion(){ //scanner checks line and takes action while(fileScan.hasNextLine()){ //save the line String line = fileScan.nextLine(); //if line starts with Q do something if(line != null &amp;&amp; !line.isEmpty() &amp;&amp; line.charAt(0) == 'Q'){ System.out.println(line); } } If you call nextLine in the loop twice it is possible that you reach the last line in your first call. in that case, the second call will throw the exception because there is no next line.
has comment: http://stackoverflow.com/comment/40978676
has comment: http://stackoverflow.com/comment/40978625

http://stackoverflow.com/comment/40997737
comment on: http://stackoverflow.com/q/26152245
has text: Where is the function `determineGrade`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26095407
has body: My working solution (for playFramework 2.2.4) based on post: https://stackoverflow.com/a/14706767/1066240 My Global.java class in /app/Global.java import org.joda.time.DateTime; import org.joda.time.Seconds; import actions.ValidateApplicationLicence; import akka.actor.ActorRef; import akka.actor.Props; import play.Application; import play.GlobalSettings; import play.Logger; import play.libs.Akka; import scala.concurrent.duration.Duration; import java.util.concurrent.TimeUnit; public class Global extends GlobalSettings { //ActorRef myActor = Akka.system().actorOf(new Props(ValidateApplicationLicence.class)); @Override public void onStart(Application application) { Akka.system().scheduler().schedule( Duration.create(20, TimeUnit.SECONDS), Duration.create(5, TimeUnit.SECONDS), new Runnable() { @Override public void run() { Logger.info("After 10 sec and after EVERY 5 sec --- " + controllers.common.Index.getDate(null)); } }, Akka.system().dispatcher() ); Akka.system().scheduler().scheduleOnce( Duration.create(10, TimeUnit.MILLISECONDS), new Runnable() { public void run() { Logger.info("ON START --- " + controllers.common.Index.getDate(null)); } }, Akka.system().dispatcher() ); // Akka.system().scheduler().schedule( // Duration.create(0, TimeUnit.MILLISECONDS), //Initial delay 0 milliseconds // Duration.create(30, TimeUnit.MINUTES), //Frequency 30 minutes // myActor, // "tick", // Akka.system().dispatcher(), // null // ); } public static int nextExecutionInSeconds(int hour, int minute){ return Seconds.secondsBetween( new DateTime(), nextExecution(hour, minute) ).getSeconds(); } public static DateTime nextExecution(int hour, int minute){ DateTime next = new DateTime() .withHourOfDay(hour) .withMinuteOfHour(minute) .withSecondOfMinute(0) .withMillisOfSecond(0); return (next.isBeforeNow()) ? next.plusHours(24) : next; } }
accepted answer of: http://stackoverflow.com/q/26060170
type: Answer
answers question: http://stackoverflow.com/q/26060170
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/26102900
type: UnansweredQuestion
has body: I have a the following source structure /src/main/java /src/main/resources /src/main/resources/stuff /src/main/resources/stuff/1.txt /src/main/resources/stuff/2.txt In my code I access the files in the stuff folder via: ClassLoader.class.getResource("/stuff/1.txt").getFile() When this is deployed it is deployed like this: / /lib /lib/my-app.jar /lib/other.jar /lib/stuff Currently my classpath is set to: lib/* but I can't resolve lib/stuff/1.txt in the way I do above. What do I need to set on the classpath for the above code to work?
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40906268
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26103689
has title: Add folder to classpath

http://stackoverflow.com/a/26081105
has body: A: Node.js will not respond to any request unless you write code that actively sends a response. It doesn't matter whether that code runs synchronously or asynchronously. The client (or even the server's networking stack) cannot know or care whether asynchrony happened in the meantime. B: There is only one Node.js thread, period. When a response arrives for an asynchronous operation kicked off in Node.js code, an event is raised in the Node.js event loop thread, and the appropriate callback/handler is called.
has comment: http://stackoverflow.com/comment/40866841
has comment: http://stackoverflow.com/comment/40866486
has comment: http://stackoverflow.com/comment/40868858
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26081093
has comment: http://stackoverflow.com/comment/40866463
type: Answer

http://stackoverflow.com/comment/40970134
score: 0
has text: thanks @david.. it works only if i put JSONIgnore annotation on field getters
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26117364

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/26082105

sql
tags question: http://stackoverflow.com/q/26148152
tags question: http://stackoverflow.com/q/26166833
tags question: http://stackoverflow.com/q/26067872
tags question: http://stackoverflow.com/q/26124694
tags question: http://stackoverflow.com/q/26141070
tags question: http://stackoverflow.com/q/26101870
tags question: http://stackoverflow.com/q/26119991
tags question: http://stackoverflow.com/q/26099301
tags question: http://stackoverflow.com/q/26165287
tags question: http://stackoverflow.com/q/26064864
tags question: http://stackoverflow.com/q/26100379
tags question: http://stackoverflow.com/q/26055530
tags question: http://stackoverflow.com/q/26185863
tags question: http://stackoverflow.com/q/26044489
tags question: http://stackoverflow.com/q/26089977
tags question: http://stackoverflow.com/q/26118629
tags question: http://stackoverflow.com/q/26062115
tags question: http://stackoverflow.com/q/26122103
tags question: http://stackoverflow.com/q/26144980
tags question: http://stackoverflow.com/q/26186413
tags question: http://stackoverflow.com/q/26122814
tags question: http://stackoverflow.com/q/26160093
tags question: http://stackoverflow.com/q/26084349
tags question: http://stackoverflow.com/q/26104757
tags question: http://stackoverflow.com/q/26044060
tags question: http://stackoverflow.com/q/26058826
tags question: http://stackoverflow.com/q/26079072
tags question: http://stackoverflow.com/q/26122006
tags question: http://stackoverflow.com/q/26153110
tag name: sql
tags question: http://stackoverflow.com/q/26144762
type: Tag
tags question: http://stackoverflow.com/q/26193739
tags question: http://stackoverflow.com/q/26046234
tags question: http://stackoverflow.com/q/26058774
tags question: http://stackoverflow.com/q/26092489
tags question: http://stackoverflow.com/q/26070724
tags question: http://stackoverflow.com/q/26045798
tags question: http://stackoverflow.com/q/26160364
tags question: http://stackoverflow.com/q/26183339
tags question: http://stackoverflow.com/q/26175326
tags question: http://stackoverflow.com/q/26138162
tags question: http://stackoverflow.com/q/26071356
tags question: http://stackoverflow.com/q/26173083
tags question: http://stackoverflow.com/q/26075804
tags question: http://stackoverflow.com/q/26146905
tags question: http://stackoverflow.com/q/26098284
tags question: http://stackoverflow.com/q/26176800
tags question: http://stackoverflow.com/q/26073401
tags question: http://stackoverflow.com/q/26085322
tags question: http://stackoverflow.com/q/26191259
tags question: http://stackoverflow.com/q/26170370
tags question: http://stackoverflow.com/q/26160861
tags question: http://stackoverflow.com/q/26174411
tags question: http://stackoverflow.com/q/26175433
tags question: http://stackoverflow.com/q/26065483
tags question: http://stackoverflow.com/q/26076189
tags question: http://stackoverflow.com/q/26144506
tags question: http://stackoverflow.com/q/26154866
tags question: http://stackoverflow.com/q/26139453
tags question: http://stackoverflow.com/q/26045200
tags question: http://stackoverflow.com/q/26141479
tags question: http://stackoverflow.com/q/26068993
tags question: http://stackoverflow.com/q/26123074
tags question: http://stackoverflow.com/q/26121219
tags question: http://stackoverflow.com/q/26124475
tags question: http://stackoverflow.com/q/26149751
tags question: http://stackoverflow.com/q/26157368
tags question: http://stackoverflow.com/q/26045124
tags question: http://stackoverflow.com/q/26141312
tags question: http://stackoverflow.com/q/26156418
tags question: http://stackoverflow.com/q/26143415

http://stackoverflow.com/a/26171947
answers question: http://stackoverflow.com/q/26171920
has body: Your loop goes in circles for two reasons: You try for nextInt, but you do not clear out the input buffer on failure, and Even if you did clear input in the catch, your loop would still go on, because there are no assignments of the loop variable which is supposed to stop your loop.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41033615
has comment: http://stackoverflow.com/comment/41033532
type: Answer
accepted answer of: http://stackoverflow.com/q/26171920
has comment: http://stackoverflow.com/comment/41033128
has comment: http://stackoverflow.com/comment/41042659
has comment: http://stackoverflow.com/comment/41034504
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/41033185

http://stackoverflow.com/comment/40872897
comment on: http://stackoverflow.com/a/26084746
type: Comment
has text: Thank you. You are awesome. :D YOu've given me more stuff to learn about regarding syntax as well. :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/26067024
type: AnsweredQuestion
has title: Develop Java apps like android?
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40841258
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26067069
has answer: http://stackoverflow.com/a/26067089
has answer: http://stackoverflow.com/a/26067101
favorite count: 0
accepted answer: http://stackoverflow.com/a/26067069
has body: this might seem like a really strange question but I would like to develop a Java application (for my computer) like I would when I develop for Android. It seems like it is a lot simpler making an android app than a regular application for my computer. I really miss the drag-and-drop function for your XML-file and how you can launch different intents from you java-code. Is there a similar way to do that in eclipse but for a regular application? I don't like having to work with JFrame :/.
possible better answer: http://stackoverflow.com/a/26067101
has comment: http://stackoverflow.com/comment/40840984
upvote count: 1
tagged with: swing
downvote count: 1

http://stackoverflow.com/a/26129574
answers question: http://stackoverflow.com/q/26129545
type: Answer
has body: The semi-colons after the if statement ensure that the following statement blocks are always executed if (answer == terrible); ^ Simply remove them all
score: 0
has comment: http://stackoverflow.com/comment/40954883

http://stackoverflow.com/comment/40839674
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26066440
has text: Nice assumption skipping static method usage !!

http://stackoverflow.com/q/26070816
has body: I'm trying to manipulate an open source project, where I have made my changes and created the WAR file. The WAR file that I have created is an "dependency" for an another module. The code for that "dependent" module uses org.eclipse.aether.artifact.DefaultArtifact like this: public static DefaultArtifact getReportArtifact(String version) { return new DefaultArtifact(ALLURE_GROUP_ID, ALLURE_REPORT_FACE_ARTIFACT_ID,"WAR", version); } to get the WAR and builds it jar. I need to pass the my local WAR file, instead of it getting from the Maven repo. How can I do that? Thanks in advance.
tagged with: java
linked to: http://stackoverflow.com/q/7281913
has comment: http://stackoverflow.com/comment/40848520
tagged with: eclipse
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40848014
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26089349
has comment: http://stackoverflow.com/comment/40848498
has answer: http://stackoverflow.com/a/26085775
tagged with: maven
has title: Giving the war from local system rather than from Maven repo
has comment: http://stackoverflow.com/comment/40848359
type: Question
has comment: http://stackoverflow.com/comment/40875132
linked to: http://stackoverflow.com/q/1693322
has comment: http://stackoverflow.com/comment/40862457

http://stackoverflow.com/comment/41004519
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26156163
has text: Thx for reply, I have tried ur solution, but it throws error <Could not parse certificate> on cf.generateCertPath

http://stackoverflow.com/q/26071429
favorite count: 0
answer count: 12
has answer: http://stackoverflow.com/a/75325110
has answer: http://stackoverflow.com/a/42848413
possible better answer: http://stackoverflow.com/a/53397146
has answer: http://stackoverflow.com/a/53397146
accepted answer: http://stackoverflow.com/a/26071504
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72716704
has answer: http://stackoverflow.com/a/77754239
has answer: http://stackoverflow.com/a/72002803
has title: SSL Java java.io.IOException: Invalid keystore format
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/72804953
has answer: http://stackoverflow.com/a/75807074
has answer: http://stackoverflow.com/a/79091797
score: 18
tagged with: ssl
upvote count: 18
has comment: http://stackoverflow.com/comment/40849525
tagged with: security
has answer: http://stackoverflow.com/a/26071504
has answer: http://stackoverflow.com/a/59312913
downvote count: 0
has answer: http://stackoverflow.com/a/50069288
has body: I am testing SSL in java with SSLServerSocket and other classes in the java.ssl package. When I run the following code, I get the exception java.io.IOException: Invalid keystore format. My code: package testing; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.security.KeyStore; import javax.net.ServerSocketFactory; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.TrustManager; public class SSLServerTest { public static void main(String[] args) { try { int port = 3000; SSLContext sc = SSLContext.getInstance("TLSv1.2"); KeyStore ks = KeyStore.getInstance("JKS"); InputStream ksIs = new FileInputStream("key.txt"); try { ks.load(ksIs, "Bennett556".toCharArray()); } finally { if (ksIs != null) { ksIs.close(); } } KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, "Bennett556".toCharArray()); sc.init(kmf.getKeyManagers(), new TrustManager[] {}, null); ServerSocketFactory ssocketFactory = sc.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssocketFactory .createServerSocket(port); ssocket.setEnabledProtocols(new String[] { "SSLv3" }); Socket socket = ssocket.accept(); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream()); out.println("Hello, Securly!"); out.close(); in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } } } File key.txt: 1268312345812304612348712634283427346 I am guessing I should put something else in the key.txt file, but I do not know what to put in it. Probably a searilized object. EDIT: Client Code: package testing; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.security.KeyStore; impor…
has answer: http://stackoverflow.com/a/69270811

http://stackoverflow.com/comment/41031309
comment on: http://stackoverflow.com/a/26170464
has text: You, my friend are a freaking genius!!! It worked!!! Thank you a million! I hope you become rich, powerful and never have to do anything else!!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26175026
upvote count: 4
has comment: http://stackoverflow.com/comment/41204252
has comment: http://stackoverflow.com/comment/41204215
answers question: http://stackoverflow.com/q/26103642
downvote count: 0
has comment: http://stackoverflow.com/comment/41220925
has comment: http://stackoverflow.com/comment/41220024
has comment: http://stackoverflow.com/comment/41219719
type: Answer
has comment: http://stackoverflow.com/comment/41204284
score: 4
has comment: http://stackoverflow.com/comment/41215635
has comment: http://stackoverflow.com/comment/41204234
has body: First of all I want to tell that I build a lot of php apps with Symfony (not Symfony 2) so there might be some inconsistency in what I'm telling, but I can share my point of view anyway. First of all Symfony, as written in php, is complete framework for everything. It has a vision of folder (package) structure not only because it makes your code well organized... but also due to technical limitatins of php. Php is mostly basing on incuding other php sources by using directives like: include ('/lib/somelib.lib.php'); This is the only way php can load resources. This leads to some consequences in writing frameworks in php. For example in Symfony when you point your browser to http://localhost/some_module/some_url symfony will assume "by convenction" that you want to load a controller named: some_module and you want to execute method some_url in this controller. At the first glance this sounds great, but there is one "catch" in this. Symfony requires it because this is the only way Symfony can infer which controller and which method you want to load (this is probably similar in Symfony2). Otherwise you would need to create extra configuration file. Java on the other hand gives you many ways to achieve this without forcing you the name of your controller and a method. Spring MVC simply utilizes what java gives you. In Spring you can give any name to your controller, and any name to your method. You can achieve this for example by using annotatations on controller class and method: @Controller public class MyController { @RequestMapping(value = "/some_module/some_url", method = RequestMethod.GET) public ModelAndView searchForSomeData(@PathVariable("currentPage") String currentPageUrlString, @RequestParam("userId") Integer userId) { (...) } You can place your controller in any folder (package) and spring will discover it via "component scanning feature". You don't need to rely on "convention over configuration" which is used in php (because of it's limitations). You can c…
has comment: http://stackoverflow.com/comment/41215464
has comment: http://stackoverflow.com/comment/41203190
has comment: http://stackoverflow.com/comment/41189157

http://stackoverflow.com/q/26148560
type: Question
has body: I am new to maven. I am trying to build a project given to me. But I keep getting the following error. I have deleted the .m2 directory multiple times with no luck. I read through a few post suggestions the ISP was sending HTML file instead of HTTP code. Here is a log from the run. Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00) [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [WARNING] 'parent.relativePath' points at com.psystems:ps-framework instead of com.psystems:super-pom, please verify your project structure @ line 2, column 10 [FATAL] Non-parseable POM /root/.m2/repository/com/psystems/super-pom/1.0.0/super-pom-1.0.0.pom: Expected root element 'project' but found 'html' (position: START_TAG seen ..." "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ... @1:127) @ /root/.m2/repository/com/psystems/super-pom/1.0.0/super-pom-1.0.0.pom, line 1, column 127 at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:672) at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:663) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:250) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.code…
score: 4
has comment: http://stackoverflow.com/comment/40990517
tagged with: eclipse
tagged with: apache
downvote count: 0
favorite count: 0
has title: Maven Build error "Expected root element project but found html"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40993836
has comment: http://stackoverflow.com/comment/40990242
tagged with: maven
upvote count: 4
has comment: http://stackoverflow.com/comment/41017909
answer count: 0
tagged with: java

http://stackoverflow.com/a/26066553
has body: Max # of linked array depends on the memory size. For Java you can take a look at the JVM mem size to figure that out. The space usage for both link list and array is the same. The only difference is that Array requires continues memory allocation and linked list doesn't. So generally speaking link list should always have a bigger size cap than array. (If the memory is not allocated at all then both has the same max cap)
upvote count: 2
answers question: http://stackoverflow.com/q/26066501
has comment: http://stackoverflow.com/comment/40839863
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40839944

http://stackoverflow.com/comment/40992514
comment on: http://stackoverflow.com/q/26150035
score: 1
has text: @AleksG JavaDoc: "StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code." Interestingly, it's not marked as deprecated.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26080493
accepted answer: http://stackoverflow.com/a/26080535
tagged with: for-loop
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26080543
has answer: http://stackoverflow.com/a/26080543
answer count: 3
has comment: http://stackoverflow.com/comment/40865184
has comment: http://stackoverflow.com/comment/40865285
has body: The point of this program is to break down a large array into four separate arrays using recursion until each array contains less than or equal to 1000 integers. When the happens, the arrays will be sorted and then added to an ArrayList. My problem is that after declaring the four sub-arrays, my program entirely skips over the set of for loops and goes right to the recursive call, which results in my arrays being filled with nothing but zeros. I have no idea why this happens, so any insight would be greatly appreciated. public static void quadSort(int[] array, int startIndex, int endIndex) { // Insertion sort if(endIndex - startIndex &lt;= 1000) { for(int i = 0; i &lt;= endIndex; i++) { int x = array[i]; int j = i; while(j &gt; 0 &amp;&amp; array[j - 1] &gt; x) { array[j] = array[j - 1]; j = j - 1; } array[j] = x; } for(int i = 0; i &lt; array.length; i++) { list.add(array[i]); } } else { // Split array into four separate arrays int[] a = new int[(endIndex + 1) / 4]; int[] b = new int[(endIndex + 1) / 4]; int[] c = new int[(endIndex + 1) / 4]; int[] d = new int[(endIndex + 1) / 4]; // Fill separate arrays with initial array's values for(int i = 0; i &lt; (endIndex + 1) * (1/4); i++) { for(int k = startIndex; k &lt; (endIndex + 1) * (1/4); k++) { a[i] = array[k]; } for(int l = (endIndex + 1) * (1/4); l &lt; (endIndex + 1) * (1/2); l++) { b[i] = array[l]; } for(int m = (endIndex + 1) * (1/2); m &lt; (endIndex + 1) * (3/4); m++) { c[i] = array[m]; } for(int n = (endIndex + 1) * (1/4); n &lt; endIndex + 1; n++) { d[i] = array[n]; } } quadSort(a,0,a.length - 1); quadSort(b,0,b.length - 1); quadSort(c,0,c.length - 1); quadSort(d,0,d.length - 1); } }
has comment: http://stackoverflow.com/comment/40865407
favorite count: 0
has answer: http://stackoverflow.com/a/26080544
has comment: http://stackoverflow.com/comment/40865260
upvote count: 2
has answer: http://stackoverflow.com/a/26080535
has comment: http://stackoverflow.com/comment/40865281
has title: Java program skips over for loop
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: loops
downvote count: 1
tagged with: skip
type: Question

http://stackoverflow.com/q/26165956
has comment: http://stackoverflow.com/comment/41022456
possible better answer: http://stackoverflow.com/a/26166190
has title: Stuck on creating a object via for loop
has body: I am stuck in creating in an object for an account, and I don't know where the problem is. My output shows only the recent inputted value. I would like to see the printed details (especially different id's) that I've created, and I don't know how to do that. Please check my code because I think my loop has a bug in it, somewhat shows display messages that doesn't need to display. BankSystem.java: import java.io.*; import java.util.Scanner; public class BankSystem { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); BankAccount account[] = new BankAccount[5]; BankClient client[] = new BankClient[5]; BankSystem myBankSystem = new BankSystem(); String MainMenu; do { System.out.println(""); System.out.println("------PLP BANK SYSTEM------"); System.out.println("Main Menu: "); System.out.println("[A]ccount Management" ); System.out.println("[C]lient Management" ); System.out.println("[Q]uit" ); System.out.println(""); System.out.print("Please select letter: "); MainMenu = in.nextLine(); switch (MainMenu.toLowerCase()) { case "a": System.out.println(""); System.out.println("------PLP BANK SYSTEM------"); System.out.println("Account Management:" ); System.out.println("[N]ew Account" ); System.out.println("[A]Apply Interest to All Accounts" ); System.out.println("[L]ist All Accounts" ); System.out.println("[F]ind an Account" ); System.out.println("[D]eposit to an Account" ); System.out.println("[W]ithdraw from an Account" ); System.out.println("[R]eturn to Main Menu" ); System.out.println(""); System.out.print("Please select letter: " ); String AccountManagement = in.nextLine(); switch (AccountManagement.toLowerCase()) { case "n": //NEW ACCOUNT System.out.print("Please input your desired ID number: " ); int id = in.nextInt(); System.out.print("Please input your desired Balance: " ); double balance = in.nextDouble(); System.out.print("Please input your desired Interest Rate: " ); double interestRate = in.nextDouble(); // IS THE PR…
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/41022103
has comment: http://stackoverflow.com/comment/41022493
tagged with: java
has answer: http://stackoverflow.com/a/26166190
tagged with: loops
has comment: http://stackoverflow.com/comment/41022198
type: Question
answer count: 2
downvote count: 4
upvote count: 0
tagged with: arrays
tagged with: banking
has answer: http://stackoverflow.com/a/26166225
accepted answer: http://stackoverflow.com/a/26166225
has comment: http://stackoverflow.com/comment/41022788
favorite count: 0
has comment: http://stackoverflow.com/comment/41022232
score: -4

http://stackoverflow.com/comment/40941052
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26122266
has text: @ElliottFrisch ya but that is pretty much better than this?
score: 0

http://stackoverflow.com/q/26036950
favorite count: 0
type: Question
tagged with: apache-poi
upvote count: 2
accepted answer: http://stackoverflow.com/a/26050018
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/34428000
linked to: http://stackoverflow.com/q/25880954
tagged with: excel
has title: Using Apache POI to get Border & Fill Styles for new cell
possible better answer: http://stackoverflow.com/a/26044271
type: AnsweredQuestion
score: 2
has body: Following the post made @ POI Excel Merging Causing "Repaired Records: Format from /xl/styles.xml part (Styles)" I have two excel files which are opening fine with styles and colors (In microsoft office 2010). Iam merging both of those excel files using the code posted in the thread above. The problem is with the styles (I created styles as below): newCellStyle = newCell.getSheet().getWorkbook().createCellStyle(); newCellStyle.cloneStyleFrom(oldCellStyle); styleMap.put(stHashCode, newCellStyle); which has caused the styles problem "Repaired Records: Format from /xl/styles.xml part (Styles)" after a fair amount of research what I learnt is the border and fill is causing the problem. Un setting these parameters has solved the problem. But as it states border and fill went missing. Can some one throws idea around how to get the border and fill style from a cell and apply to a new cell ?
has answer: http://stackoverflow.com/a/26044271
downvote count: 0
has answer: http://stackoverflow.com/a/26050018

http://stackoverflow.com/comment/40799948
comment on: http://stackoverflow.com/q/26044949
has text: I don't get the *"return 0, because there 11, 7 are odd but, 10 is greater then 7"* part.
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40941530
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26121811
has text: Leo, that was exactly what I meant.

http://stackoverflow.com/comment/40891966
type: AnswerComment
comment on: http://stackoverflow.com/a/26094875
type: Comment
score: 1
has text: maybe this? http://stackoverflow.com/questions/16757085/eclipse-annoyances-debug-and-launch-toolbars-unavailable

http://stackoverflow.com/q/26110694
tagged with: sockets
score: 0
has body: I need to create proxy that needs to be installed locally as windows32(64) service and should run automatically when operating system run. It should route requests to particular server or to the original server depending on some criteria. Also should keep track of user session and cookies. Should I go with servlet api and Tomcat OR run my own server and do socket programming?
has title: Creating proxy using servlet or sockets
has comment: http://stackoverflow.com/comment/40939759
tagged with: java
type: UnansweredQuestion
tagged with: servlets
linked to: http://stackoverflow.com/q/16451413
answer count: 0
duplicate of: http://stackoverflow.com/q/16451413
tagged with: proxy
type: Question
has comment: http://stackoverflow.com/comment/40920172

http://stackoverflow.com/q/26045368
type: Question
has answer: http://stackoverflow.com/a/26046139
answer count: 2
score: 2
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26046139
has title: How to pass values from servlet to html page
has body: I'm developing a web server using servlet (v3.0) and jetty v9. I have to serve a HTML page but before I do, I need to modify the CSS inline-styles for a couple of elements on the page, dependent on the value of a boolean variable. I've been looking at JSP tutorials and examples for ages, and I don't feel like I'm any closer to figuring it out. To simplify it, this is what I'm trying to do: page.jsp: (in /WAR/html) My Page <p <% style="display:none" if variable is true %>> GetPage.java: public class GetPage extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { boolean decision = getDecision(); // get the JSP page and process the JSP with the boolean variable... resp.setContentType("text/html"); resp.getWriter().print(???); } } I've been using Java for years but never used JSP before. I would have thought this is JSP 101 but I don't understand how it works. Also, my real use case is not too far off that example above. Is JSP overkill for this purpose and if so, is there a better alternative?
favorite count: 0
has comment: http://stackoverflow.com/comment/40801053
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5414600
possible better answer: http://stackoverflow.com/a/26068317
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26068317
tagged with: servlets

http://stackoverflow.com/comment/41018494
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26163899
score: 0
has text: so what is the functional purpose of the piece of code

http://stackoverflow.com/q/26169792
score: 0
has body: I'm having a problem using Pattern and Matcher in Java.. I'm trying to use it to extract two numbers from a String containing at least .SXXEXX. where XX is the int's I want to extract. Any regex/java pro wanna help me out? This is my best try to do it, but it causes a runtime exception.. :( String s = "Some.Cool.Series.S06E01.720p.HDTV.X264-Pewpew"; Pattern p = Pattern.compile("[^.S].S(\\d2)E(\\d+2)\\p{Alpha}"); Matcher m = p.matcher(s); String season = m.group(0); String episode = m.group(1);
linked to: http://stackoverflow.com/q/415580
answer count: 2
has title: Pattern and Matcher regex in Java
has answer: http://stackoverflow.com/a/26189359
has answer: http://stackoverflow.com/a/26169850
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: regex
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41028984

http://stackoverflow.com/q/26080201
answer count: 1
has body: Can i find the code for Java's built in functions? Such like compareTo, I'm working on a program that store strings it read in as "Terms" in a separate class called Term. Because of that compareTo function won't work, so I'm planning to writing a compareTo method in the Term class. I'm just wondering if I can find the code for compareTo function and modify it. Thanks in advance!
favorite count: 0
has answer: http://stackoverflow.com/a/26080219
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40864669
has comment: http://stackoverflow.com/comment/40864631
tagged with: java
downvote count: 3
type: Question
upvote count: 0
has title: Can i find the code for Java's built in functions?

http://stackoverflow.com/q/26121609
type: AnsweredQuestion
score: 2
tagged with: email
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26133915
type: Question
upvote count: 2
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/26133915
has title: sending mails from mail box doesn't save in sent items
tagged with: exchangewebservices
has body: I am using using EWS to read a mailbox 'test@comp.com' and give in service account credentials to log into the exchange. that service account has access to read test@comp.com and even has access to send mails from it. but when I try to send out mails using following code : private static void sendMailviaEWS(String to, String from, String subject, String body, List&lt;String&gt; attname, ExchangeService service) { try { EmailMessage replymessage = new EmailMessage(service); replymessage.setSender(new EmailAddress(from)); EmailAddress fromEmailAddress = new EmailAddress(from); replymessage.setFrom(fromEmailAddress); replymessage.getToRecipients().add(to); //replymessage.setInReplyTo(recipients); replymessage.setSubject(subject); replymessage.setBody(new MessageBody(body)); replymessage.sendAndSaveCopy(WellKnownFolderName.SentItems); }catch (Exception e) { e.printStackTrace(); } } I don't see the mails getting sent from test@comp.com the to address is mine and from address which I give in is that of test@comp.com The sent mails always end up in sent items folder of my service account which i use to log into the exchange server. Is there a way to achieve what I want to?

http://stackoverflow.com/comment/41032551
type: AnswerComment
has text: thanks! this is the first time I see HashSet so I'm still catching up on the code. How would you invoke the merge function?
type: Comment
comment on: http://stackoverflow.com/a/26171658
score: 0

http://stackoverflow.com/comment/53235742
score: 0
comment on: http://stackoverflow.com/q/26034592
type: Comment
type: QuestionComment
has text: @sventechie: Seems like you can't do it anymore with Eclipse. Use the command line with Ant or Maven.

http://stackoverflow.com/comment/40887366
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26092421
has text: @Jack yes there are many ways. You can count element one by one by split the String in to letters.

http://stackoverflow.com/a/26087777
upvote count: 4
has body: To elaborate on Jesses answer: in your case you need to do this to work with the XPages version of Document: import com.ibm.xsp.model.domino.wrapped.DominoDocument; public List&lt;String&gt; getReaders(DominoDocument thisXspDoc){ // do some stuff }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/26087057
answers question: http://stackoverflow.com/q/26087057

http://stackoverflow.com/q/26095026
type: Question
has title: Found shared references to a collection:
has comment: http://stackoverflow.com/comment/40892043
upvote count: 1
tagged with: jpa
favorite count: 0
linked to: http://stackoverflow.com/q/1692871
has comment: http://stackoverflow.com/comment/40892357
type: UnansweredQuestion
has body: I am facing this error in my entity class. Found shared references to a collection:com.model.Parts.employees Below is my code in the Parts model class @OneToMany @JoinColumn(name="COMPASS_SKU", referencedColumnName="MANUF_PART_NUM") private Set&lt;Employee&gt; employees; How can I get rid of this error? The stack trace: ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple&lt; 0:ffff87a50a79:-7b13082e:5429d17a:27, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@10da269 : javax.persistence.PersistenceException: org.hibernate.HibernateException: Found shared references to a collection: com.model.Parts.employees at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) [hibernate-entitymanager-4.2.0.Final-redha
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/88851348
type: Comment
has text: This may give you for example `13:6:5:96`. Was this what you wanted? Also with multiple calls to `new` you risk that the time changes between them so the output is inconsistent.
type: AnswerComment
comment on: http://stackoverflow.com/a/50916774
score: 0

http://stackoverflow.com/a/26141898
downvote count: 0
has comment: http://stackoverflow.com/comment/40977742
type: Answer
answers question: http://stackoverflow.com/q/26141855
score: 1
upvote count: 1
has body: catch (SQLException se) { se.printStackTrace(); } catch (ConstraintViolationException ce) { systemout("Name already existing") }catch (Exception e) { e.printStackTrace(); }

http://stackoverflow.com/comment/41066208
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26189305
has text: can i change it after creation ?
score: 0

http://stackoverflow.com/comment/41068784
score: 0
type: QuestionComment
type: Comment
has text: So, isn't that fix for your problem?
comment on: http://stackoverflow.com/q/26190987

http://stackoverflow.com/q/26080185
tagged with: java
has title: Saving a referenced object (via Ref) in one call using Cloud Endpoints
has comment: http://stackoverflow.com/comment/46245547
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26082053
tagged with: google-app-engine
favorite count: 0
tagged with: google-cloud-endpoints
upvote count: 2
tagged with: objectify
type: UnansweredQuestion
has body: I'm using objectify and Google Cloud Endpoints to develop app's back-end. I have a "Truck" class which have a reference (using Ref) to the "Category" class. It looks like this: @Entity @Cache public class Truck { public @Id Long id; public String city; //... @Load Ref&lt;PlaceCategory&gt; category; public PlaceCategory getCategory(){ return category.get(); } public void setCategory(PlaceCategory category){ this.category = Ref.create(category); } } Naturally, Category class is just another Entity with it's own id. Now, building the API I'd like to be able - in one call - insert a Truck object which contains a Category object. The request body in this case will looks like this: { "category": { "name": "Some category" }, "city": "Some city" } (It's just a copy from API explorer). However executing this request I receive an error: com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: No class 'entities.Category' was registered (through reference chain: entities.Truck[\"category\"]) Of course I've registered Category object in OfyService: public class OfyService { static { factory().register(PlaceCategory.class); } public static Objectify ofy() { return ObjectifyService.ofy(); } public static ObjectifyFactory factory() { return ObjectifyService.factory(); } } I've read the docs twice and still I have no idea where's the problem. There's no explicitly said that I can't embed object like this. After 2 days of searching and trying I'm giving up :) Hope someone can help me understand.
has answer: http://stackoverflow.com/a/26204648
score: 2

http://stackoverflow.com/a/26098732
has body: Use a DataOutputStream, not an ObjectOutputStream. Or a ByteBuffer too. An ObjectOutputStream needs to store its classes too, to recreate objects. In fact the above code does a simple Files.copy, but I assume you intend to do some processing. Apart from the ByteOrder.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26098541
downvote count: 0

http://stackoverflow.com/q/26052185
tagged with: java
tagged with: loops
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26052370
type: Question
tagged with: for-loop
has title: Negative number end the program using for loop?
has answer: http://stackoverflow.com/a/26052387
score: 0
answer count: 3
has body: Hi guys I don't quite understand how to use a for loops as we just started learning them today. I have to add a for loop to a program that we made earlier. It has to keep asking for the dogs age until the user inputs a negative number. Here is what I have: import java.util.Scanner; public class DogYears { public static void main(String [] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter your dog's age in human years: "); int age = scan.nextInt(); int dogAge = age * 7; System.out.println("Your dog is " + age + " in human years and " + dogAge + " in dog years!"); if (dogAge &gt;= 150) System.out.println("Likely story"); else if (dogAge &gt;= 80 &amp;&amp; dogAge &lt; 150) System.out.println("Hello grand-dog"); else if (dogAge &gt;= 40 &amp;&amp; dogAge &lt; 80) System.out.println("Boring!"); else if (dogAge &gt;= 20 &amp;&amp; dogAge &lt; 40) System.out.println("Get a job!"); else if (dogAge &lt; 20) System.out.println("Just a pup!"); } }
favorite count: 0
has answer: http://stackoverflow.com/a/26052370
possible better answer: http://stackoverflow.com/a/26052268
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26052268

http://stackoverflow.com/a/26083393
upvote count: 4
has comment: http://stackoverflow.com/comment/40870527
downvote count: 0
has comment: http://stackoverflow.com/comment/40870981
has comment: http://stackoverflow.com/comment/40870758
answers question: http://stackoverflow.com/q/26083383
score: 4
has comment: http://stackoverflow.com/comment/40870846
has body: Those two lines of code will not create any objects. String literals such as "a" are put in the string pool and made available upon class loading. If you do String x = new String("a"); String y = new String("b"); two objects will be created in runtime. These questions/answers should cover follow-up questions: Questions about Java's String pool How many Java objects are generated by this - new String("abcd")
has comment: http://stackoverflow.com/comment/40870810
type: Answer

http://stackoverflow.com/comment/40943248
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26105884
type: Comment
has text: Yes. it is exactly a timer on a loop.

bytecode-manipulation
type: Tag
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/26084822

http://stackoverflow.com/q/26119951
has comment: http://stackoverflow.com/comment/40936086
tagged with: data-structures
has comment: http://stackoverflow.com/comment/40936096
has comment: http://stackoverflow.com/comment/40936168
has title: Null pointer exception while dequeing Queue in java
has body: My dequeue method : public T deQueue(){ if(isempty()){ System.out.println("Queue is empty, cant dequeue"); }else if(front==rear){ T value=queue[front]; front=-1; rear=-1; return value; }else{ T value=queue[front]; front++; return value; } return null; } Here I'm returning as null in last line. Instead of null, what should I return?
favorite count: 0
tagged with: deque
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40936134
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/26120092
tagged with: queue
type: Question
has answer: http://stackoverflow.com/a/26129546
has comment: http://stackoverflow.com/comment/40936058
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/56926132
type: AnswerComment
comment on: http://stackoverflow.com/a/26137749
has text: pls change the compress line .PNG to .JPEG.. then the above code is working fine..
type: Comment
score: 0

http://stackoverflow.com/q/26076650
has comment: http://stackoverflow.com/comment/40858746
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40859044
tagged with: eclipse
has title: Nothing Shows Up On Screen Except One Checkbox
type: Question
has answer: http://stackoverflow.com/a/26077436
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40858735
favorite count: 0
accepted answer: http://stackoverflow.com/a/26077436
has body: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class MatrixMult extends JFrame implements ActionListener { private final ButtonGroup OperationBtnGroup = new ButtonGroup(); private JTextField tfA11; private JTextField tfA12; private JTextField tfA21; private JTextField tfA22; private JTextField tfB11; private JTextField tfB12; private JTextField tfB21; private JTextField tfB22; private JButton btnMultiply; private JButton btnAdd; private JButton btnSubtract; private JTextField tfC11; private JTextField tfC12; private JTextField tfC21; private JTextField tfC22; double A11, A12, A21, A22, B11, B12, B21, B22, C11, C12, C21, C22; public MatrixMult() { JFrame Window = new JFrame(); Window.setAlwaysOnTop(false); Window.setTitle("2x2 Matrix Functions"); Window.setVisible(true); Window.setSize(800, 300); Window.setResizable(false); Window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Window.setFont(new Font("Comic Sans MS", Font.PLAIN, 12)); Window.setLayout(new BorderLayout(0, 0)); JPanel OpSelectBtnPanel = new JPanel(); Window.getContentPane().add(OpSelectBtnPanel, BorderLayout.SOUTH); FlowLayout fl_OpSelectBtnPanel = new FlowLayout(FlowLayout.CENTER, 5, 5); OpSelectBtnPanel.setLayout(fl_OpSelectBtnPanel); JCheckBox chckbxAlwaysOnTop = new JCheckBox("Always On Top"); chckbxAlwaysOnTop.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { if(ie.getStateChange() == ItemEvent.SELECTED) { setAlwaysTop(); } else if (ie.getStateChange() == ItemEvent.DESELECTED) { setNotAlwaysTop(); } } }); OpSelectBtnPanel.add(chckbxAlwaysOnTop); JPanel pnlMatricesAB = new JPanel(); Window.getContentPane().add(pnlMatricesAB, BorderLayout.NORTH); pnlMatricesAB.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 20)); JPanel pnlMatrixA = new JPanel(); pnlMatricesAB.add(pnlMatrixA); pnlMatrixA.setLayout(new GridLayout(2,2)); tfA11 = new JTextField(); pnlMatrixA.add(tfA11); tfA11.setColumns(10); tfA12 = n…
tagged with: jframe
has comment: http://stackoverflow.com/comment/40861112
has comment: http://stackoverflow.com/comment/40858900
upvote count: 1
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/26128835
answer count: 3
has comment: http://stackoverflow.com/comment/40953290
has comment: http://stackoverflow.com/comment/40953221
type: UnansweredQuestion
has title: Is it possible to reverse the start and end point of a substring?
has answer: http://stackoverflow.com/a/26128944
has answer: http://stackoverflow.com/a/26128896
has comment: http://stackoverflow.com/comment/40953297
tagged with: java
has answer: http://stackoverflow.com/a/26128912
tagged with: methods
tagged with: substring
type: Question
has comment: http://stackoverflow.com/comment/40953212
has comment: http://stackoverflow.com/comment/40953325
tagged with: string
has body: So in genereal the set-up for substring is something like: s.substring(beginIndex, EndIndex); Is it possible to switch it to: s.substring(EndIndex, BeginIndex); Thanks!
score: 0

http://stackoverflow.com/q/26139744
has answer: http://stackoverflow.com/a/26164515
score: 8
favorite count: 0
has body: I try to update existing DB with luquibase Java API in this way: Database database = DatabaseFactory.getInstance() .findCorrectDatabaseImplementation( new JdbcConnection( connection ) ); Liquibase liquibase = new Liquibase( "db.changelog.xml", new FileSystemResourceAccessor(), database ); liquibase.update( "" ); But it tries to apply all change sets including those which have been already applied earlier. What do I do wrong?
upvote count: 8
has title: Liquibase: how to run programmatically only those changesets which haven't been applied yet?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26164515
tagged with: liquibase
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40990260
type: Comment
comment on: http://stackoverflow.com/a/26112025
type: AnswerComment
has text: YES!! this is the problem... i didn´t see that... Sorry for my bad description of the problem... and thanks to every one.
score: 0

http://stackoverflow.com/comment/40910439
comment on: http://stackoverflow.com/a/26104128
type: Comment
has text: It *shouldn't* be an issue in theory... I'm not knowledgeable in jQuery but I would give it a try nonetheless.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26139545
has comment: http://stackoverflow.com/comment/40972456
has comment: http://stackoverflow.com/comment/41175547
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26139546
has body: I've installed a freshly downloaded Eclipse EE Luna and started a new workspace, but it's constantly crashing, with no output in the logs when it goes down. I'm on Ubuntu 14.04.1 LTS. I've checked the following, but nothing further is written after startup: workspace/.metadata/.log workspace/.metadata/.plugins/org.eclipse.rse.core/.log workspace/.metadata/.plugins/org.eclipse.rse.ui/.log workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log I tried adding the following to eclipse.ini: -vm /usr/lib/jvm/default-java/bin/java and -vmargs ... -XX:MaxPermSize=512m -Xmx4096m It still seems to just vanish randomly when I click on things, and most reliably crashes when I clean the project.
tagged with: maven
score: 2
downvote count: 0
has title: Eclipse crashing constantly
tagged with: java
has comment: http://stackoverflow.com/comment/41268078
has comment: http://stackoverflow.com/comment/40973260
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40973016
has comment: http://stackoverflow.com/comment/40972558
upvote count: 2
has comment: http://stackoverflow.com/comment/40973120
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41173318

http://stackoverflow.com/q/26117104
has answer: http://stackoverflow.com/a/26117651
type: Question
upvote count: 0
has body: I have two x509Certificates X509Certificate a; X509Certificate b; I would like to verify the signature of b with public key of a, where a is the issuer of b. What I have so far is: public static boolean verify(String algorithm, byte[] content, byte[] signature, X509Certificate certificate) { try { Signature s = Signature.getInstance(algorithm, PROVIDER); s.initVerify(certificate); s.update(content); return s.verify(signature); } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) { throw new IllegalArgumentException(e); } } and I invoke method: verify(a.getSigAlgName(), a.getSignature(), b.getSignature(), b); But this returns always false??? Could you please, help me to understand what might be the reason above method vertify(..) to return always false. EDIT: X509Certificate has a method verify(Public key).
score: -1
has title: How to verify one certificate with public key of another
answer count: 1
accepted answer: http://stackoverflow.com/a/26117651
favorite count: 0
tagged with: encryption
tagged with: x509
tagged with: x509certificate
type: AnsweredQuestion
tagged with: java
tagged with: certificate
downvote count: 1

http://stackoverflow.com/a/26074995
has comment: http://stackoverflow.com/comment/40855540
has comment: http://stackoverflow.com/comment/40855672
has comment: http://stackoverflow.com/comment/40855660
has comment: http://stackoverflow.com/comment/40855496
has comment: http://stackoverflow.com/comment/40855526
has comment: http://stackoverflow.com/comment/40854689
score: 0
has body: i dont have the full code, but im going to assume that you have window.showImage(picture,int Xcoord,int Ycoord); so all you have to do is set both coodinates at the same time, like this: window.showImage(man, X, X); in your code: while (true){ if (leftRight &gt; 0) { for (int x = 0; x &lt;= 500; x += 10) { window.showImage(man, x, x); PaintWindow.pause(50); } or for (int x = 0; x &lt;= 500; x += 10) { for (int y = 0; y &lt;= 500; y += 10) { window.showImage(man, x, y); PaintWindow.pause(50); } } Edit: if you want your ratio used: try so whats the ratio of your monitor? say you have xsize and ysize: int xsize = 500; int ysize = 800; for (int x = 0; x &lt;= xsize; x += 10 ) { window.showImage(man, x, x * ( ysize /xsize)); PaintWindow.pause(50); }
answers question: http://stackoverflow.com/q/26074717
has comment: http://stackoverflow.com/comment/40854829
has comment: http://stackoverflow.com/comment/40855653
type: Answer

http://stackoverflow.com/comment/42334495
type: AnswerComment
score: 0
type: Comment
has text: Thanks for your comment. I do use the AndroidStudio but I am restricted to use the NDK r8d with gradle 1.12 and I read somewhere this could cause the problem. But that's a different question from this one so I will continue to investigate on this and maybe post a new question.
comment on: http://stackoverflow.com/a/26184104

http://stackoverflow.com/a/26081765
has body: You just have to arrange the capture groups a little better. A program like RegexFormat can help a lot. # "(?s)(public|private|protected)\\s+(?:(static)\\s+)?(?:(String|int|char|void)\\s+)?(\\w.*?)\\((.*?)\\)\\s*.*?{" (?s) # Modifier dot-all ( # (1 start), Access, required public | private | protected ) # (1 end) \s+ (?: ( static ) # (2), Storage, optional \s+ )? (?: ( # (3 start), Type, optional String | int | char | void ) # (3 end) \s+ )? ( \w .*? ) # (4), Name, required \( # '(' ( .*? ) # (5), Parameters \) # ')' \s* .*? { # '{' Output: ** Grp 0 - ( pos 551 , len 19 ) public cek() { ** Grp 1 - ( pos 551 , len 6 ) public ** Grp 2 - NULL ** Grp 3 - NULL ** Grp 4 - ( pos 558 , len 3 ) cek ** Grp 5 - ( pos 562 , len 0 ) EMPTY ============================== ** Grp 0 - ( pos 1125 , len 49 ) public void actionPerformed(ActionEvent e) { ** Grp 1 - ( pos 1125 , len 6 ) public ** Grp 2 - NULL ** Grp 3 - ( pos 1132 , len 4 ) void ** Grp 4 - ( pos 1137 , len 15 ) actionPerformed ** Grp 5 - ( pos 1153 , len 13 ) ActionEvent e ============================= ** Grp 0 - ( pos 1789 , len 44 ) public static void main(String[]args) { ** Grp 1 - ( pos 1789 , len 6 ) public ** Grp 2 - ( pos 1796 , len 6 ) static ** Grp 3 - ( pos 1803 , len 4 ) void ** Grp 4 - ( pos 1808 , len 4 ) main ** Grp 5 - ( pos 1813 , len 12 ) String[]args
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26080896

http://stackoverflow.com/q/26137204
score: 0
has comment: http://stackoverflow.com/comment/40979633
has comment: http://stackoverflow.com/comment/40993117
type: UnansweredQuestion
tagged with: pom.xml
tagged with: maven-plugin
answer count: 0
tagged with: maven
has body: I have a Maven project and I have two profiles (Dev and integraiton). I use integration-profile to call two plugins, WAR and EAR maven plugin. My question : how can I use the plugin in the pom.xml dependencies when integration-profile is set in the Maven goal (I don't Like to have a plugins call in the profile)? <profiles> integration-profile org.apache.maven.plugins maven-war-plugin WEB-INF/jboss-web.xml org.apache.maven.plugins maven-ear-plugin conf/jboss-roles-mapping.conf </build>
type: Question
has comment: http://stackoverflow.com/comment/40969938
tagged with: java
has title: Call plugin when Maven profil is set

http://stackoverflow.com/comment/40885405
type: AnswerComment
has text: why -1 to this question?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26091251

http://stackoverflow.com/q/26133351
has answer: http://stackoverflow.com/a/26133500
upvote count: 4
answer count: 2
score: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/40961338
has comment: http://stackoverflow.com/comment/40961407
tagged with: constructor
possible better answer: http://stackoverflow.com/a/26134359
accepted answer: http://stackoverflow.com/a/26133500
has answer: http://stackoverflow.com/a/26134359
has title: Can initialization expressions be used for constructors in Java like in C++?
tagged with: c++
type: AnsweredQuestion
tagged with: java
downvote count: 1
has body: I know that in C++, class constructors can be written with initialization expressions in this form: class-name(parameters) : initialization-expressions { body } Is there some sort of analog to this in Java? If not, then why not? Because I know that in C++, initialization expressions make constructor calls more efficient. Is such an efficiency-booster overlooked by Java's design, or is it just unnecessary?
type: Question

http://stackoverflow.com/comment/40837965
has text: for the second suggestion, my advice is to try to find a state where the layout at least is working, and then incrementally move from that state to what you want to figure out where the problem creeps in
comment on: http://stackoverflow.com/q/26065368
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26109189
favorite count: 0
has title: IndexOutOfBoundsException error adding long numbers
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40917792
has body: I am trying to wrtie java application that adds up to 5 long numbers using LinkedLists. At the end of the run I get this: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.LinkedList.checkElementIndex(LinkedList.java:555) at java.util.LinkedList.remove(LinkedList.java:525) at Assignment1.LongNumbers.remove(LongNumbers.java:33) at Assignment1.LongNumbers.main(LongNumbers.java:92) Here is the code: import java.util.*; /** * * @author ..... */ public class LongNumbers { private List&lt;Integer&gt; [] theLists; public LongNumbers() { this.theLists = new LinkedList[6]; for (int i=0; i&lt;6; i++) this.theLists[i]= new LinkedList&lt;&gt;(); } public void add(int location, int digit) { //add digit at head of LinkedList given by location theLists[location].add(digit); } public int remove(int location) { //remove a digit from LinkedList given by location return theLists[location].remove(location); //LongNumbers.java:33 } public boolean isEmpty(int location) { //check for an empty LinkedList given by location return theLists[location].isEmpty(); } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); //Local Variables int digit; int carry = 0; int numberAt = 0; int largestNumLength = 0; char[] digits; String number; boolean userWantstoQuit = false; LongNumbers Lists = new LongNumbers(); System.out.println("The program will enter up to 5 numbers and add them up."); System.out.println(); while(!userWantstoQuit &amp;&amp; numberAt != 5){ System.out.print("Enter a number, enter -1 to quit entry phase: "); number = stdIn.nextLine(); if((number.compareTo("-1")) == 0) userWantstoQuit = true; else{ digits = new char[number.length()]; for(int i=0;i&lt;number.length();i++) digits[i] = number.charAt(i); for(int i=0;i&lt;number.length();i++){ int tempValue = digits[i] - 48; try{ Lists.add(numberAt, tempValue); } catch(NumberFormatException nfe){ System.out.println("Invalid Input. Please try again."); break; } if(i == …
tagged with: linked-list
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40918041
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/26109461
has answer: http://stackoverflow.com/a/26109497
answer count: 2
has comment: http://stackoverflow.com/comment/40917665
downvote count: 0

http://stackoverflow.com/q/26139731
has answer: http://stackoverflow.com/a/26139835
score: -3
possible better answer: http://stackoverflow.com/a/26139835
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26139805
downvote count: 3
has answer: http://stackoverflow.com/a/26139793
type: Question
has answer: http://stackoverflow.com/a/26139810
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/26139805
has body: Here I am reading student data from file and storing in db.For that am using ArrayList. For example, Student(){ private int rollNo; private String name,department,branch; private String cgpa; . . . public int getRollNo(){ return rollNo; } public String getName(){ return name; } public String getDepartment(){ return department; } public String getBranch(){ return branch; } public String getCgpa(){ return cgpa; } } and my arraylist variable is ArrayList&lt;Student&gt; stu; Inorder to access any field from arraylist,I have to use stu.get(i).getRollNo(), stu.get(i).getName(),stu.get(i).getDepartment() and so on. Here I have used stu.get(i) multiple times. To avoid that I stored stu.get(i) in temporary variable. For example String temp="stu.get(i)." sql="INSERT INTO STUDENT VALUES('"+temp+"getRollNo()"+"','"+temp+"getName()"+"','"+temp+"getDepartment()"+"','"+temp+"getBranch()"+"',"+Float.parseFloat(temp+"getCgpa()")+")"; But When I use temp+"getRollNO()",that method is not called. Please explain this problem. If its not possible please give me alternative way to achieve the same.
upvote count: 0
has title: Store longest variable name in another temporary variable
favorite count: 0

http://stackoverflow.com/comment/41005454
type: QuestionComment
comment on: http://stackoverflow.com/q/26157055
has text: So it seems to me that you want to replace `if (addressBook[i] != person)` with something like `if (addressBook[i].getIdNumber() != person.getIdNumber())` if that's the thing you want to check. You will, of course, have to write a `getIdNumber()` method in the `Person` class.
score: 0
type: Comment

http://stackoverflow.com/q/26144361
has body: I really struggle with the following problem. Must connect to a IIS with activated client-certificate-authentication and over https. As far I think it is a pretty much MS story and therefore its a bit tough with other than MS-technologie If I do in .net C# all is fine. HttpWebRequest req = (HttpWebRequest( WebRequest.Create ("https://abc.abc"); req.ClientCertificates.Add (new X509Certificate2 ("cert.pfx", "pwd")); But I did not found any glue in doing it in Perl or Java. Just found username/passwort-authentication and SSL-certificates but I think thats something else here. Here I get a HTTP 403. Tried a lot of code (from axis to java ssl-context) but nothing was working properly. But there must be a way because I can do it with a browser as well (add the certificate in the browsers store and it works). Any help? Thanks! Chris
tagged with: perl
tagged with: ssl-certificate
score: 0
has answer: http://stackoverflow.com/a/26202159
answer count: 1
tagged with: iis
has comment: http://stackoverflow.com/comment/41036978
has title: Connect to a IIS with HTTPS and client-certificate authentication
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41043403
accepted answer: http://stackoverflow.com/a/26202159
tagged with: java
has comment: http://stackoverflow.com/comment/41039556
type: Question
tagged with: c#

http://stackoverflow.com/q/26072017
has comment: http://stackoverflow.com/comment/40850055
has title: Setting the maximum length of a edittext in android
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40849952
answer count: 0
score: 0
tagged with: java
type: Question
has body: I want to restrict the length of an edittext to 11 characters.I have tried the following and it doesnt work: in xml: android:maxLength="11" in java code: InputFilter[] FilterArray = new InputFilter[1]; FilterArray[0] = new InputFilter.LengthFilter(11); txtifsccode.setFilters(FilterArray); In newer kitkat version when the length crossed 11 characters the text disappeared and started fresh in the edittext.How do i fix this issue?
has comment: http://stackoverflow.com/comment/40852368
has comment: http://stackoverflow.com/comment/40851130
has comment: http://stackoverflow.com/comment/40849809
has comment: http://stackoverflow.com/comment/40889706
has comment: http://stackoverflow.com/comment/40850020

http://stackoverflow.com/comment/40864656
type: AnswerComment
has text: You're right about the fragment transactions. The problem is that the menus are not cleared when the fragment transaction happens.
type: Comment
comment on: http://stackoverflow.com/a/26080068
score: 0

http://stackoverflow.com/q/26049199
favorite count: 0
has body: I wrote a simple code to test the performance my Server while (true) { ByteBuf firstMessage = Unpooled.buffer(8); firstMessage.writeInt(1); firstMessage.writeInt(1); firstMessage.writeLong(1L); f.channel().writeAndFlush(firstMessage); } After 30 seconds: All memory occupied Server stop receiving new messages Sorry my English
tagged with: netty
downvote count: 1
has title: Netty ByteBuf occupies all memory
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
possible better answer: http://stackoverflow.com/a/26133869
has answer: http://stackoverflow.com/a/26133869
upvote count: 0
has answer: http://stackoverflow.com/a/26133768
tagged with: bytebuffer
answer count: 3
has answer: http://stackoverflow.com/a/26133883
accepted answer: http://stackoverflow.com/a/26133768

matrix
tags question: http://stackoverflow.com/q/26119794
tags question: http://stackoverflow.com/q/26050559
tag name: matrix
tags question: http://stackoverflow.com/q/26117282
tags question: http://stackoverflow.com/q/26141239
tags question: http://stackoverflow.com/q/26171491
type: Tag

http://stackoverflow.com/a/26145788
has body: If you have Java JDK installed in your Linux machine, usually jconsole is located at /usr/bin/ as a symbolic link. Example from my Linux VM running Centos6 $ which jconsole /usr/bin/jconsole $ ls -l /usr/bin/jconsole lrwxrwxrwx. 1 root root 26 Sep 4 10:05 /usr/bin/jconsole -&gt; /etc/alternatives/jconsole $ ls -l /etc/alternatives/jconsole lrwxrwxrwx. 1 root root 51 Sep 4 10:05 /etc/alternatives/jconsole -&gt; /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/jconsole But you mentioned you got the a command not found error when you typed jconsole at the prompt. Can you find if jconsole is available in one of the jdk's bin directory? $ ls -l /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin | grep jconsole If yes, then add this in your PATH environment variable like so $ export PATH=$PATH:/usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin or put this in your ~/.bashrc if you are using Bash. If jconsole is not there, then maybe you need to try another jdk which you have installed or re-install the jdk.
score: 0
answers question: http://stackoverflow.com/q/26123324
type: Answer

jtable
tags question: http://stackoverflow.com/q/26120917
tags question: http://stackoverflow.com/q/26151759
tags question: http://stackoverflow.com/q/26190690
tags question: http://stackoverflow.com/q/26185675
tags question: http://stackoverflow.com/q/26078191
tags question: http://stackoverflow.com/q/26081547
tags question: http://stackoverflow.com/q/26055187
type: Tag
tags question: http://stackoverflow.com/q/26073398
tags question: http://stackoverflow.com/q/26102260
tags question: http://stackoverflow.com/q/26084368
tags question: http://stackoverflow.com/q/26035204
tags question: http://stackoverflow.com/q/26072206
tag name: jtable
tags question: http://stackoverflow.com/q/26061469
tags question: http://stackoverflow.com/q/26098105
tags question: http://stackoverflow.com/q/26142930
tags question: http://stackoverflow.com/q/26073401
tags question: http://stackoverflow.com/q/26161702
tags question: http://stackoverflow.com/q/26153614
tags question: http://stackoverflow.com/q/26158732
tags question: http://stackoverflow.com/q/26167750
tags question: http://stackoverflow.com/q/26084850
tags question: http://stackoverflow.com/q/26163228
tags question: http://stackoverflow.com/q/26052064

http://stackoverflow.com/comment/40957979
has text: Ok, i understand now, i read the specification of Random.nextInt, it says "Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)" , so 0 can happen, i will try to help you out with it
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26131055

http://stackoverflow.com/a/26085504
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26083062
score: 0
answers question: http://stackoverflow.com/q/26083062
type: Answer
has body: Try this code. I think it is something relevant with your code. String dateString = "17 октябрь 2014, пятница. 20:00"; Locale rusLocale = new Locale.Builder().setLanguage("ru").setScript("Cyrl").build(); String pattern = "dd MMMM yyyy, EEEE. HH:mm"; try { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, rusLocale); dateFormat.setTimeZone(TimeZone.getTimeZone("МСК")); Date date = dateFormat.parse(dateString); } catch (ParseException e) { ...

http://stackoverflow.com/a/29713896
score: 5
has comment: http://stackoverflow.com/comment/47562920
upvote count: 5
has body: You can change it programatically too: public static void changeEditTextUnderlineColor(EditText editText) { int color = Color.parse("#[putColorHere]") Drawable drawable = editText.getBackground(); drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN) { editText.setBackground(drawable); } else { editText.setCompoundDrawables(null, null, drawable, null); } }
downvote count: 0
answers question: http://stackoverflow.com/q/26116948
has comment: http://stackoverflow.com/comment/56372445
type: Answer

http://stackoverflow.com/a/26053658
answers question: http://stackoverflow.com/q/26053546
has body: maybe you can try this. at your src package, right click on it and choose clean up from Source. then add your import again using the new library
has comment: http://stackoverflow.com/comment/40816031
score: 0
has comment: http://stackoverflow.com/comment/40816304
type: Answer
has comment: http://stackoverflow.com/comment/40815929
has comment: http://stackoverflow.com/comment/40816526

http://stackoverflow.com/comment/40987982
comment on: http://stackoverflow.com/a/26147807
has text: @ColdCoder Please read the links I provided. The this keyword refers to the enclosing instance, which is the instance of MyFrame.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41070958
type: Comment
comment on: http://stackoverflow.com/a/26192304
has text: Didn't you mean set hasPressed to false? Well, it depends on your app, try it to see if it works.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41038928
comment on: http://stackoverflow.com/a/26173699
type: Comment
has text: you are correct. This is a custom message protocol, based on FIX. Setting the `Content-Type` as `application/octet-stream` has the same result (�����o for ÃÃÃção). Thanks for your reply.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26073730
has title: Delay during client to server message transfer
has comment: http://stackoverflow.com/comment/40856210
has comment: http://stackoverflow.com/comment/40853392
favorite count: 0
has comment: http://stackoverflow.com/comment/40867938
has comment: http://stackoverflow.com/comment/40858379
answer count: 0
type: UnansweredQuestion
tagged with: sockets
upvote count: 1
has comment: http://stackoverflow.com/comment/40855996
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40855373
type: Question
tagged with: network-programming
downvote count: 0
has comment: http://stackoverflow.com/comment/40855937
has body: I have made a dummy client to server message sending application. Here client is an android device and server is simple Java Server that prints on console the messages it recieves. I have used sockets to implement this. When I run the application there is a delay of 2-3 seconds between sending message from client and printing of that message by the server at the console when the client is android device. However, when the client is another pc, there is no significant delay. How to remove this delay and what are its sources? Someone please help! My code for server is : import java.net.*; import java.io.*; class Server { void connectNread() { System.out.println("Server Started!! ... "); try { ServerSocket ss = new ServerSocket(5000); Socket s = ss.accept(); System.out.println(s.getInetAddress().getHostName() + " Connected!!!"); InputStreamReader stream = new InputStreamReader(s.getInputStream()); BufferedReader reader = new BufferedReader(stream); String message = null; message = reader.readLine(); long output = System.currentTimeMillis(); System.out.println(output+" : " + message); stream.close(); s.close(); ss.close(); } catch(Exception e) { System.out.println(e); } } public static void main(String s[]) { new Server().connectNread(); } } While the code at android client is : public class MainActivity extends ActionBarActivity { Button connectButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); connectButton = (Button)findViewById(R.id.connect); } private class connectToNetwork extends AsyncTask&lt;Integer,Integer,Integer&gt; { protected Integer doInBackground(Integer... i) { try { Socket s = new Socket("192.168.1.22",5000); PrintWriter writer = new PrintWriter(s.getOutputStream()); writer.println("Its Printed!!"); writer.flush(); writer.close(); s.close(); } catch(Exception e) { System.out.println(e); } return 1; } protected void onProgressUpdate(Integer progress) { ///setP…
tagged with: android

http://stackoverflow.com/comment/40836243
type: Comment
has text: But what if i want the interestRate to be set in the AccountType class and not again here ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26064661

http://stackoverflow.com/comment/40891759
type: Comment
type: QuestionComment
score: 0
has text: @Zany than you can't. Try to execute System.currentTimeMillis() and see how many digits you get...
comment on: http://stackoverflow.com/q/26094841

http://stackoverflow.com/q/26063029
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: arraylist
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26063249
accepted answer: http://stackoverflow.com/a/26063249
has title: Does Collections.sort in GWT client code cause JavaScript to bloat?
has body: We've taken steps to ensure we use concrete implementations of List&lt;> in our GWT client code to avoid generating excessive JavaScript. (Note: I know we could black list types instead.) If we use Collections.sort client-side, will this cause the same bloat? Or will it recognise that we only use it for ArrayLists and generate the code accordingly?

http://stackoverflow.com/q/26082439
tagged with: libgdx
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26083754
has title: Deleting and creating body in libGDX
accepted answer: http://stackoverflow.com/a/26083754
has body: I have a problem with deleting/creating bodies in libGDX (box2d). I get a fatal error. Log: http://pastebin.com/fXWXpe8N I try to destroy bodies after collision. ~90% bodies are deleted good, without errors and crashes. But sometimes it happens. How can I fix this error? I have no idea. Contact: private void bulletGround(Contact contact) { Body bodyA = null; Body bodyB = null; if(contact.getFixtureA() != null &amp;&amp; contact.getFixtureA().getUserData() != null &amp;&amp; contact.getFixtureA().getUserData().equals(Ground.USERDATA)) bodyA = contact.getFixtureA().getBody(); if(contact.getFixtureB() != null &amp;&amp; contact.getFixtureB().getUserData() != null &amp;&amp; contact.getFixtureB().getUserData().equals(Bullet.USERDATA)) bodyB = contact.getFixtureB().getBody(); if(bodyA != null &amp;&amp; bodyB != null) { if(!world.deletingList.contains(bodyB, true)) { world.deletingList.add(bodyB); } } } private void bulletEnemy(Contact contact) { Body bodyA = null; Body bodyB = null; if(contact.getFixtureA() != null &amp;&amp; contact.getFixtureA().getUserData() != null &amp;&amp; contact.getFixtureA().getUserData().equals(Enemy.USERDATA)) bodyA = contact.getFixtureA().getBody(); if(contact.getFixtureB() != null &amp;&amp; contact.getFixtureB().getUserData() != null &amp;&amp; contact.getFixtureB().getUserData().equals(Bullet.USERDATA)) bodyB = contact.getFixtureB().getBody(); if(bodyA != null &amp;&amp; bodyB != null) { if(!world.deletingList.contains(bodyB, true) &amp;&amp; !world.deletingList.contains(bodyA, true)) { world.deletingList.add(bodyB); world.deletingList.add(bodyA); } } } Deleting: private void deleteObjects() { for (int i = 0; i &lt; gameWorld.deletingList.size; i++) { Body body = gameWorld.deletingList.get(i); if (body != null &amp;&amp; body.getFixtureList().size &gt; 0 &amp;&amp; !gameWorld.getWorld().isLocked()) { gameWorld.isDeletingTime = true; body.setUserData(null); body.setActive(false); gameWorld.getWorld().destroyBody(body); gameWorld.deletingL…
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: box2d
type: Question

http://stackoverflow.com/comment/41002860
score: 2
comment on: http://stackoverflow.com/q/26155691
has text: As I said you must not use `TableItem` directly, `TableViewer` handles them and altering them leads to failures like this. To sort use `TableViewer.setComparator`
type: Comment
type: QuestionComment

junit
tags question: http://stackoverflow.com/q/26192929
tags question: http://stackoverflow.com/q/26116859
type: Tag
tags question: http://stackoverflow.com/q/26156565
tags question: http://stackoverflow.com/q/26154657
tags question: http://stackoverflow.com/q/26088221
tags question: http://stackoverflow.com/q/26103049
tags question: http://stackoverflow.com/q/26116823
tags question: http://stackoverflow.com/q/26108999
tags question: http://stackoverflow.com/q/26139212
tags question: http://stackoverflow.com/q/26086358
tags question: http://stackoverflow.com/q/26136051
tags question: http://stackoverflow.com/q/26130029
tags question: http://stackoverflow.com/q/26065549
tags question: http://stackoverflow.com/q/26138715
tags question: http://stackoverflow.com/q/26177689
tags question: http://stackoverflow.com/q/26108360
tags question: http://stackoverflow.com/q/26188423
tags question: http://stackoverflow.com/q/26059003
tags question: http://stackoverflow.com/q/26050683
tags question: http://stackoverflow.com/q/26076464
tags question: http://stackoverflow.com/q/26174682
tags question: http://stackoverflow.com/q/26067096
tags question: http://stackoverflow.com/q/26086739
tags question: http://stackoverflow.com/q/26035677
tags question: http://stackoverflow.com/q/26051213
tag name: junit
tags question: http://stackoverflow.com/q/26079889
tags question: http://stackoverflow.com/q/26106719
tags question: http://stackoverflow.com/q/26068378
tags question: http://stackoverflow.com/q/26149711
tags question: http://stackoverflow.com/q/26125605
tags question: http://stackoverflow.com/q/26176347
tags question: http://stackoverflow.com/q/26108760
tags question: http://stackoverflow.com/q/26137095
tags question: http://stackoverflow.com/q/26138436
tags question: http://stackoverflow.com/q/26139277
tags question: http://stackoverflow.com/q/26107721
tags question: http://stackoverflow.com/q/26102187
tags question: http://stackoverflow.com/q/26094508
tags question: http://stackoverflow.com/q/26055876
tags question: http://stackoverflow.com/q/26138714
tags question: http://stackoverflow.com/q/26086443
tags question: http://stackoverflow.com/q/26124394
tags question: http://stackoverflow.com/q/26159655
tags question: http://stackoverflow.com/q/26156418
tags question: http://stackoverflow.com/q/26123399
tags question: http://stackoverflow.com/q/26125300
tags question: http://stackoverflow.com/q/26092936

http://stackoverflow.com/comment/40887177
type: AnswerComment
comment on: http://stackoverflow.com/a/26090861
type: Comment
has text: Still thinking that Exceptions should not be used for flow control. Besides, it decreases readability of the code and performance. This is one of the most common antipattern. I know it might lead to subjective discussions where sometimes it's a matter of taste. If you look at some literature, you will find that there are more people advocating not to use them in cases like this, than there are in its favor.
score: 0

upload
tags question: http://stackoverflow.com/q/26100995
tag name: upload
type: Tag
tags question: http://stackoverflow.com/q/26096058

http://stackoverflow.com/a/26195010
has comment: http://stackoverflow.com/comment/41075905
answers question: http://stackoverflow.com/q/26194321
score: 0
has body: If you do not have something in your application listening on the root context (/) then the haproxy will see your application as being down. You either need to have something listen on the root context, or change the monitoring option to point to a url that is returning a 200 (success) when it is polled. Did you change the httpchk GET / to the httpchk GET /myApp? Even if you change your application to be deployed at /myApp, you still need something that gives a 200 success on that url.
has comment: http://stackoverflow.com/comment/41078188
type: Answer
has comment: http://stackoverflow.com/comment/46240218
has comment: http://stackoverflow.com/comment/41210085

http://stackoverflow.com/q/26147201
tagged with: java
tagged with: compilation
has body: I have this directory: JavaProject (root folder) /audio /bin /keys /ScreenManagement /images /src /keys /ScreenManagement The bin folder has all the class files. The src folder has all the java files. The main file that needs to be run is Game which is a java file in the src, and a class file in the bin. I am currently running it by using this command in the terminal: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java -Dfile.encoding=US-ASCII -classpath "/Users/chris/Documents/School/-Senior/CSC 225 A/JavaProject/bin" Game What command would I need to use to compile the files into the proper directories when I make a change to a java file?
type: AnsweredQuestion
downvote count: 0
tagged with: directory
score: 1
favorite count: 0
has title: How would I compile this java project directory that was made in Eclipse in mac terminal?
tagged with: terminal
type: Question
has answer: http://stackoverflow.com/a/26205867
upvote count: 1
answer count: 1
tagged with: src
accepted answer: http://stackoverflow.com/a/26205867

sockets
tags question: http://stackoverflow.com/q/26139466
tags question: http://stackoverflow.com/q/26069282
tags question: http://stackoverflow.com/q/26064134
tags question: http://stackoverflow.com/q/26036942
tags question: http://stackoverflow.com/q/26192396
tags question: http://stackoverflow.com/q/26155900
tags question: http://stackoverflow.com/q/26057034
tags question: http://stackoverflow.com/q/26162644
tags question: http://stackoverflow.com/q/26067818
tags question: http://stackoverflow.com/q/26187930
tags question: http://stackoverflow.com/q/26152931
tags question: http://stackoverflow.com/q/26101260
tags question: http://stackoverflow.com/q/26194351
tags question: http://stackoverflow.com/q/26118167
tags question: http://stackoverflow.com/q/26063539
tags question: http://stackoverflow.com/q/26191346
tags question: http://stackoverflow.com/q/26096614
tags question: http://stackoverflow.com/q/26116219
tags question: http://stackoverflow.com/q/26150491
tags question: http://stackoverflow.com/q/26091150
tags question: http://stackoverflow.com/q/26085099
tags question: http://stackoverflow.com/q/26094217
tags question: http://stackoverflow.com/q/26035566
type: Tag
tags question: http://stackoverflow.com/q/26105972
tags question: http://stackoverflow.com/q/26103571
tags question: http://stackoverflow.com/q/26190555
tags question: http://stackoverflow.com/q/26054200
tags question: http://stackoverflow.com/q/26078104
tags question: http://stackoverflow.com/q/26194468
tags question: http://stackoverflow.com/q/26185826
tags question: http://stackoverflow.com/q/26036652
tags question: http://stackoverflow.com/q/26052263
tags question: http://stackoverflow.com/q/26073730
tags question: http://stackoverflow.com/q/26124720
tags question: http://stackoverflow.com/q/26052894
tags question: http://stackoverflow.com/q/26087818
tag name: sockets
tags question: http://stackoverflow.com/q/26087018
tags question: http://stackoverflow.com/q/26036156
tags question: http://stackoverflow.com/q/26178168
tags question: http://stackoverflow.com/q/26110694
tags question: http://stackoverflow.com/q/26151174
tags question: http://stackoverflow.com/q/26100980
tags question: http://stackoverflow.com/q/26104880
tags question: http://stackoverflow.com/q/26043349

http://stackoverflow.com/comment/40994226
type: Comment
type: QuestionComment
has text: The for loop is running, but runs **immediately** and so all you see is the last answer. The solution: look up and use a Swing Timer, not a for-loop.
comment on: http://stackoverflow.com/q/26151046
score: 0

http://stackoverflow.com/comment/40874663
type: Comment
type: QuestionComment
has text: Can you explain your problem?If you are using IDE, did you get any error or warnings on screen?If you are are using command line to compile the java classes, did you get any compilation error?
score: 0
comment on: http://stackoverflow.com/q/26085740

http://stackoverflow.com/a/26134007
has body: Try public &lt;T extends Animal&gt; translate(CustomObject o, Class&lt;T&gt; clazz).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26133984
type: Answer
accepted answer of: http://stackoverflow.com/q/26133984
upvote count: 1
score: 1

http://stackoverflow.com/q/26111826
type: Question
has comment: http://stackoverflow.com/comment/40922326
has comment: http://stackoverflow.com/comment/40922362
has title: JavaFX8 - referencing FXML objects from a different thread
tagged with: fxml
score: 0
tagged with: java
tagged with: javafx
answer count: 1
tagged with: concurrency
tagged with: javafx-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40922247
has answer: http://stackoverflow.com/a/26112065
has body: So I have a JavaFX8 app, and I am trying to create scheduled thread that changes a GUI element on each iteration. I am using ScheduledExecutorService, however if any code in the run() method references an FXML object, it dies without any errors. This code resides in the Controller for my main FXML window. fxmlLabel is declared as @FXML private Label fxmlLabel; This code works, and correctly prints "Hello World!" every second. Runnable task = new Runnable() { @Override public void run() { System.out.println("Hello world!"); } }; executor.scheduleAtFixedRate(task, 1, 1, TimeUnit.SECONDS); This code prints "Hello World!" once, then nothing happens. Runnable task = new Runnable() { @Override public void run() { System.out.println("Hello world!"); fxmlLabel.setText("Bye world!"); System.out.println("Hello again!"); } }; executor.scheduleAtFixedRate(task, 1, 1, TimeUnit.SECONDS);
accepted answer: http://stackoverflow.com/a/26112065

http://stackoverflow.com/a/26181807
type: Answer
answers question: http://stackoverflow.com/q/26181769
upvote count: 1
score: 1
downvote count: 0
has body: You declare: double airSpeed_km; And after use it: System.out.println("your current airspeed in km is: " + airSpeed_km + "your holding pattern width is: " + width + "your holding patter length is: " + length); without any assignment. So you get an error, you can prevent this by giving it a default value of 0 for example. double airSpeed_km = 0; (same goes for your other errors)

http://stackoverflow.com/q/26139466
tagged with: sockets
upvote count: 1
has comment: http://stackoverflow.com/comment/40972387
tagged with: java
tagged with: jboss
has body: I am using Wildfly 8.1, I am not an expert with JMS queues and I was wondering if it's possible to use UNIX sockets for them. This is the default JMS connection factories stanza I use: &lt;jms-connection-factories&gt; &lt;pooled-connection-factory name="hornetq-ra"&gt; &lt;transaction mode="xa"/&gt; &lt;connectors&gt; &lt;connector-ref connector-name="in-vm"/&gt; &lt;/connectors&gt; &lt;entries&gt; &lt;entry name="java:/JmsXA"/&gt; &lt;entry name="java:jboss/DefaultJMSConnectionFactory"/&gt; &lt;/entries&gt; &lt;/pooled-connection-factory&gt; &lt;/jms-connection-factories&gt; If it's possible, how? I am a bit lost... NOTE: using UNIX sockets (on Linux) is a prerequisite, no I can't use TCP/IP :(
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40975206
score: 1
linked to: http://stackoverflow.com/q/170600
tagged with: unix
favorite count: 0
type: Question
has title: Is it possible to enable remote JMS through UNIX sockets?
tagged with: wildfly

http://stackoverflow.com/comment/40943320
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26123594
has text: Always [flush your buffer](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#flush()) after writing
score: 0

http://stackoverflow.com/comment/41072245
type: QuestionComment
has text: Log.d("Result", result.toString()); gave me this: 7735-7735/dk.markflarup.jsongettime D/Result﹕ [dk.markflarup.jsongettime.Actors@420fbef8, dk.markflarup.jsongettime.Actors@420f19d8, dk.markflarup.jsongettime.Actors@420f1988, dk.markflarup.jsongettime.Actors@420ef960, dk.markflarup.jsongettime.Actors@420ee960, dk.markflarup.jsongettime.Actors@420ed748]
comment on: http://stackoverflow.com/q/26193297
score: 0
type: Comment

http://stackoverflow.com/a/26040877
answers question: http://stackoverflow.com/q/26040741
has comment: http://stackoverflow.com/comment/40793062
upvote count: 4
has comment: http://stackoverflow.com/comment/40793242
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/26040741
has body: Your reference type is the List&lt;T&gt; interface, which does not declare any addFirst method. You can either set the reference type explicitly as LinkedList&lt;String&gt;: LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;( Arrays.asList(stuff)); Or you can cast: ((LinkedList&lt;String&gt;)list).addFirst("first"); The first methodology is preferred. Casting is slightly more "dangerous", because it assumes your reference has not been assigned a new value. For instance, if you assigned list to new ArrayList&lt;String&gt;(); in between the two statements above, you'd get a ClassCastException at runtime.
type: Answer

http://stackoverflow.com/q/26097849
answer count: 2
has body: I am using Apache CXF with Spring and Dozer Mapper to convert DTOs (Database Objects) in to models. For Hibernate side I have enabled lazy="extra" and lazy="true" for mapping and which works fine hibernate loads child whenever respective getter methods are called. But when I convert DTO using dozer mapper it calls getter methods of all the child object in some case it was not necessary but in some it is not necessary. Is there any way by using which I can reduce overheads.
score: 0
tagged with: dozer
has answer: http://stackoverflow.com/a/26098137
type: UnansweredQuestion
tagged with: spring
has title: Dozer Mapping Ignore Hibernate Lazy Loading - Spring
has answer: http://stackoverflow.com/a/26098195
tagged with: cxf
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/26088769
has answer: http://stackoverflow.com/a/26089681
type: AnsweredQuestion
tagged with: java
has body: Working with anonymous innerclasses in java,you have to declare the variables of enclosing class which you are using in the anonymous innerclass as final. Ok i got it that why this must be done from Cannot refer to a non-final variable inside an inner class defined in a different method but also the answerer says that "By making lastPrice and price final, they are not really variables anymore, but constants. The compiler can then just replace the use of lastPrice and price in the anonymous class with the values of the constants (at compile time, ofcourse), and you won't have the problem with accessing non-existent variables anymore" This made me to wander that is the final keyword working like as Macros are in C\C++.Till now, I was using final for variables in a way that whenever I will try to modify them(accidentally) I will be getting an error that You can't modify it as it is declared as final.But this replacement thing is not clear to me. Question: According to the selected answer from the above link answerer says This is why it doesn't work: The variables lastPrice and price are local variables in the main() method. The object that you create with the anonymous class might last until after the main() method returns. When the main() method returns, local variables (such as lastPrice and price) will be cleaned up from the stack, so they won't exist anymore after main() returns. But the anonymous class object references these variables. Things would go horribly wrong if the anonymous class object tries to access the variables after they have been cleaned up. ** Where this storage is taking place for replacement later?Who is taking care of it?final variables are just replaced by values? **
has comment: http://stackoverflow.com/comment/40880526
score: -1
linked to: http://stackoverflow.com/q/1299837
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26089100
has comment: http://stackoverflow.com/comment/40880474
favorite count: 0
tagged with: anonymous-class
has comment: http://stackoverflow.com/comment/40880936
has comment: http://stackoverflow.com/comment/40880551
tagged with: c++
accepted answer: http://stackoverflow.com/a/26089100
possible better answer: http://stackoverflow.com/a/26089540
tagged with: final
tagged with: macros
has answer: http://stackoverflow.com/a/26089540
downvote count: 1
has title: final in anonymous classes,just like macros in C++?
type: Question

http://stackoverflow.com/comment/40935227
comment on: http://stackoverflow.com/q/26119307
type: QuestionComment
has text: i am using fedora 20
score: 0
type: Comment

http://stackoverflow.com/a/26176829
answers question: http://stackoverflow.com/q/26167362
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Use your .forward() mehtod wisely . Also dont forget to add the return statement in case if you have multiple forwards in the same class. read here and https://stackoverflow.com/questions/19619949/how-does-function-terminate-with-requestdispatcher-forward . catch(Exception e){ request.setAttribute("Error", e); RequestDispatcher rd = request.getRequestDispatcher("error.jsp"); rd.forward(request, response); return; }finally{ RequestDispatcher rd = request.getRequestDispatcher("CreateEvent.jsp"); rd.forward(request, response); return; } So that the program control is reset , instead of executing other block. you have used the RequestDispatcher in the finally() so that it will be executed always independent of your errors. try to use finally in a wise manner. When should I use the finally-block in Java&#39;s try-catch-finally Why do I need to use finally to close resources? Hope this helps !!

http://stackoverflow.com/q/26122814
favorite count: 0
has body: I'm using EclipseLink JPA ver 2.5.1. I have 3 queries which only differ by the columns returned. The following queries are executing correctly: 1) SELECT p.id, i.id FROM PtpFSP_R7DBImpl p, IntraNeConnectionDBImpl i WHERE i.neID=:neId AND i.neID=p.neID AND ((i.entityAEndpointAidString = p.aidString) OR (i.entityBEndpointAidString = p.aidString)) 2) SELECT p FROM PtpFSP_R7DBImpl p, IntraNeConnectionDBImpl i WHERE i.neID=:neId AND i.neID=p.neID AND ((i.entityAEndpointAidString = p.aidString) OR (i.entityBEndpointAidString = p.aidString)) Why the following one returns exception?: 3) SELECT p, i FROM PtpFSP_R7DBImpl p, IntraNeConnectionDBImpl i WHERE i.neID=:neId AND i.neID=p.neID AND ((i.entityAEndpointAidString = p.aidString) OR (i.entityBEndpointAidString = p.aidString)) And the exception (which seems to be nonsense) is as follows: Exception [EclipseLink-6015] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.QueryException Exception Description: Invalid query key [entityAEndpointAidString] in expression. I know such a query is not optimal but why doesn't it work anyway?
type: UnansweredQuestion
has title: JPA why queries returining 2 objects doesn't work and the one returning one object works fine
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40942871
has answer: http://stackoverflow.com/a/26123925
type: Question
tagged with: eclipse
tagged with: sql
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/40942241
score: 1

http://stackoverflow.com/q/26145459
linked to: http://stackoverflow.com/q/10837670
has comment: http://stackoverflow.com/comment/40983705
type: AnsweredQuestion
has body: I have to return a DTO from service which looks like this: ResponseDTO { Long id; String name; //getter and setter etc. } Service returns response in json format, and I am using org.codehaus.jackson.jaxrs.JacksonJsonProvider for conversion but at client side when I get response then id value gets changed automatically. for e.g:- from service side I set value of id as Long.MAX_VALUE but client side json response shows me value "9223372036854776000" which is not the value which I am sending from service. Am I missing something here?
accepted answer: http://stackoverflow.com/a/26146351
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has title: jax rs data conversion
tagged with: jackson
has comment: http://stackoverflow.com/comment/40984529
answer count: 1
has answer: http://stackoverflow.com/a/26146351
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0

http://stackoverflow.com/q/26071473
type: Question
has answer: http://stackoverflow.com/a/26074773
score: 0
has comment: http://stackoverflow.com/comment/40863164
answer count: 2
favorite count: 0
type: UnansweredQuestion
has title: How to crack Caesar cipher without letter frequency analysis
has answer: http://stackoverflow.com/a/26071554
tagged with: encryption
tagged with: cryptography
has body: I have implemented letter frequency analysis for cracking Caesar cipher in Java but it works for only big paragraphs of cipher text, the smaller the string gets probability of the shift and frequency weakens so is there any other mechanism for cracking? Please, some help would be useful.
tagged with: java
upvote count: 1
downvote count: 1

accumulator
tags question: http://stackoverflow.com/q/26038843
tag name: accumulator
type: Tag

http://stackoverflow.com/comment/40944050
type: Comment
has text: Superior or equal is written >= in java. Also the && operator is used between two expressions: getZipCode >= 77550 is a valid expression, but "<=77555" is not.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26115989

http://stackoverflow.com/comment/40812063
type: Comment
type: QuestionComment
has text: I meant it in the context of your answer where you've disabled the version check.
score: 0
comment on: http://stackoverflow.com/q/26034683

http://stackoverflow.com/q/26034408
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40780481
has body: My requirement is to copy the file from local machine(Windows) to unix serevr. I have the code which was working fine with some Mbs data. i am using jsch lib to connect and to transfer. But now i have to transfer the files of 1GB, 2Gb or may be 5GB. When i am using the same approach. Its getting failed. Its stucking at channelsftpObj.put(from,to); and then exception is "faliure". Nothing else coming in exception. May i know the reason or how can i transfer these files? private boolean executeCommand (String localDir, String remoteDir, String fileList, String actionFlg) { boolean boolError = false; String localPath, destinationPath; ChannelSftp channelSFTPObj = (ChannelSftp) channelObj; for (int i = 0; i &lt; filelistArr.length; i++ ) { localPath = localDir + "/" + filelistArr[i]; destinationPath = remoteDir + "/" + filelistArr[i]; try { if (actionFlg.toLowerCase() == "upload") { channelSFTPObj.put (localPath, destinationPath); System.out.println ("Uploaded " + filelistArr[i] + " to " + remoteDir); } } catch (SftpException e) { System.out.println(e); boolError = true; } } channelSFTPObj.exit(); return boolError; } localDir is my path of my local system, remoteDir is the server path. Successfully connected to the server.
tagged with: java
has comment: http://stackoverflow.com/comment/40861564
answer count: 0
has comment: http://stackoverflow.com/comment/40826558
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40780741
tagged with: jsch
has title: upload 1 GB file to unix sever using java
has comment: http://stackoverflow.com/comment/40800509
has comment: http://stackoverflow.com/comment/40825275

http://stackoverflow.com/comment/41028985
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26169814
type: Comment
has text: I will accept your answer as soon as it happens with 10 minutes.

http://stackoverflow.com/comment/91445831
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26075803
score: 1
has text: Ill be honest: I have absolutely no idea

http://stackoverflow.com/comment/40910794
type: Comment
comment on: http://stackoverflow.com/a/26105540
score: 1
type: AnswerComment
has text: You're technically invoking the method on the Class, not the object.

http://stackoverflow.com/a/33623992
type: Answer
has body: It does not look like the CompositeByteBuf created using Unpooled is direct: From 4.0.32 Unpooled.java: public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers) { switch (buffers.length) { ... default: for (ByteBuf b: buffers) { if (b.isReadable()) { return new CompositeByteBuf(ALLOC, --&gt; false &lt;--, maxNumComponents, buffers); } } } return EMPTY_BUFFER; }
answers question: http://stackoverflow.com/q/26039172
score: 0

http://stackoverflow.com/comment/40915135
score: 0
type: Comment
type: QuestionComment
has text: Thanks Blaise. I am looking into it. Actually before posting it here i already went through that link. Let me try with that link again.
comment on: http://stackoverflow.com/q/26107483

http://stackoverflow.com/comment/40799067
score: 1
has text: This is fine and seen often. In fact, it is seen so often that C++ hackers have come up with the adorable name “curiously recurring template pattern” for it (or something similar since Java has no such thing as templates).
comment on: http://stackoverflow.com/q/26044458
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26137869
favorite count: 0
has body: The following was produced using the most recent version of encog-workbench (3.2.0) I was wondering if this is a bug or if I do not grasp the purpose of the output file. When I run the [ sunspot example ][1] in the encog workbench, without seggregation, i expect the output file to have the fitted values from the model. When i create the validation chart it presents me with the figure found in the tutorial so this seems correct. But when i go to the sunspots_output.csv output file I get the following output: ssn(t-29) ssn(t+1) Output:ssn(t+1) ... first thirty values have output Null ... -0.600472813 -0.947202522 null -0.477541371 -1 8.349050184 -0.528762805 -0.976359338 8.334476431 -0.814814815 -0.986603625 8.314903157 -0.817178881 -0.892040977 8.292847897 ... All the output values are around 8 for the rest of the file. Now when i go back to the validation chart, there is a tab data, which contains the following columns: Ideal Result -0.477541371 -0.52449577 -0.528762805 -0.526507195 -0.814814815 -0.535029097 -0.817178881 -0.653884012 If I denormalize the values in these columns, I get the following. 66.3 60.3414868 59.8 60.08623701 23.5 59.00480764 23.2 43.92211894 These seem to be correct values for the actual(if i compare them with the original data) and thus these should be the predicted values in the output column. Is this a bug or do the values in the output(t+1) column mean something else. I copied these values to excel and denormalized by typing in the formula for (-1,1). I was hoping not to have to do this every time I run an experiment. I am going to move to code eventually. Just wanted to get some preliminary results with the workbench. Using segregation results in the same problem, btw. If its a bug I'll report it on the encog website. Thanks for your answers, Florian UPDATE Hey Jef, I downloaded your zip and reproduced the problem using my workbench. The problem only arises when i do not seggregate, which i do not want to. There are some clear difference…
type: UnansweredQuestion
downvote count: 1
tagged with: encog
tagged with: java
has title: ENCOG values in output file incorrectly denormalized?
type: Question
has comment: http://stackoverflow.com/comment/41007644
has comment: http://stackoverflow.com/comment/40999031
has comment: http://stackoverflow.com/comment/40978614
score: 0
has answer: http://stackoverflow.com/a/26146249
upvote count: 1
answer count: 1

http://stackoverflow.com/q/26132044
tagged with: java
type: Question
downvote count: 0
has title: Java: Can't assign MyClass to Object type?
tagged with: class
answer count: 2
has body: So I'm doing an Android app, and I've added the a tag to a view through: view.setTag(1,myClass); Now I want to get that tag through this: myClass = view.getTag(1); But it says: Incopatible types Required: MyClass Found: java.lang.Object Yes, I've declared myClass before... So, how can I make MyClass be able to be "created" or "assigned" from an Object? Such as Strings and Integers. Thanks in advance.
has comment: http://stackoverflow.com/comment/40959005
tagged with: assign
favorite count: 0
has answer: http://stackoverflow.com/a/26132114
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: object
has answer: http://stackoverflow.com/a/26132164
score: 1

http://stackoverflow.com/a/26051795
type: Answer
has body: For any maven project, src/test/ is always more appropriate. If you add your classes under directory /src/main/app/MODULE/test, somehow you will be able to execute/debug these classes but these classes will get added in the final artifact which you may not wants to happen.
upvote count: 2
has comment: http://stackoverflow.com/comment/43887134
accepted answer of: http://stackoverflow.com/q/26048340
score: 2
answers question: http://stackoverflow.com/q/26048340
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43884159

http://stackoverflow.com/a/26127184
upvote count: 2
has body: The C++ function probably relied on processing from the beginning of the array. In Java it should be configured to run from an offset into the array so the array doesn't need to be copied. Copying the array, even with System.arraycopy, would take a significant amount of time. It could be defined as a Java method with something like this: void method(&lt;somearraytype&gt; array, int offset, other parameters) Then the method would start at the offset into the array, and it would be called something like this: method(array, i, other parameters);
answers question: http://stackoverflow.com/q/26127128
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/40899718
has text: @tasomaniac Would you mind to be more specific or pin point the part which I did wrongly? Because I really have no idea why it behaved in this way.
comment on: http://stackoverflow.com/q/26098284
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26086642
accepted answer of: http://stackoverflow.com/q/26086523
type: AcceptedAnswer
downvote count: 0
has body: The equation of a circle is x = x0 + r * cos(a) y = y0 + r * sin(a) with (x0, y0) the center of the circle and a in 0...2Pi so if you want y given x you will have : sin(a) = (y - y0)/r so a = arcsin((y - y0)/r) if ((y - y0)/r is in -PI/2..PI/2) a = -arcsin((y - y0)/r) if ((y - y0)/r is in -PI..-PI/2 or PI/2..PI) a is undefine elsewhere therefore y = y0 + r * sin(arcsin((y - y0)/r)) if ((y - y0)/r is in -PI/2..PI/2)) y = y0 + r * sin(-arcsin((y - y0)/r)) if ((y - y0)/r is in -PI..-PI/2 or PI/2..PI)) y is undefine elsewhere
answers question: http://stackoverflow.com/q/26086523
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26159515
favorite count: 0
has body: I am trying to copy multiple files using the request or HttpServletRequest features. I have been able to loop through all the selected files in a controller action where I have accessed the MultipartFile object for each file - here is the action code: request.getFileNames().each{ request.getFiles(it).each { file -&gt; // loop through all files selected println "name: $file.name Originalfilename: $file.originalFilename contentType: $file.contentType" file.transferTo( new File( userDir, file)) } // eo for loop } // eo requect.getFiles().each.... I get a groovy runtime error at the transferTo line - the error message being: Could not find matching constructor for: java.io.File(java.io.File, org.springframework.web.multipart.commons.CommonsMultipartFile) If I comment out the transferTo line the printout line line the loop produces the correct MultipartFile information about each selected files. See output for two files selected here: name: file[] Originalfilename: for-sale.gif contentType: image/gif name: file[] Originalfilename: front.gif contentType: image/gif How can I invoke transferTo to do the copy? -mike
upvote count: 1
has title: multiple file upload in grail
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: grails
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26159597
accepted answer: http://stackoverflow.com/a/26159597

http://stackoverflow.com/comment/40786763
comment on: http://stackoverflow.com/q/26037366
score: 1
has text: @Robert, the code is a bit long, should I post It in the commentary section ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41034754
score: 0
type: AnswerComment
type: Comment
has text: I'm not sure what you mean. Can you explain further?
comment on: http://stackoverflow.com/a/26172926

http://stackoverflow.com/comment/40788032
type: QuestionComment
comment on: http://stackoverflow.com/q/26038532
has text: possible duplicate of [What is a debugger and how can it help me diagnose problems](http://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems)
score: 1
type: Comment

http://stackoverflow.com/comment/40898636
comment on: http://stackoverflow.com/q/26097266
has text: @Pascal Rottier - You could have a look at graph databases Neo4J for example (http://www.neo4j.org/) it even has its own query language "Cypher" (http://www.neo4j.org/learn/cypher)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40898873
score: 0
comment on: http://stackoverflow.com/q/26097166
has text: I have done PrivateJRE.zip "installs" since Java1.4, app is using c:/myapp/jre/* virtual machine. I installed regular java-setup.exe on one development machine then took destination folder to be put inside application.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26152243
answers question: http://stackoverflow.com/q/26152162
has comment: http://stackoverflow.com/comment/40997557
type: Answer
has comment: http://stackoverflow.com/comment/40997577
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26152162
has body: I feel like you are seeing the HashMap#toString() output of {key1=["value1"], key2=value2} and thinking that ["value1"] is a List of some type, containing a String value of "value1". It isn't. Your String, as a String literal, would be represented as "[\"value1\"]". Its value is ["value1"]. That's what gets displayed. Both your JSON key-value entries are string-string and will get converted as such. "key1": "[\"value1\"]", // ^ indicates a JSON string

http://stackoverflow.com/a/26142566
has comment: http://stackoverflow.com/comment/40978657
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26140651
has comment: http://stackoverflow.com/comment/40980226
has body: Is there any particular reason why you need exactly FFmpeg? I guess it could be possible to get prebuilt binaries, but since it is a C library, you would also need a JNI wrapper code - I don't think anyone would generate that for the whole library since it's quite large, so even with a prebuilt library you still need to have some JNI knowledge to wire through the communication between Java and FFmpeg in C. Just for the purpose of demonstration - here is an example. Apart from that if there is not a special reason to use FFmpeg, why can't you stick with MediaCodec that is a part of the Android API? It wraps the native StageFright library and could provide hardware support on devices where it is available, while FFmpeg would be a CPU only solution. Of course, if some unpopular codecs or muxers that are not available in MediaCodec are needed, then FFmpeg is the way.
score: 1
has comment: http://stackoverflow.com/comment/40978546
upvote count: 1

http://stackoverflow.com/comment/49580947
type: AnswerComment
type: Comment
has text: @AlperAkture's suggestion of using Jersey async with AsyncHttpClient is money. Exactly what I was looking for.
score: 1
comment on: http://stackoverflow.com/a/26151888

http://stackoverflow.com/comment/40843360
has text: Generics were introduced in Java 5.
comment on: http://stackoverflow.com/q/26068508
score: 9
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26171535
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26165776
type: Answer
has comment: http://stackoverflow.com/comment/41037597
has comment: http://stackoverflow.com/comment/41050712
has comment: http://stackoverflow.com/comment/41350330
has body: You're blocked waiting for more input. The part labelled ... (some code here) should be inside the read loop, after the test for end of stream. NB If read() returns -1 it doesn't mean 'no data', it means end of stream, and you should close the socket and break out of the read loop. Otherwise you should then go on to process the data you've just read. At present you just read and ignore all input until end of stream, which is pointless. At best you can only process the last partial buffer, and you won't know how long it was.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/26165776
has comment: http://stackoverflow.com/comment/41118109
has comment: http://stackoverflow.com/comment/41325418
has comment: http://stackoverflow.com/comment/41037378

http://stackoverflow.com/q/26068406
has title: Jlayer MP3 Player, Control Volume of mp3 file in java
has comment: http://stackoverflow.com/comment/40849052
has comment: http://stackoverflow.com/comment/40870649
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/40844535
has comment: http://stackoverflow.com/comment/40850209
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40870274
tagged with: http://stackoverflow.com/tag/mp3
tagged with: jlayer
type: Question
linked to: http://stackoverflow.com/q/953598
has answer: http://stackoverflow.com/a/30492786
has comment: http://stackoverflow.com/comment/40958090
has body: I need to know what should i use for controlling volume in MP3 player which I've created using jLayer? Which API or Methods I can use to control volume of mp3 file ?
upvote count: 1
tagged with: volume
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26089364
tagged with: applet
has comment: http://stackoverflow.com/comment/40907699
has answer: http://stackoverflow.com/a/26089459
possible better answer: http://stackoverflow.com/a/26089404
favorite count: 0
has title: Difference between Applet and Servlet and their usages
has answer: http://stackoverflow.com/a/26089404
score: -3
linked to: http://stackoverflow.com/q/1723845
has comment: http://stackoverflow.com/comment/40909269
type: AnsweredQuestion
has body: What is the difference between an Applet and a Servlet and what are a few examples on how each of them are used? I am new to networking am I am wondering how these things are different.
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/26089459
tagged with: servlets
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/a/26178763
upvote count: 6
has comment: http://stackoverflow.com/comment/41045462
type: AcceptedAnswer
downvote count: 0
has body: One way would be to create streams of pairs of value/key (for example with an array) and flat map them for collection: Map&lt;String, String&gt; newMap = map.entrySet().stream() .flatMap(e -&gt; e.getValue().stream().map(s -&gt; new String[] { s, e.getKey() })) .collect(toMap(array -&gt; array[0], array -&gt; array[1])); The String array looks a bit hacky though...
accepted answer of: http://stackoverflow.com/q/26178610
type: Answer
score: 6
answers question: http://stackoverflow.com/q/26178610

http://stackoverflow.com/comment/40998112
type: Comment
comment on: http://stackoverflow.com/q/26153180
score: 0
type: QuestionComment
has text: @Tad: tell us what you've tried instead of asking for a "better" answer; otherwise this is likely to get closed rapidly as a homework or unclear question

http://stackoverflow.com/q/26086077
answer count: 1
has body: I have a class in one package and another class in another package. In first package i have a public static variable which i want to access from second class. Here is my first class's code : package first; import org.openqa.selenium.WebDriver; public class first{ public static WebDriver driver; } Here is my second class's code : package second; import first.*; public class second{ first.driver.findElement(By.xpath("html/body/form/div[5]/div/div[1]/div[2]/table/tbody/tr[1]/td[2]/input")).click(); } My IDE is displaying error in 'first.driver.findElement(By.xpath("html/body/form/div[5]/div/div[1]/div[2]/table/tbody/tr[1]/td[2]/input")).click();' this line. Please help me out Thanks
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/26086131
type: Question
has comment: http://stackoverflow.com/comment/40875300
tagged with: static-members
score: 0
has title: Not able to access static variable of another package's class

http://stackoverflow.com/comment/40952325
comment on: http://stackoverflow.com/q/26128308
type: Comment
score: 1
type: QuestionComment
has text: @getlost I'm pretty sure that won't work.

http://stackoverflow.com/comment/40844252
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26068678
has text: Maybe obvious, but your library wants ffmpeg-x86.exe (not ffmpeg.exe). Did you try renaming it?
score: 0

http://stackoverflow.com/q/26086402
answer count: 1
has comment: http://stackoverflow.com/comment/40876082
type: UnansweredQuestion
has body: I want to render a cylinder in Opengl. For that i wrote an simple algorithm, that generates me the points mesh by the parameters radius, height, xSubDivisions and ySubDivisions: (Java) for(int yDivision = 0; yDivision &lt; yDivisionCount; yDivision++){ for(int xDivision = 0; xDivision &lt; xDivisionCount; xDivision++){ float line[] = getVboLine(xDivision, yDivision, radius, height, xDivisionCount, yDivisionCount); string.append(line[0] + ", " + line[1] + ", " + line[2] + ", " + line[3] + ", " + line[4] + ", "); } } public float[] getVboLine(int xDivision, int yDivision, float radius, float height, int xDivisionCount, int yDivisionCount){ float xDegrees = 360.0f / xDivisionCount * xDivision; float xRadian = (float) Math.toRadians(xDegrees); float x = (float) Math.sin(xRadian) * radius; float z = (float) Math.cos(xRadian) * radius; float y = (float) yDivision * (height / (yDivisionCount - 1)); float s = xDegrees * (1.0f / 360.0f); float t = yDivision * (1.0f / (yDivisionCount - 1)); return new float[]{ x, y, z, s, t }; } The result is actually an cylinder, (i created an IBO to render this points) but sometimes, with different inputs for x and yDivisions there is a strange gap in it. I couldn't find a rule, but the values i found this bug with were 200, 100. To debug i rendered only the points. The result was: How is this possible? One points is just missing (where i added the reed circle with paint). Where is the problem with my algorithm?
tagged with: opengl
tagged with: java
has title: strange thing with cylinder algorithm
tagged with: lwjgl
has answer: http://stackoverflow.com/a/26093822
has comment: http://stackoverflow.com/comment/40876431
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40876349
score: 0

http://stackoverflow.com/q/26167478
tagged with: android
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
has body: I know. Many similar questions. I have not found any answer that solves this one. How do I get the Google Play Services lib to work in Eclipse 3.7.1 with Android SDK Tools 23.0.2? Tried alot of combinations. First, to get the lib to import correctly. I've tried these methods beside the obvious flawed from Google. (I've also removed the write-protection from all files) Copy the code to the workspace and use File --> import --> Android --> Used ex... then checked the COPY-box. Copy the folder to another place and then import into the workspace and linking it. Then in my project I added the meta-data-thing into my in androidmanifest.xml. In my project I've clicked Properties --> Android --> In the lower panel I've added the Google Services Project that I've imported. Now everything builds. (I've seen that many people have trouble with that.) In properties, under the option Java Build Path the libraries are checked under the tab "Order and export". The method I use in my main activity is GooglePlayServicesUtil.isGooglePlayServicesAvailabl(..)... When I run the application I get an exception, NoClassDefFoundError. And for sure, the class is not in the APK. I've checked, but some other classes under from gms.internal exists?! In my project under Android dependencies is the 1k output from the imported lib. Under Android private libraries is the full jar. Update: Solved this by downloading the latest version of http://www.eclipse.org. (The update function didn't find anything).
type: Question
downvote count: 0
favorite count: 0
has title: Google Play Services not imported correctly
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26118359
type: AnsweredQuestion
tagged with: java
has body: Am using Liferay 6.2 GA1 platform How to get the User ID of the newly created user in the Struts portlet action class method processAction , i am overriding the /admin_user/edit_user action , Purpose : To get the newly created user id in the action class and save it to another table(in another db). public void processAction( StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Long currentuser = themeDisplay.getUserId(); if (currentuser != null) { log.info("Wrapped /admin_server/edit_user action"); } originalStrutsPortletAction.processAction( originalStrutsPortletAction, portletConfig, actionRequest, actionResponse); User selUser = (User) actionRequest.getAttribute("USER"); log.info("User ID : "+selUser.getUserId()); } but the user id am getting is the user id of the logged in user. How to get the new user ID ?
type: Question
tagged with: struts
score: 0
tagged with: liferay
tagged with: portlet
answer count: 1
has title: Getting User ID of the newly created user in liferay hook struts action process method
has answer: http://stackoverflow.com/a/26119146
accepted answer: http://stackoverflow.com/a/26119146

http://stackoverflow.com/q/26152515
answer count: 3
downvote count: 0
favorite count: 0
has title: Output redirection in Java
possible better answer: http://stackoverflow.com/a/26152550
has answer: http://stackoverflow.com/a/26152550
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26152567
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26152559
type: Question
has body: How can I redirect an output in java? I am running a program in eclipse. My code is as follows: public static void main(String[] args) throws Exception{ /* Redirect output to file */ File file = new File("fileName"); FileOutputStream fos = new FileOutputStream(file); PrintStream ps = new PrintStream(fos); System.setOut(ps); OtherClass.main(args); } Without the output redirection I wrote above, the code returns some values in black and some in red (which are not errors, but parameters called in OtherClass). The redirection above writes the text that appeared in black in the eclipse console in my file, but the output in read is written on console and not in my file. How can I do the contrary and print the red text in my file and not the black one? And why does eclipse use different colors for this output?
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26152567

http://stackoverflow.com/q/26168410
has comment: http://stackoverflow.com/comment/41032265
has comment: http://stackoverflow.com/comment/41026554
has body: I am trying to find out optimal memory settings for a web application that we have. This application requires retrieval of large data sets and results in high memory usage. I wrote a small program to test JVM memory settings, this code basically floods memory with dummy objects. import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; class Dummy{ public final long v1 = 132132343243245L; public final long v2 = 132132343243245L; public final long v3 = 132132343243245L; public final long v4 = 132132343243245L; } public class MemoryTest { public static void main(String[] args){ FileWriter fw = null; long start = System.currentTimeMillis(); try{ fw = new FileWriter("out.txt"); ArrayList&lt;Dummy&gt; alDummies = new ArrayList&lt;Dummy&gt;(); for(int i =0 ; i &lt; 1000; i++){ long begin = System.currentTimeMillis(); for(int j=0; j&lt; 10000; j++){ alDummies.add(new Dummy()); } long end = System.currentTimeMillis(); fw.write(Long.toString(end-begin) + "\n"); } } catch(FileNotFoundException e){ e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if(fw != null) try { long finish = System.currentTimeMillis(); fw.write("Total: " + Long.toString(finish-start)); fw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } This is what happened when I ran the code with various memory settings. -Xms512M -Xmx512M: Errors out with insufficient memory. -Xms768M -Xmx768M: Took total time of ~3300ms -Xms1G -Xmx1G: Took total time of ~450ms -Xms2G -Xmx2G: Took total time of ~500ms all these are average of 10 runs. I can understand the performance improvement from 768M to 1G , I guess JVM had to do less of memory page movements. However I do not understand the performance degradation from 1G to 2G, why is it performing slower with higher amount of memory? I do not know if it matters I am using mac pro with 16G memory and 2…
tagged with: jvm
favorite count: 0
tagged with: memory-management
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41036679
downvote count: 1
has title: JVM memory settings impact
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41026533
tagged with: memory
has comment: http://stackoverflow.com/comment/41029413
has comment: http://stackoverflow.com/comment/41026387
type: Question
has comment: http://stackoverflow.com/comment/41029255
has comment: http://stackoverflow.com/comment/41026461

http://stackoverflow.com/a/26079378
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40863127
accepted answer of: http://stackoverflow.com/q/26078825
has comment: http://stackoverflow.com/comment/40863186
has comment: http://stackoverflow.com/comment/40863306
type: Answer
answers question: http://stackoverflow.com/q/26078825
has comment: http://stackoverflow.com/comment/40863252
has comment: http://stackoverflow.com/comment/40863084
has body: Since the implementation of println is synchronized on that instance, there's virtually no chance that the stream will self-corrupt. If you have different threads printing different things, however, you may see non-deterministic behavior in that the order you perceive things to be printed isn't the order in which they actually are. That's a separate concern to the actual corruption of the stream you're writing to.
score: 1
has comment: http://stackoverflow.com/comment/40863310
upvote count: 3
has comment: http://stackoverflow.com/comment/40863233
downvote count: 2
has comment: http://stackoverflow.com/comment/40872878

http://stackoverflow.com/a/26100391
upvote count: 3
answers question: http://stackoverflow.com/q/26100352
score: 3
downvote count: 0
has body: In particular, this is not a constant, because if you can access the array, you can easily do: ARRAY = new String[]({"Word3"}; Capital-case letters don't make a variable a constant. The final modifier, however, does: final String[] ARRAY = new String[]{"Word1", "Word2"}; As a side note, you can checkout what's the difference between constant and immutable objects.
type: Answer

http://stackoverflow.com/a/26109715
answers question: http://stackoverflow.com/q/26108796
score: 2
downvote count: 0
type: Answer
upvote count: 2
has body: You can do it much easier if you don't need your own algorithm: public int toBinary(int decimal) { String binaryString = Integer.toBinaryString(decimal); return Integer.parseInt(binaryString); } If you want to make your own algorithm, bit bashing would be easier. An int seems like a poor container for a binary representation of an integer, since you can only hold 9 bits. public int toBinaryBitBashing(int decimal) { int bitCount = 6; int bit = 0; int binary = 0; int power = 1; for(int i=0; i&lt;bitCount; ++i) { bit = (decimal &gt;&gt; i) &amp; 1; binary += bit * power; power *= 10; } return binary; }

http://stackoverflow.com/a/26089438
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26067405
score: 0
type: Answer
has body: When facing the most common OutOfMemoryError, namely the one "java.lang.OutOfMemoryError: Java heap space", some simple aspects must first be understood. Java applications are allowed to use a limited amount of memory. This limit is specified during application startup. To make things more complex, Java memory is separated different regions named heap space and permgen. The size of those regions is set during the Java Virtual Machine (JVM) launch by specifying parameters such as -Xmx and -XX:MaxPermSize. If you do not explicitly set the sizes, platform-specific defaults will be used. So – the “[java.lang.OutOfMemoryError: Java heap space][1]” error will be triggered when you try to add more data into the heap space area, but there is not enough room for it. Based on this simple description, you have two options Give more room to the data structures Reduce the size of the data structures used Giving more room is easy - just increase the heap size by changing the -Xmx parameter, similar to the following example giving your Java process 1G of heap to play with: java -Xmx1024m com.mycompany.MyClass Reducing the size of the data structures typically takes more effort, but this might be necessary in order to get rid of the underlying problems - giving more room can sometimes just mask the symptoms and postpone the inevitable. For example, when facing a memory leak you are just postponing the time when all the memory is filled with leaking garbage. In your case, reading the data in smaller batches and processing each batch at the time might be an option.

http://stackoverflow.com/a/26106696
type: Answer
score: 0
has body: You print everytime one '*'-sign. You don't necessarily need two loops. You can place the sign outside of the loop and you can add an asterisk every iteration with string.concat("*"). Concatenating actually means combining two strings into one, so you actually combine the sign from the previous iteration with a new sign. int current_line = 0; String input_line = showInputDialog("type here "); int target_line = Integer.parseInt(input_line); String sign = "*"; while (current_line != target_line){ sign.concat("*"); System.out.println(sign); current_line ++; }
answers question: http://stackoverflow.com/q/26106434

http://stackoverflow.com/comment/40915449
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26106372
type: Comment
has text: Hey, another quick question, when I tried to implement your suggestion it gives me the error "cannot find symbol - class UnsuportedPlayException". Do you know why that could be happening?

http://stackoverflow.com/q/26061278
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40830016
has comment: http://stackoverflow.com/comment/40829787
has comment: http://stackoverflow.com/comment/40829719
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/40830533
has body: I have a JSF/JPA application where more than 20 users log on to the system and generate Bill type entities. These each newly generated entities need to have a Bill Number that is unique to the Department and Bill Type. Bill Type Examples (From an Enum) Opd Payment Inward Department Type Examples(User Entering virtually unlimited number of Departments) Ruhuna Coop Arogya Example Bill Numbers Ruhuna/Opd/001 Ruhuna/Opd/002 Ruhuna/Payment/001 Coop/Opd/001 Ruhuna/Opd/003 Coop/Payment/001 I record all bills in one Entity called Bill. For the moment I use an application scope JSF Controller (with @Named annotation) to check the total count of Bills after passing BillType and Department as parameters. I add one to the count and add prefixes of BillType and Department Code to the count to generate the BillNo. Soon after adding the bill number, I persist the newly created bill. The issue is that if two users settle a bill from same department and same bill type simultaneously, BillNumber is duplicated. For example there may be two Ruhunu/Opd/21300 and the third bill will come as Ruhunu/Opd/21302. So Ruhunu/Opd/21301 bill number is missing. Error Example Ruhunu/Opd/21300 (billed simultaneously with second bill.) Ruhunu/Opd/21300 (billed simultaneously with first bill.) Ruhunu/Opd/21302 (thired Bill ) It is absolutely necessary to prevent generation of Duplicate numbers as that number is used in the practical setup to trace the bills and make cancellations, refunds, payments, etc. Please suggest a method to generate multiple Serial Numbers which prevent duplicates. Thanks in advance. Technical Details Application Server - GlassFish 3.1.2.2 Persistence Provider - EclipseLink 2.5 (used with all possible caching methods, still failed.) Database - MySQL Number of Application Instances - One Clustering of Application Servers - Not at this moment Clustering of Database - Not at this moment
has title: Multiple Serial Number Generation in JSF/JPA Application
has comment: http://stackoverflow.com/comment/40830179
tagged with: jpa
linked to: http://stackoverflow.com/q/13570711
has comment: http://stackoverflow.com/comment/40829966
has comment: http://stackoverflow.com/comment/40830065
score: 0
has comment: http://stackoverflow.com/comment/40829916
answer count: 0
tagged with: jsf

http://stackoverflow.com/comment/40987101
has text: CREATE TABLE DOCUMENT ( ID INTEGER NOT NULL, TYPE INTEGER NOT NULL, IDX INTEGER, DOC VARCHAR(255) ); CREATE TABLE DOCUMENT_TYPE ( ID INTEGER NOT NULL, NAME VARCHAR(255) )
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26146112
score: 1

http://stackoverflow.com/comment/40933168
type: Comment
type: QuestionComment
has text: did you refresh your target folder after doing the build and have you enabled tests to be run when you do the mvn clean install
score: 0
comment on: http://stackoverflow.com/q/26118217

android-activity
tags question: http://stackoverflow.com/q/26098359
tags question: http://stackoverflow.com/q/26085766
tags question: http://stackoverflow.com/q/26175423
tags question: http://stackoverflow.com/q/26055707
tags question: http://stackoverflow.com/q/26057977
tags question: http://stackoverflow.com/q/26176645
tags question: http://stackoverflow.com/q/26168334
tags question: http://stackoverflow.com/q/26049613
tags question: http://stackoverflow.com/q/26188311
tag name: android-activity
tags question: http://stackoverflow.com/q/26092959
tags question: http://stackoverflow.com/q/26190395
tags question: http://stackoverflow.com/q/26125544
tags question: http://stackoverflow.com/q/26053442
tags question: http://stackoverflow.com/q/26051126
tags question: http://stackoverflow.com/q/26089642
tags question: http://stackoverflow.com/q/26190073
tags question: http://stackoverflow.com/q/26112543
tags question: http://stackoverflow.com/q/26115287
tags question: http://stackoverflow.com/q/26171126
tags question: http://stackoverflow.com/q/26101842
tags question: http://stackoverflow.com/q/26069759
tags question: http://stackoverflow.com/q/26133035
tags question: http://stackoverflow.com/q/26152815
tags question: http://stackoverflow.com/q/26152419
tags question: http://stackoverflow.com/q/26100006
tags question: http://stackoverflow.com/q/26166761
tags question: http://stackoverflow.com/q/26113167
type: Tag

http://stackoverflow.com/comment/40934171
has text: So T is Transmitter/Sender and R is Receiver?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26118167
type: QuestionComment

http://stackoverflow.com/q/26172632
accepted answer: http://stackoverflow.com/a/26172983
type: Question
tagged with: object
score: 1
tagged with: java
tagged with: class
downvote count: 0
tagged with: variables
has answer: http://stackoverflow.com/a/26172748
favorite count: 0
has answer: http://stackoverflow.com/a/26172983
possible better answer: http://stackoverflow.com/a/26172649
has answer: http://stackoverflow.com/a/26172643
has answer: http://stackoverflow.com/a/26172649
answer count: 4
has body: I'm studying linked lists from this video from UC Berkeley. However, when I try typing the same version in my Eclipse compiler, like this.... public class CreateLinkedList{ public class Node{ String PlayerName; Node next; } Node first = new Node(); Node second = new Node(); Node third = new Node(); first.PlayerName = "Sanchez"; second.PlayerName = "Ozil"; third.PlayerName = "Welbeck"; public static void main(String[] args) { } } I get the error "Syntax error on token "PlayerName", VariableDeclaratorID expected after this token" on the following lines first.PlayerName = "Sanchez"; second.PlayerName = "Ozil"; third.PlayerName = "Welbeck"; Can anyone explain where I'm going wrong?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/70324
upvote count: 1
has title: Java - VariableDeclaratorID expected after this token, when assigning value to an instance variable

http://stackoverflow.com/comment/40965624
has text: You can use unsigned char pointer for pointing it in C++ as a primitive byte array (search JNI GetPrimitiveArrayCritical). For Java side, you can use byte array for display.
comment on: http://stackoverflow.com/a/26099084
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/26157011
has body: Doing it in the EAR or WAR is already too late; according to the question/answer you link to it needs to be set at Java startup time using the -D command line flag. So it needs to go in the standalone startup script, or in a JAVA_OPTS environmental variable. Both require modifications to the server environment.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26144574
accepted answer of: http://stackoverflow.com/q/26144574
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41017521
type: AcceptedAnswer

http://stackoverflow.com/comment/41106748
has text: I have the same issue, except without custom layout X/Y. It seems putting ScrollPane inside swt.FXCanvas alone can cause this. Tried sw/es2/d3d prism engines but they make no difference.
comment on: http://stackoverflow.com/q/26098295
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26062495
answer count: 1
has body: I have a problem of creating NamedQuery with Hibernate. The problem is I need to select a list of Books not appearing in Orders. My classes looks something like this: @Entity @NamedQueries({ @NamedQuery(name = "Book.findAvailable", query = "SELECT b FROM Book b WHERE b.id not in ????????") }) public class Book { @Id @GeneratedValue private Long id; ...... and Order: @Entity(name = "orders") public class Order { @Id @GeneratedValue private Long id; @ElementCollection private List&lt;Book&gt; items; ..... As you see, I keep my Books in order in a list. The Query I need should pull out all the books from the DB which don't apear in any order. Any help is appreciated. Many thanks.
has answer: http://stackoverflow.com/a/26062970
has comment: http://stackoverflow.com/comment/40835278
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
score: 0
has title: Hibernate Named Query (Select all instances of entity not appearing in other entity)
accepted answer: http://stackoverflow.com/a/26062970
type: Question
tagged with: named-query
has comment: http://stackoverflow.com/comment/40832275
tagged with: jpa

http://stackoverflow.com/comment/41071590
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26192666
has text: @DmitryGinzburg I still get the ` Target is not a JDK root. System library was not found.` message and the Finish button is still disabled.
score: 0

http://stackoverflow.com/comment/41020804
comment on: http://stackoverflow.com/q/26163133
type: Comment
has text: If you're using Maven to manage dependencies, you might take a look at the shade plugin.
type: QuestionComment
score: 1

http://stackoverflow.com/a/26075990
score: 0
answers question: http://stackoverflow.com/q/26075699
type: Answer
has body: first make sure that you are sending right word (persian ) from android side , maybe your java code not sending text in UTF-8 , then make sure that your server, database , and table collection are utf8_persian_ci and change this BufferedReader in = new BufferedReader( new InputStreamReader(urlConnection.getInputStream())); to this: BufferedReader in = new BufferedReader( new InputStreamReader(urlConnection.getInputStream(), "utf-8"),8);

http://stackoverflow.com/comment/40972600
score: 2
comment on: http://stackoverflow.com/a/26139579
has text: you don't need to escape `%`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40846938
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26070045
has text: oh got it, I thought the update command is the same for any language :P
score: 0

http://stackoverflow.com/q/26036570
tagged with: java
tagged with: solr
type: Question
has answer: http://stackoverflow.com/a/26054163
has body: I am using solr synonym in my application.. here is query to from which i am getting synonym http://localhost:8983/solr/analysis/field?analysis.query='+request.term+'&amp;analysis.fieldname=description&amp;analysis.showmatch=true&amp;wt=json&amp;indent=true I tried same using solrj to get synonym ModifiableSolrParams params = new ModifiableSolrParams(); params.set("qt", "/analysis/field"); params.set("analysis.query", queryterm); params.set("analysis.fieldname", "description"); params.set("analysis.showmatch", true); try { resp1 = server.query(params); System.out.println(resp1); } catch (SolrServerException ex) { System.out.println(ex); } SolrDocumentList results = resp1.getResults(); for (int i = 0; i &lt; results.size(); ++i) { System.out.println(results.get(i).getFieldValue("description").toString()); } How to get synonym?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40787028
tagged with: solrj
type: UnansweredQuestion
has title: how to get Query Analysis response / synonym from solrj
has comment: http://stackoverflow.com/comment/40789870

http://stackoverflow.com/comment/40788353
type: QuestionComment
has text: possible duplicate of [Mockito: Trying to spy on method is calling the original method](http://stackoverflow.com/questions/11620103/mockito-trying-to-spy-on-method-is-calling-the-original-method)
score: 0
comment on: http://stackoverflow.com/q/26038563
type: Comment

http://stackoverflow.com/a/26149232
has comment: http://stackoverflow.com/comment/117383973
downvote count: 0
has comment: http://stackoverflow.com/comment/40994078
type: AcceptedAnswer
score: 18
has body: Connectors are the components that listen for incoming connections. Handlers are the low level jetty mechanism used to handle all requests. Jetty sends all valid requests (there are a class of requests that are just bad HTTP usage and can result in things like a 400 Bad Request) to whatever is registered at Server.getHandler() There are many types of function specific handlers, pick one that best suits your needs and extend from it, or wrap your handler around a more generalized approach. A typical server is setup to have either a HandlerList or HandlerCollection to indicate a list of possible behavior. Each handler is hit (in order) and if that handler decides it wants to do something it can. If a handler actually produced something, then a call to baseRequest.setHandled(true); is used to tell Jetty to not process any more handlers after this current one. As to how to restrict certain handlers to certain connectors, that's done via the virtualhosts mechanism. VirtualHosts is a concept baked into the ContextHandler specific handlers, so you'll want to wrap your custom handlers in a ContextHandler to get the benefit of VirtualHosts. To use this, you would name your connector using Connector.setName(String) and then use the @{name} syntax on the VirtualHosts definition of the ContextHandler to specific that only that named connector can be used to serve that specific ContextHandler. Example: ServerConnector httpConnector = new ServerConnector(server); httpConnector.setName("unsecured"); // named connector httpConnector.setPort(80); ContextHandler helloHandler = new ContextHandler(); helloHandler.setContextPath("/hello"); helloHandler.setHandler(new HelloHandler("Hello World")); helloHandler.setVirtualHosts(new String[]{"@unsecured"});
has comment: http://stackoverflow.com/comment/40994155
upvote count: 18
type: Answer
accepted answer of: http://stackoverflow.com/q/26148418
has comment: http://stackoverflow.com/comment/117351336
has comment: http://stackoverflow.com/comment/117363833
answers question: http://stackoverflow.com/q/26148418

http://stackoverflow.com/comment/40996033
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26152050
has text: @SotiriosDelimanolis yes URL.toString() is valid too. The goal is to get all such valid chains. One of the motivations is to save time on API researching when not familiar with APIs of a new domain.

http://stackoverflow.com/comment/40965668
comment on: http://stackoverflow.com/q/26135739
type: Comment
type: QuestionComment
has text: First check are you getting all data from server?
score: 0

http://stackoverflow.com/a/26155802
type: Answer
answers question: http://stackoverflow.com/q/26155742
score: 1
has body: Take a closer look at... println(" _(")_ "); ^---^---^ You open, close and open the quotes, " _(" is a proper String literal, )_ " is garbage as far as the compiler is concerned, as it's not any valid Java command it can interpret. You need to escape the second quote, for example... println(" _(\")_ "); This will make Java ignore it and treat it as (literally) as part of the Strings content... The \ also has special meaning, as you've seen, you also need to escape it... println(" / : \\ "); println("(_/ \\_)");
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26179850
answers question: http://stackoverflow.com/q/26179159
score: 1
upvote count: 1
downvote count: 0
has body: I presume it is a problem of transactional proxy not being used (just a guess from the stacktrace). By default, spring uses a Jdk proxy for it, but that needs the service to be imported as an interface in the controller. If it is the case, create an interface IPersonService containing relevant method from PersonService and import it in PersonController as @Autowired IPersonService personService; or even better, rename PersonService to PersonServiceImpl and make PersonService an interface. And ... consistently do that for all your transactional services ...
type: Answer

http://stackoverflow.com/comment/40820246
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26055535
type: Comment
has text: Cool, nearly there... however sort on codes beginning with letters now goes: M01, P2, M02, P3, M03 etc. Do you think there is a way so it will also sort first on first letter then on numbers? Thanks for you help.

http://stackoverflow.com/comment/40868112
has text: @Makoto Thanks for reminding me of that. I've add the bounded wildcard solution.
comment on: http://stackoverflow.com/a/26081976
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41019404
score: 0
type: Comment
type: QuestionComment
has text: I think it depends on the projects build path. Make sure the source file(`.java`) package which you are trying to access is listed in the build path and not some jar/ war which contains the `.class` of your source file.
comment on: http://stackoverflow.com/q/26164451

http://stackoverflow.com/comment/40907761
type: QuestionComment
has text: pom.xml is updated in the question.....
score: 0
comment on: http://stackoverflow.com/q/26102916
type: Comment

http://stackoverflow.com/q/26053367
upvote count: 2
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40816073
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/40816255
has title: Accessing HttpServletRequest request in child thread
tagged with: java
tagged with: servlets
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26055606
favorite count: 0
has body: I have a web application, in which i am using ScheduledThreadPoolExecutor to schedule some logic to be executed later (maybe after original web request is over). Is it possible to access/use HttpServletRequest of original request inside child thread (created via "schedule" call on ScheduledThreadPoolExecutor)? I tried autowiring HttpServletRequest inside class whose function is running in child thread, but got following error (which i understand the reason for) java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. Is there any possible way? Can RequestContextFilter be possibly used?
tagged with: spring
tagged with: requestcontext
has comment: http://stackoverflow.com/comment/40815351

http://stackoverflow.com/comment/41330768
has text: I do not think a `SwingWorker` is appropriate in this case. The `currentGrid` variable is used on the EDT for painting. Modifying it on a background thread is asking for threading issues
comment on: http://stackoverflow.com/a/26316007
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26222122
has comment: http://stackoverflow.com/comment/41321325
has comment: http://stackoverflow.com/comment/42302403
has comment: http://stackoverflow.com/comment/41199993
score: 4
has comment: http://stackoverflow.com/comment/41199378
has comment: http://stackoverflow.com/comment/41355771
has comment: http://stackoverflow.com/comment/41355047
has comment: http://stackoverflow.com/comment/41355466
has comment: http://stackoverflow.com/comment/41331620
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41200574
has comment: http://stackoverflow.com/comment/41319598
has comment: http://stackoverflow.com/comment/41355722
has body: I think the first real issue here is that your code is simply massively inefficient. Building up a string in a loop is a really bad thing to do: you create a new object and copy all the characters every time. Additionally, each time you update the text area, you are copying the entire existing text, creating another String by concatenating the additional content, and then replacing all the existing content with the new content. The string concatenation is going to run in quadratic time (as you are increasing the length of the strings each time) and you're going to cause mayhem for Java's string interning process. Also, note that you shouldn't read the state of a node in the scene graph anywhere except on the FX application thread, so your line content = FxUI.outputArea.getText() + "\n" + output; is not thread-safe. In general, to build up a string in a loop, you should use a StringBuilder to build up the string contents. If you're using a TextArea, it has an appendText(...) method which is all you need to update it. Update following discussion in comments: Having made those general comments, making those improvements doesn't really get you to a state where the performance is acceptable. My observation there is that the TextArea is slow to respond to user input even after the threads have completed. The issue is (I guess) that you have a large amount of data which is actually associated with a "live" part of the scene graph. A better option here is probably to use a virtualized control such as a ListView to display the data. These only have cells for the visible portion and reuse them as the user scrolls. Here is an example. I added selection and copy-to-clipboard functionality as that is the main thing you would miss going from a TextArea to a ListView. (Note that if you have a huge number of things selected, the String.join() method is very slow to run. You might have to create a background task for that and a blocking dialog to show its progress if that's importan…
type: Answer
has comment: http://stackoverflow.com/comment/41201620
has comment: http://stackoverflow.com/comment/41196662
upvote count: 4
has comment: http://stackoverflow.com/comment/41196707
has comment: http://stackoverflow.com/comment/41340323
accepted answer of: http://stackoverflow.com/q/26191773
answers question: http://stackoverflow.com/q/26191773

http://stackoverflow.com/q/26158956
accepted answer: http://stackoverflow.com/a/26160541
has comment: http://stackoverflow.com/comment/41011042
type: AnsweredQuestion
score: 3
has body: I have used JAXB for XML parsing in the past and created my own simple classes for it. Those were POJOs like public class Foo { @XmlAttribute public String someAttribute; public String someElement; public Bar bar; } Now I want to write a tool that has to parse data from a very complex xml structure and I would like to avoid writing them all by myself. I tried using xjc to generate the classes, but they look entirely different from my example above: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "RulesElementType", propOrder = { "content" }) public class RulesElementType { @XmlElementRefs({ @XmlElementRef(name = "flavor2", type = JAXBElement.class, required = false), @XmlElementRef(name = "specific", type = JAXBElement.class, required = false), @XmlElementRef(name = "category2", type = JAXBElement.class, required = false), @XmlElementRef(name = "flavor1", type = JAXBElement.class, required = false), @XmlElementRef(name = "print-prereqs", type = JAXBElement.class, required = false), @XmlElementRef(name = "prereqs2", type = JAXBElement.class, required = false), @XmlElementRef(name = "rules", type = JAXBElement.class, required = false), @XmlElementRef(name = "prereqs1", type = JAXBElement.class, required = false) }) @XmlMixed protected List&lt;Serializable&gt; content; @XmlAttribute(name = "name") protected String name; @XmlAttribute(name = "type1") protected String type1; @XmlAttribute(name = "internal-id") protected String internalId; @XmlAttribute(name = "source") protected String source; @XmlAttribute(name = "revision-date") protected String revisionDate; /* getters and setters omitted */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class Category2 { @XmlValue protected String value; @XmlAttribute(name = "name") protected String name; /* getters and setters omitted */ } /* additional class definitions omitted */ } To get the element named "flavor1" I have to search the "content" attribute for a JAXBElement n…
upvote count: 3
tagged with: java
tagged with: jaxb
type: Question
linked to: http://stackoverflow.com/q/26107727
has comment: http://stackoverflow.com/comment/41017739
has title: Generating Pretty JAXB classes
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41009122
has answer: http://stackoverflow.com/a/26160541
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
linked to: http://stackoverflow.com/q/26138753

http://stackoverflow.com/comment/40795209
score: 0
type: Comment
type: QuestionComment
has text: Why do you multiply `i` by 2? shouldn't that be `i++` instead?
comment on: http://stackoverflow.com/q/26042373

http://stackoverflow.com/comment/40875025
comment on: http://stackoverflow.com/q/26081093
score: 0
type: Comment
type: QuestionComment
has text: @Volune The article seems to be rather bad and I read others, but this one was the first and boldest I could find now. Actually, the image shows a single nodejs thread, and a couple of Java threads, out of which more than one is running => Java wins. ;)

http://stackoverflow.com/a/26065410
downvote count: 0
answers question: http://stackoverflow.com/q/26064895
type: Answer
score: 1
upvote count: 1
has body: As you mentioned in your comments - JInternalFrame is the typical way to do this in Swing. The Oracle tutorial on JInternalFrames is here.
accepted answer of: http://stackoverflow.com/q/26064895
type: AcceptedAnswer

http://stackoverflow.com/q/26141605
has comment: http://stackoverflow.com/comment/40976201
tagged with: interface
accepted answer: http://stackoverflow.com/a/26141710
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40976187
upvote count: 1
tagged with: methods
type: Question
has title: JAVA - define a method in interface
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26141710
has comment: http://stackoverflow.com/comment/40976109
tagged with: class
has body: I would like to define a method in JAVA interface. The reason is that every time I implement interface the method is the same, but I need to implement two interfaces for particular classes. Example: interface A method A() interface B method B() class first implements A,B class second implements A method A() has same body everywhere.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40976278
favorite count: 0

http://stackoverflow.com/a/26091290
type: Answer
accepted answer of: http://stackoverflow.com/q/26089614
answers question: http://stackoverflow.com/q/26089614
has body: String s1 = txt1.getText().toString(); // "10" String s2 = txt2.getText().toString(); // "5" int i1 = Integer.ParseInt(s1); int i2 = Integer.ParseInt(s2); int i3 = i1 - i2; txt3.setText(String.valueOf(i3));
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/26118927
has comment: http://stackoverflow.com/comment/40934267
downvote count: 0
answers question: http://stackoverflow.com/q/26118793
has comment: http://stackoverflow.com/comment/40934393
type: Answer
score: 1
upvote count: 1
has body: You don't need goto - there is no implemented goto in Java anyway. You can just put the try/catch in the loop. The loop can continue when the exception is caught, one thing has nothing to do with the other. int start = 0; boolean isNotNull = false; while (!isNotNull) { try { prot.getProcessedTranscriptPositionFromAA(start); isNotNull = true; } catch (NullPointerException e) { start++; } } I have written this with the assumption that you have no say over how getProcessedTranscriptPositionFromAA() is implemented. However, if you do control this method, or know the person who does, make sure it does not throw a NullPointerException when passed an index to an empty location - that is not good API design. It should instead return something that indicates that the location is empty. There is a lot of lively disagreement over whether that something should be a null or a non-null object indicating emptiness; but either way, don't throw an exception.

http://stackoverflow.com/comment/41024816
score: 0
type: Comment
has text: I am also trying the 2.0 beta 2 client, and get a flag error: `com.couchbase.client.java.error.TranscodingException: Flags (0x112) indicate non-JSON document for id someKey, could not decode.`
type: AnswerComment
comment on: http://stackoverflow.com/a/26152810

http://stackoverflow.com/a/68149523
downvote count: 0
answers question: http://stackoverflow.com/q/26173073
upvote count: 2
type: Answer
score: 2
has body: That's because your solution has O(n*n) time complexity. and this problem can be solved by O(n) time complexity if you make use of Map public int[] twoSum(int[] nums, int target) { Map&lt;Integer,Integer&gt; map = new HashMap&lt;&gt;(); for(int i =0; i&lt; nums.length; i++) { if(map.containsKey(target - nums[i])){ return new int[]{map.get(target - nums[i]), i}; }else { map.put(nums[i], i); } } return new int[]{-1,-1}; }

embedded-jetty
tags question: http://stackoverflow.com/q/26163162
tags question: http://stackoverflow.com/q/26041712
type: Tag
tag name: embedded-jetty
tags question: http://stackoverflow.com/q/26148418
tags question: http://stackoverflow.com/q/26161735

http://stackoverflow.com/comment/40877321
score: 0
type: Comment
has text: @Pshemo Haha, what for, I am talking about `no modifier` not `private`.
type: AnswerComment
comment on: http://stackoverflow.com/a/26087095

http://stackoverflow.com/comment/41058754
comment on: http://stackoverflow.com/a/26185559
has text: That's not an answer to a problem, since AtomicInteger is not an Integer at all. And you answered wrongly. The argument is NOT passed by value. It is passed by reference since this is and Integer object (not the primitive int).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26145841
has comment: http://stackoverflow.com/comment/40984655
favorite count: 0
tagged with: runtime-error
tagged with: exception
has answer: http://stackoverflow.com/a/26146073
has comment: http://stackoverflow.com/comment/40984280
has title: How do I put something on an FX thread?
upvote count: 2
has answer: http://stackoverflow.com/a/26148048
has body: I'm new to JavaFX (trying to move from Swing), and am trying to make a very basic window first. However, I keep getting the following runtime exception: Exception in thread "main" java.lang.IllegalStateException: Not on FX application thread; currentThread = main at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:210) at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:393) at javafx.scene.Scene.&lt;init&gt;(Scene.java:374) at javafx.scene.Scene.&lt;init&gt;(Scene.java:232) at bht.tools.util.upd.TestDialog.initGUI(TestDialog.java:39) at bht.tools.util.upd.TestDialog.&lt;init&gt;(TestDialog.java:24) at bht.tools.util.upd.TestDialog.main(TestDialog.java:52) package bht.tools.util.upd; import java.awt.Window; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javax.swing.JDialog; /** * TestDialog is copyright Blue Husky Programming ©2014 GPLv3 &lt;hr/&gt; * * @author Kyli of Blue Husky Programming * @version 1.0.0 * - 2014-09-30 (1.0.0) - Kyli created TestDialog * @since 2014-09-30 */ public class TestDialog extends JDialog { public TestDialog(Window owner) { super(owner); initGUI(); } private JFXPanel holder; private Scene interior; private ProgressBar progressBar; private GridPane root; private void initGUI() { { holder = new JFXPanel(); setContentPane(holder); root = new GridPane(); interior = holder.getScene(); if (interior == null) holder.setScene(interior = new Scene(root)); interior.setRoot(root); } { progressBar = new ProgressBar(); progressBar.setProgress(-1); root.add(progressBar, 0, 1); } pack(); } public static void main(String[] args) { new TestDialog(null).setVisible(true); } } However, looking at the JFXPanel source code, the constructor calls its initFX() method, which initializes the FX application thread. Why, then, am I getting this error, and how do I fix it?
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26148048
accepted answer: http://stackoverflow.com/a/26146073
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/40984194
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/a/26092790
answers question: http://stackoverflow.com/q/26092768
accepted answer of: http://stackoverflow.com/q/26092768
type: Answer
upvote count: 1
has body: You could just replace the for loop with monthString = MONTHS.get(month); if (monthString == null) { throw new MonthException(); } in which then monthString would be null triggering the MonthException if the key was not found in the Map.
has comment: http://stackoverflow.com/comment/40888167
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/40791791
score: 0
comment on: http://stackoverflow.com/q/26039885
has text: What will happend when you will set `FetchMode.JOIN` for `B` as well?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26124741
tagged with: rest
upvote count: 1
favorite count: 0
has title: @PathVariable String with dot notation property not working correctly
answer count: 0
type: UnansweredQuestion
has body: I have a webservice that accepts @PathVariable String property containing dot notation. For e.g. remote.output.location, remote.output.templocation, etc. For some reason, when I send above properties from browser, the webservice only interprets first two words - i.e. remote.output for both properties. However, request parameters work fine. /webservice/prop?key=remote.output.location Using @PathVariable: /webservice/prop/remote.output.location - this doesn't work @RequestMapping(value = "/prop/{key}", method = RequestMethod.GET) public @ResponseBody String getPropertyValue(ModelMap model, @PathVariable("key") String key ) { log.info("getPropertyValue() /prop/key :"+key); return config.getProperty(key); }
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40945941

http://stackoverflow.com/comment/40952595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26128352
has text: what is the point of `end = numberInput + 2`.

http://stackoverflow.com/q/26044279
has answer: http://stackoverflow.com/a/26044319
has comment: http://stackoverflow.com/comment/40799055
upvote count: 1
has title: cannot convert from boolean to int
has answer: http://stackoverflow.com/a/26044362
linked to: http://stackoverflow.com/q/6665997
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26044362
type: Question
accepted answer: http://stackoverflow.com/a/26044319
has body: I am trying to create a program that prompts the user to enter in the weight of the package and display the cost. I am new to the switch statement, which is why I feel it may have something to do with those statements. However, I return the error "cannot convert from boolean to int". I have looked at other situations where this comes up, but have not found a solution. Using == did not change it. import java.util.Scanner; public class Exercise03_18 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the weight of the package: "); int weight = input.nextInt(); switch (weight) { case weight &lt;= 1: System.out.println("The cost is 3.5"); break; case weight &lt;= 3: System.out.println("The cost is 5.5"); break; case weight &lt;= 10: System.out.println("The cost is 8.5"); break; case weight &lt;= 20: System.out.println("The cost is 10.5"); default: System.out.println("The package cannot be shipped"); } } }
tagged with: int
tagged with: boolean
answer count: 2

http://stackoverflow.com/q/26071358
has answer: http://stackoverflow.com/a/26071885
tagged with: superclass
answer count: 6
accepted answer: http://stackoverflow.com/a/26071885
score: 0
tagged with: java
has title: How to call a Subclass as a Superclass Type
has answer: http://stackoverflow.com/a/26071664
has answer: http://stackoverflow.com/a/26071388
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26071388
has answer: http://stackoverflow.com/a/26071463
has body: i'm currently learning inheritance and I'm having some trouble understanding the concept. For the following code could someone tell me why I can't declare a subclass of type Superclass? public class Test{ public static void main(String[] args){ Superclass myA = new Superclass(); Superclass myB = new Subclass(); } public class Superclass{ private string a; public Superclass() { a=""; } public void setA(String userA) { a = userA; } } public class Subclass extends Superclass{ private String b; public Subclass() { b = ""; } public void setB(String userB) { b = userB; } public void display() { System.out.print(b) } } myA doesnt give me any problems, but myB does. I want to be make an array of lets say Superclass, but I want to be able to use the Subclass.Something like this Superclass[] X = new Superclass[2]; x[0] = new Subclass(); X[0].setB("hello"); X[0].display();
has answer: http://stackoverflow.com/a/26071563
has answer: http://stackoverflow.com/a/26072267
type: Question

http://stackoverflow.com/comment/40961878
comment on: http://stackoverflow.com/q/26133637
has text: I installed the package `xlsx`, what is the other package?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26054580
downvote count: 1
has answer: http://stackoverflow.com/a/26054793
has answer: http://stackoverflow.com/a/26056534
favorite count: 0
has answer: http://stackoverflow.com/a/26092857
type: UnansweredQuestion
tagged with: spring
answer count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/40817606
tagged with: birt
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40817778
score: -1
type: Question
has comment: http://stackoverflow.com/comment/40817536
has answer: http://stackoverflow.com/a/26058008
tagged with: primefaces
has body: Hi am developping a java web project with spring mvc and hibernate. I have a list of cars in carList. Now I want to retrieve the car type of each car. So I initialise another list carType. and then loop into carList and append the car type in the list of carType. When i output the value store in carType, it gives [Ljava.lang.Object;@255a8ce4. Can someone help me? The type of list should be object. Because I am sending this list to birt reporting to display in pdf. List&lt;Object&gt; carList=getCarService().retrieveAllCarsAssignedToManagers(CarNo, DeptNo); List&lt;Object&gt; carType = new ArrayList&lt;Object&gt; (); for (Object carLists:carList) { carType.add(getcarService().retrieveAllCarType(Integer.valueOf(carLists.toString()))); } for (int i = 0;i &lt; carType.size(); i++) { System.out.println("Cars: " + carType.get(i)); }
has comment: http://stackoverflow.com/comment/40817503
has comment: http://stackoverflow.com/comment/40817683
has comment: http://stackoverflow.com/comment/40817437
has title: Issue converting java.lang.object to Integer
has comment: http://stackoverflow.com/comment/40817721

timer
tag name: timer
tags question: http://stackoverflow.com/q/26103121
tags question: http://stackoverflow.com/q/26187167
tags question: http://stackoverflow.com/q/26078385
type: Tag
tags question: http://stackoverflow.com/q/26174725
tags question: http://stackoverflow.com/q/26141007
tags question: http://stackoverflow.com/q/26124021
tags question: http://stackoverflow.com/q/26050410
tags question: http://stackoverflow.com/q/26085234
tags question: http://stackoverflow.com/q/26109678
tags question: http://stackoverflow.com/q/26043783
tags question: http://stackoverflow.com/q/26127488
tags question: http://stackoverflow.com/q/26192336
tags question: http://stackoverflow.com/q/26165506
tags question: http://stackoverflow.com/q/26106297
tags question: http://stackoverflow.com/q/26076981
tags question: http://stackoverflow.com/q/26067155
tags question: http://stackoverflow.com/q/26126284
tags question: http://stackoverflow.com/q/26127943

http://stackoverflow.com/q/26169323
tagged with: eclipse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41027966
has title: GeoQuiz Android App does not run
has body: My code isn't running on my phone. I get the following error. Error: adev_set_parameters: ERROR: set param called even when stream out is null Error: W/virtual loc_api_adapter_err LocApiV02::injectPosition(double, double, float):496]: error! status= eLOC_CLIENT_FAILURE_INVLAID_PARAMETER, inject_pos_ind.status = eQMI_LOC_SUCCESS_V02 I am using eclipse and android 4.2 moto x. I am trying to make a basic quiz game that asks the user to select true or false. Upon answering, the result should be displayed on screen. https://i.sstatic.net/8YIr1.png https://i.sstatic.net/XK4hx.png
has answer: http://stackoverflow.com/a/27043614
has comment: http://stackoverflow.com/comment/41028714
tagged with: android
has comment: http://stackoverflow.com/comment/41032522
has comment: http://stackoverflow.com/comment/41028165
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27043614
type: Question

http://stackoverflow.com/comment/40871954
score: 1
has text: `setPreferredSize(new Dimension(300, 300));` See [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
comment on: http://stackoverflow.com/a/26084135
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26193509
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26193469
accepted answer of: http://stackoverflow.com/q/26193469
has body: You're never calling the AlmostThere() method. That's what's going to print out everything for you. At the end of your main() method do something like: AlmostThere(Hourss, Minutess);
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41072758
score: 1

http://stackoverflow.com/comment/40937618
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26120734
has text: it still hasn't answered my question, how would both have access to the session token?

http://stackoverflow.com/a/26231332
has comment: http://stackoverflow.com/comment/41281559
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/26170289
type: Answer
accepted answer of: http://stackoverflow.com/q/26170289
downvote count: 0
has body: If keys in your Map is String than to get an element you must query it with String value. Your current solution queries a Map with Long value. You can convert number to String and then query a Map like this: &lt;c:set var="numberAsString"&gt;${50 - 1}&lt;/c:set&gt; &lt;c:out value="value: ${hashtableObj[numberAsString]}"/&gt;
score: 1

http://stackoverflow.com/a/26085405
has body: You can use java.util.Collections.frequency: int count = Collections.frequency(timeTable, value); Edit: answer to your last question in comment: Surely there is a quick simple way to say this value occurred 3 times in the arraylist?
has comment: http://stackoverflow.com/comment/40874360
upvote count: 1
answers question: http://stackoverflow.com/q/26085295
accepted answer of: http://stackoverflow.com/q/26085295
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40874244

http://stackoverflow.com/comment/41044700
type: Comment
has text: I think you're looking at the wrong place, or generating things incorrectly. .asmx files are .NET files, not Java files. What are you using to generate the classes?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26177855

http://stackoverflow.com/q/26051702
type: Question
has title: How to make use of external JavaScript source file in JSP through simple java class
tagged with: jsp
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/40820106
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18784920
has comment: http://stackoverflow.com/comment/40819966
has comment: http://stackoverflow.com/comment/40820528
tagged with: java
has comment: http://stackoverflow.com/comment/40818166
has body: I am creating one project in which I am making call to a JavaScript function which resides in index.jsp from my java class ( .java file). As in this context we shouldnt write &lt;script&gt; tag in our index.jsp, what should I do if I want to make use of some dependent .js file like stomp.js source file in my index.jsp file??

http://stackoverflow.com/comment/40876271
type: QuestionComment
has text: The method call, ``numberOfNodeAtLevel("hi",0,2);``, does not meet the signature of the method: ``public double numberOfNodeAtLevel(TreeNode node, double current,double desired)``
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26086535

http://stackoverflow.com/a/26133915
score: 6
type: Answer
downvote count: 0
has body: You need to set the FolderId of the folder your saving the sent copy to so it reflects the Mailbox your sending as eg change replymessage.sendAndSaveCopy(WellKnownFolderName.SentItems); to FolderId SentFolderForUser = new FolderId(WellKnownFolderName.SentItems, fromEmailAddress); replymessage.sendAndSaveCopy(SentFolderForUser); Cheers Glen
has comment: http://stackoverflow.com/comment/46613827
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26121609
answers question: http://stackoverflow.com/q/26121609
has comment: http://stackoverflow.com/comment/46570700

http://stackoverflow.com/comment/40859129
has text: Well, you're using an smtp server (smtp.gmail.com) that is not accessible from your company network. Either ask your company to make it accessible, or use another smtp server, that is accessible from the network.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26077297

http://stackoverflow.com/a/27943091
has comment: http://stackoverflow.com/comment/44321512
has comment: http://stackoverflow.com/comment/58977919
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44331583
score: 8
has body: Basically this can occur if the thread where you ask FindClass is not the main thread and in your thread system does not build a map of java class IDs. Check this out, probably you have to ask FindClass first in the main thread (when JNI loads or somewhere else), and then you will have ability to do that in any thread. http://discuss.cocos2d-x.org/t/jni-findclass-cannot-find-a-class-if-its-called-by-a-new-pthread/1873/4 Also try this out, this worked for me: https://svn.apache.org/repos/asf/mesos/branches/0.10.x/src/java/jni/convert.cpp The solution (taken from link above) is finding a Java class loader from your app in JNI_OnLoad and ask him to find class then from any thread. Otherwise, after calling env-&gt;FindClass JNI can fall back to the system class loader which loads only system classes like String.
upvote count: 8
answers question: http://stackoverflow.com/q/26100902
type: Answer
accepted answer of: http://stackoverflow.com/q/26100902
has comment: http://stackoverflow.com/comment/44321322

http://stackoverflow.com/q/26179346
tagged with: android
has comment: http://stackoverflow.com/comment/41048927
has title: Android Java saving to file returning IOException
tagged with: java
tagged with: save
score: 0
type: Question
has body: i know there's probably tons of these going around (and believe me i went through a lot when trying to get this right) but i cannot seem to get this going. I'm trying to save a list of custom objects (cars) into a file on local storage and later on load them back by clicking a button. I've been trying to use the FileOutputStream based on many sources i've read. of some reason this worked fine when tested using simple list of strings but when it comes to my self made objects i keep getting IO exception when trying to save. if anyone can take a look at my code and tell me what am i missing (spent over 20hr trying to sort this one myself with no luck). P.S - saving and loading methods are being called by buttons which work fine so code was neglected. public class Main extends Activity implements OnClickListener{ public static List&lt;Car&gt; carList = new ArrayList&lt;Car&gt;(); String FILENAME = "carListFile"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button buttonView_saveb; Button buttonView_loadb; buttonView_saveb = (Button)findViewById(R.id.saveb); buttonView_loadb = (Button)findViewById(R.id.loadb); buttonView_saveb.setOnClickListener(this); buttonView_loadb.setOnClickListener(this); @Override public void onClick(View view){ switch (view.getId()){ case R.id.saveb: SaveData(); break; case R.id.loadb: LoadData(); break; } } public void LoadData(){ ArrayList&lt;car&gt; toReturn; FileInputStream fis; try { fis = openFileInput(FILENAME); ObjectInputStream oi = new ObjectInputStream(fis); toReturn = (ArrayList&lt;Car&gt;) oi.readObject(); oi.close(); } catch (FileNotFoundException e) { System.out.println("Failed to load, file '"+FILENAME+"' not found"); } catch (ClassNotFoundException e) { System.out.println("Failed to load from file '"+FILENAME+"', Class not found"); } catch (IOException e) { System.out.println("Failed to load from file '"+FILENAME+"', I/O Exception") } } // this m…
has comment: http://stackoverflow.com/comment/41046543
has answer: http://stackoverflow.com/a/26180891
has comment: http://stackoverflow.com/comment/41046641
answer count: 1
tagged with: load
has comment: http://stackoverflow.com/comment/41048783
has comment: http://stackoverflow.com/comment/41047638
type: UnansweredQuestion

http://stackoverflow.com/comment/40884265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26090789
has text: What are you trying to achieve, what is the stack trace of the exception?
score: 0

http://stackoverflow.com/comment/40990731
has text: checked now: it tries to create is on c:\myApacheServer\bin\src\SavedGames
comment on: http://stackoverflow.com/q/26149080
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26059923
has answer: http://stackoverflow.com/a/26060289
accepted answer: http://stackoverflow.com/a/26060289
tagged with: flyway
tagged with: jpa
answer count: 1
favorite count: 0
has title: Use of Hibernate and flyway in a production system
has body: I've been looking into the using hibernate for a project at work. It looks like it does what we want for generating a database for a given set of classes. However, it appears to be strongly discouraged against using hbm2ddl.auto=update in a production environment. Looking around, I can't see what people do for this situation. Once the database is populated and in use, we will want to add/update extra persistent classes into the databases, without using the unreliable hibernate update. Flyway looks like it would be useful to handle the database schema update, but this still requires us to manually create upgrade script every time we make any code changes. Is there an easy way to solve this problem automatically? I can't really see the point of hibernate if it's not good enough for updating in a live environment. Am I missing something?
type: AnsweredQuestion
downvote count: 0
score: 6
type: Question
tagged with: java
tagged with: hibernate
upvote count: 6
has comment: http://stackoverflow.com/comment/40827940

http://stackoverflow.com/comment/40888223
type: QuestionComment
comment on: http://stackoverflow.com/q/26092773
has text: Did you see the answer at http://stackoverflow.com/questions/21204350/sonar-setup-undefined-mandatory-properties? It looks like the same problem you are having.
score: 0
type: Comment

http://stackoverflow.com/a/26098431
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26098174
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26098174
has body: You could the save the position of the ball and racket in the outstate so in the activity: @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); //If it is an integer outState.putInt(TAG, mBallPosition); //Or use a serializable if you wish to store an actual object outState.putSerializable(TAG, mBallPosition); } Then in your onCreate method you can restore the states : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { int position = savedInstanceState.getInt(TAG,0); //set ball position //or get the object back using outstate.getSerializable(TAG) } }

http://stackoverflow.com/comment/41002146
comment on: http://stackoverflow.com/a/26155339
type: Comment
has text: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.adtproduct -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.6 -vm <PATH>\bin -XX:MaxPermSize=256m -Xms512m -Xmx1024m
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40818585
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26055187
has text: actually i will put value on the table.

http://stackoverflow.com/comment/40884148
has text: Not a bad idea, except for when you need to index the integers. You would need a collection for both strings and integers. But it's great for removing the overhead of future calls to getInstructionsAsDataType(). He did say he was new to Java, but I don't know if he is new to object-oriented programming in general. I think he's just asking the Java community here if there is a better alternative to what he is doing. `What's the best way to do that?` But I could be wrong.
type: AnswerComment
comment on: http://stackoverflow.com/a/26090236
score: 0
type: Comment

http://stackoverflow.com/comment/41030897
type: Comment
type: QuestionComment
score: 1
has text: `client` is equal to `null`, and then you're trying to access `client.resttemplate` right after you make the `Spring client = null;` statement.
comment on: http://stackoverflow.com/q/26169515

http://stackoverflow.com/q/26039920
tagged with: jboss
type: Question
has title: Is it possible to disable RoleBasedSecurityFilter.java of RESTEasy?
downvote count: 0
tagged with: security
tagged with: rest
has answer: http://stackoverflow.com/a/26541292
answer count: 1
favorite count: 0
tagged with: resteasy
upvote count: 2
linked to: http://stackoverflow.com/q/25851374
type: UnansweredQuestion
score: 2
has body: I am developing a Web application which uses JBoss RESTEasy (resteasy-jaxrs-3.0.8) but I want to disable the RoleBasedSecurityFilter.java and only use my own custom SecurityInterceptor class (which also implements javax.ws.rs.container.ContainerRequestFilter just as the RoleBasedSecurityFilter class does, so they are both security filters). The reason for this is that line 43 in RoleBasedSecurityFilter.java calls a isUserInRole() method, which always returns false in my application. And as result a ForbiddenException gets thrown, which prevents the user from accessing resources he should have access to. I really like being able to use the @RolesAllowed annotation to declare which roles have access to certain functionalities, but as explained, the RoleBasedSecurityFilter class is blocking this. So my question is, does anyone know how to disable one specific RESTEasy filter (i.e. RoleBasedSecurityFilter)? I'd imagine that it might be done in the deployment descriptor (web.xml) (for example with a context-param element), but I have no clue how to actually disable the filter. I realize I could also change the line in the RoleBasedSecurityFilter.java file in the RESTEasy library I am using, but that approach is too hacky for me as I don't want to be stuck having to apply this hack again everytime I would upgrade my RESTEasy version. (not sure how often that would be though..)
tagged with: java

http://stackoverflow.com/a/26123033
type: Answer
has body: How to convert from DBObject to your model object? This is one way where you can achieve it in a simplified manner: Make your class extend BasicDBObject, with a parameterized constructor. class Model extends BasicDBObject { public Model(DBObject object) { super(object.toMap()); } } Setting values in a Model. Model model = new Model(); model.put("key","value"); Inserting a Model into the database. dbCollection.insert(model); Retrieving a Model from the database. while(cursor.hasNext()){ DbObject obj = cursor.next(); Model model = new Model(obj); //do something with the Model }
answers question: http://stackoverflow.com/q/26122332
score: 0
has comment: http://stackoverflow.com/comment/41003255

http://stackoverflow.com/comment/40809656
type: QuestionComment
type: Comment
has text: Do you want to know where all the method is being called ?
comment on: http://stackoverflow.com/q/26050157
score: 0

http://stackoverflow.com/comment/41006197
type: QuestionComment
has text: Well I wonder how am I supposed to get rid off the loaded data into Strings? Is there anyway to destrcut the created objects in java?
comment on: http://stackoverflow.com/q/26156360
score: 0
type: Comment

http://stackoverflow.com/a/26098803
has comment: http://stackoverflow.com/comment/40898383
type: Answer
has comment: http://stackoverflow.com/comment/40898457
has body: You may check how you can use @JoinColumn to solve your problem.
score: 0
answers question: http://stackoverflow.com/q/26098003

http://stackoverflow.com/q/26066098
answer count: 2
tagged with: mobile
has body: I downloaded a project from GitHub. When i tried to check its source its gives WheelView error.. WheelView is not importing in it.. Calendar calendar = Calendar.getInstance(); final WheelView month = (WheelView) findViewById(R.id.month); final WheelView year = (WheelView) findViewById(R.id.year); final WheelView day = (WheelView) findViewById(R.id.day); OnWheelChangedListener listener = new OnWheelChangedListener() { public void onChanged(WheelView wheel, int oldValue, int newValue) { updateDays(year, month, day); } WheelView is not importing, i don't know how to import the WheelView and from Which API in this project? This is the link below from where i get the project https://github.com/abodehq/Hijri-Calendar
tagged with: android
has answer: http://stackoverflow.com/a/26096835
has title: WheelView not found in Android
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26096835
tagged with: java
possible better answer: http://stackoverflow.com/a/26066138
has answer: http://stackoverflow.com/a/26066138
type: Question

http://stackoverflow.com/q/26139463
has answer: http://stackoverflow.com/a/26139578
favorite count: 0
has body: System.out.println("Input String length : " + str.length()); System.out.println("SWB==="+sw.getTime()); byte[] bytes = Base64.decodeBase64(str); System.out.println("SWB==="+sw.getTime()); GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); BufferedReader bf = new BufferedReader(new InputStreamReader(gis)); String outStr = ""; String line; while ((line=bf.readLine())!=null) { outStr += line; } System.out.println("SWB==="+sw.getTime()); System.out.println("Output String lenght : " + outStr.length()); The above code prints SWB===1 SWB===4 SWB===27052 Output String lenght : 1750825 But the compression of the same string takes quite short time (less than 100ms). What am i doing wrong here ? (other than my bad way of debug comments)
linked to: http://stackoverflow.com/q/10572398
has comment: http://stackoverflow.com/comment/40972271
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40972174
downvote count: 0
tagged with: java
tagged with: compression
type: Question
tagged with: gzipinputstream
tagged with: gzip
accepted answer: http://stackoverflow.com/a/26139578
upvote count: 2
has title: Why GZIPInputStream takes quite long time?
tagged with: gzipstream
answer count: 1

http://stackoverflow.com/comment/40812174
type: Comment
score: 0
has text: I think you simply want a comma in your assertTrue() call. Not `assertTrue("blah" + arrayEquals(blah))` but instead `assertTrue("blah", arrayEquals(blah))`
type: QuestionComment
comment on: http://stackoverflow.com/q/26050559

http://stackoverflow.com/a/26037180
type: Answer
answers question: http://stackoverflow.com/q/26037098
upvote count: 1
has body: My suggestion is you can use Stored procedure. or use can use batch wise update instead of this. More about sql batch update.
score: 1
downvote count: 0

http://stackoverflow.com/comment/40988631
type: AnswerComment
comment on: http://stackoverflow.com/a/26147883
type: Comment
has text: Are you using eclipse, netbeans, command prompt?
score: 0

http://stackoverflow.com/comment/40872367
type: QuestionComment
score: 2
has text: What is your goal in doing that?
comment on: http://stackoverflow.com/q/26084436
type: Comment

http://stackoverflow.com/a/26127954
has body: When you compiled A it has a reference to B so it had to compile that as well. A doesn't know about C so it doesn't compile that. I suggest you use an IDE or a build tool such as maven as you will get much more complex project that this and this will become a nightmare trying to keep track of which files need to be recompiled when you change a file.
type: Answer
accepted answer of: http://stackoverflow.com/q/26127893
upvote count: 2
answers question: http://stackoverflow.com/q/26127893
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41121165
comment on: http://stackoverflow.com/q/26185066
type: Comment
type: QuestionComment
has text: You can propose an edit for your original post if your rep isn't high enough. A separate post will just get closed as a duplicate.
score: 0

http://stackoverflow.com/comment/40832115
has text: `^[a-zA-Z][0-9]{6}[a-zA-Z]$`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26062384

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26100947
type: Tag
tags question: http://stackoverflow.com/q/26083708

http://stackoverflow.com/q/26192643
accepted answer: http://stackoverflow.com/a/26192730
has comment: http://stackoverflow.com/comment/41071022
answer count: 2
upvote count: 0
has title: Error in program
favorite count: 0
type: AnsweredQuestion
score: -5
has answer: http://stackoverflow.com/a/26192781
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26192730
possible better answer: http://stackoverflow.com/a/26192781
has body: //This program determines if the input string is a palindrome import java.util.*;//importing all the methods from java.util class import static java.lang.System.out; public class Pallindrome { public static void main(String[] args) { @SuppressWarnings("resource") Scanner input= new Scanner(System.in); String pallindrome; out.println("Enter a string: "); pallindrome= input.nextLine(); ArrayList&lt;String&gt; pall= new ArrayList&lt;String&gt;(); buildAL(pall, pallindrome); display(pall); if(isPalendrome(pall)) out.println(pallindrome + " is a pallindrome"); else out.println(pallindrome + " is not a pallindrome"); } static void display(ArrayList&lt;String&gt; arr1){ //this method is for displaying the array list for(int i=0; i&lt;arr1.size();i++) out.print(arr1.get(i)); out.println(); } static void buildAL(ArrayList&lt;String&gt; arr2, String word){ //this is for building the array with the entered word for(int i=0;i&lt;arr2.size();i++) arr2.add(word.charAt(i)+ ""); } static Boolean isPalendrome(ArrayList&lt;String&gt; arr3){ //it will test if the word is pallindrome ArrayList&lt;String&gt; rarr3= new ArrayList&lt;String&gt;(); rarr3.addAll(arr3); Collections.reverse(rarr3); for(int i=0;i&lt;rarr3.size();i++) if(!(rarr3.get(i).equals(arr3.get(i)))) return false; return true; } } When I run this code it shows the same output. please point out the error.
downvote count: 5

http://stackoverflow.com/q/26106557
type: Question
has answer: http://stackoverflow.com/a/26107300
tagged with: enums
has answer: http://stackoverflow.com/a/54023983
upvote count: 6
has body: I need to get data from database by enum type. I have following enum: public enum ShopType { VANS("VANS"), ATTICUS("ATTICUS"), FAMOUS("FAMOUS") ShopType(String label) { this.label = label; } private String label; public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } } In my DAO class i have method which returns list of objects by selected type on jsp page. On jsp page i send selected value like String, is it right? That how looks my method @Transactional public List&lt;Shop&gt; findByType(String type) { return sessionFactory.getCurrentSession().createQuery("from Shop where type=" + ..... .list(); } I don't know how to create right query. Enum i store in my database like tinyint. Here is a model. @Column(name = "type") @Enumerated(EnumType.ORDINAL) private ShopType type;
possible better answer: http://stackoverflow.com/a/54023983
has title: How to query using an Enum parameter mapped as ORDINAL using JPA and Hibernate
has answer: http://stackoverflow.com/a/26107167
answer count: 3
accepted answer: http://stackoverflow.com/a/26107167
tagged with: jpa
favorite count: 0
tagged with: hibernate-mapping
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
score: 6

http://stackoverflow.com/a/26115519
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41088275
has body: jjs is just the name of a command-line tool, distributed with the JDK, that invokes Nashorn. See the Java Platform Tools Reference for details.
answers question: http://stackoverflow.com/q/26114978
type: Answer
accepted answer of: http://stackoverflow.com/q/26114978
has comment: http://stackoverflow.com/comment/41088205
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41088031

http://stackoverflow.com/q/26176327
tagged with: java
type: Question
has title: Font is abstract ; Cannot be instantiated
score: 0
has body: Im trying to make some text bold in a JTable with jtable.setFont(new Font("Serif", Font.BOLD, 12)); However its throwing an error saying "Font is abstract ; Cannot be instantiated" Im literally following a tutorial and its saying it should work What else in my program could be affecting it? Thanks
answer count: 1
accepted answer: http://stackoverflow.com/a/26176358
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26176358
tagged with: fonts

http://stackoverflow.com/q/26193144
answer count: 1
downvote count: 0
has title: ANTLR4 project wont display anything in Eclipse
accepted answer: http://stackoverflow.com/a/26215390
favorite count: 0
tagged with: antlr4
tagged with: parser-generator
upvote count: 1
type: AnsweredQuestion
tagged with: lexer
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26215390
has body: Working from the book "The Definitive ANTLR 4 Reference," I'm trying to run the ArrayInit.g4 example in Eclipse. I've managed to generate the necessary java files and others, but when I run the example and enter values into the console and hit Enter, nothing happens (pages 29 and 30). ArrayInit.g4 /** Grammars always start with a grammar header. This grammar is called * ArrayInit and must match the filename: ArrayInit.g4 */ grammar ArrayInit; @header { package com.foo.bar; } /** A rule called init that matches comma-separated values between {...}. */ init : '{' value (',' value)* '}' ; // must match at least one value /** A value can be either a nested array/struct or a simple integer (INT) */ value : init | INT ; // parser rules start with lowercase letters, lexer rules with uppercase INT : [0-9]+ ; // Define token INT as one or more digits WS : [ \t\r\n]+ -&gt; skip ; Main.java package com.foo.bar; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.tree.*; public class Main { public static void main(String[] args) throws Exception { // create a CharStream that reads from standard input ANTLRInputStream input = new ANTLRInputStream(System.in); // create a lexer that feeds off of input CharStream ArrayInitLexer lexer = new ArrayInitLexer(input); // create a buffer of tokens pulled from the lexer CommonTokenStream tokens = new CommonTokenStream(lexer); // create a parser that feeds off the tokens buffer ArrayInitParser parser = new ArrayInitParser(tokens); ParseTree tree = parser.init(); // begin parsing at init rule // Create a generic parse tree walker that can trigger callbacks ParseTreeWalker walker = new ParseTreeWalker(); // Walk the tree created during the parse, trigger callbacks walker.walk(new ShortToUnicodeString(), tree); System.out.println(); // print a \n after translation } } Entered into console: {99, 3, 451} Expected output: "\u0063\u0003\u01c3"

http://stackoverflow.com/comment/40785576
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26035496
has text: sorry, I am not able to get...where can i download it?
type: Comment

http://stackoverflow.com/comment/40992947
has text: @AleksG I feel stupid now, I had same code typed up, but I didn't have the true, why is that?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26150035

http://stackoverflow.com/a/26048888
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40844154
type: Answer
accepted answer of: http://stackoverflow.com/q/26045233
answers question: http://stackoverflow.com/q/26045233
downvote count: 0
score: 1
has body: Hi i was doing a little of research of Locale class and take a look fo this: public String getDisplayCountry(Locale inLocale) Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and inLocale is fr_FR, getDisplayCountry() will return "Etats-Unis". If the name returned cannot be localized according to inLocale. (say, we don't have a Japanese name for Croatia), this function falls back on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string. Will return the English name.
has comment: http://stackoverflow.com/comment/40827567
has comment: http://stackoverflow.com/comment/40827390
has comment: http://stackoverflow.com/comment/40830683

http://stackoverflow.com/q/26068553
has answer: http://stackoverflow.com/a/26068659
tagged with: image-rotation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26068659
tagged with: java
score: 0
has body: i have made a game with a spaceship but i have a problem with moving of it. this is the script: public class spaceship { private final local_client local_client; private final int startX; private final int startY; private final int startR; private double x,y,r; public static double rotation; public static double velo; public static AffineTransform at; public spaceship(local_client local_client,int startX,int startY,int startR) { this.local_client = local_client; this.startX = startX; this.startY = startY; this.startR = startR; x=200; y=200; r=90; } public void drawImage(Graphics2D g2d) { g2d.drawImage(local_client.spaceship_img,200,200, local_client.game); at = g2d.getTransform(); at.translate(x , y); at.rotate(Math.toRadians(r)); at.translate(-(local_client.spaceship_img.getWidth()/2),-(local_client.spaceship_img.getHeight()/2)); System.out.println(at.getTranslateX() + " - " + at.getTranslateY()); g2d.setTransform(at); g2d.drawImage(local_client.spaceship_img,0,0, local_client.game); } So with this script i can rotate image (see the screen): http://gyazo.com/c982b17afbba8cdc65e7786bd1cbea47 My problem is that if i increment X or Y move on the normal axis (screen) : http://gyazo.com/1fb2efb5aff9e95c56e7dddb6a30df4a and not in diagonal
type: Question
tagged with: affinetransform
has title: Java game rotate image and axis
answer count: 1

http://stackoverflow.com/a/26097054
type: Answer
answers question: http://stackoverflow.com/q/26084657
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40895639
has comment: http://stackoverflow.com/comment/40895398
upvote count: 1
type: AcceptedAnswer
has body: You can use Hibernate event listeners: Check how to add event listeners to your Session Factory. You can listen on entity persist/merge/flush events. Because the event listener is a Spring object you can inject the reference to your singleton. Once you intercept the wanted event, you can update the singleton state with the latest updated data.
has comment: http://stackoverflow.com/comment/40896014
accepted answer of: http://stackoverflow.com/q/26084657
has comment: http://stackoverflow.com/comment/40896161
has comment: http://stackoverflow.com/comment/40895598

http://stackoverflow.com/comment/40961462
comment on: http://stackoverflow.com/q/26133363
score: 0
type: Comment
type: QuestionComment
has text: @anonmous: It does not matter if you use an iterator in `Lobby.removeGame(g);`. The important part is that the fast enum declared by `for(Game g : Lobby.games){` will not stand any modification to the array, by any method whatsoever.

http://stackoverflow.com/comment/40951719
comment on: http://stackoverflow.com/q/26128041
score: 0
type: QuestionComment
type: Comment
has text: Thanks for noticing, I just removed it, but the problem seems to still exist. Updating the question right now.

http://stackoverflow.com/comment/40881704
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26089458
type: AnswerComment
has text: Or use a `String` type, as you're not likely to do numerical manipulations with telephone numbers

http://stackoverflow.com/q/26043270
has body: I have silly question about Java (6/7/8) grammar - are those two snippets of method invocation always equivalent? with this this.myMethod(4); without this myMethod(4); Note: Of course the problem is about every number, type and combination of arguments Weaker statement: given program P, can I create program P' only by deleting this. in front of each and every method invocation? I've taken into account local classes, anonymous classes, inner classes and various inheritance but could have not find any contradiction. So i believe both snippets are actually the same. Unfortunately I can't manage to find any suitable proof (e.g. from the official grammar). Could you prove me wrong by contradiction or give me some clues for construction of the equivalence proof? Thanks a lot. EDIT: the equivalence was proven wrong (see comments below) What about the weaker statement?
has comment: http://stackoverflow.com/comment/40799808
possible better answer: http://stackoverflow.com/a/26043680
answer count: 2
tagged with: grammar
tagged with: this
has comment: http://stackoverflow.com/comment/40797675
has comment: http://stackoverflow.com/comment/40797781
has answer: http://stackoverflow.com/a/26043634
accepted answer: http://stackoverflow.com/a/26043634
favorite count: 0
tagged with: invoke
upvote count: 5
has comment: http://stackoverflow.com/comment/40797237
has comment: http://stackoverflow.com/comment/40796830
has answer: http://stackoverflow.com/a/26043680
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/40798284
type: Question
score: 5
has title: can be 'this' omitted when invoking method in Java?

http://stackoverflow.com/a/26173914
answers question: http://stackoverflow.com/q/26173887
type: Answer
has comment: http://stackoverflow.com/comment/41036718
upvote count: 1
has comment: http://stackoverflow.com/comment/41036656
score: 1
downvote count: 0
has body: You have defined averageExamScore as an integer, so integer arithmetic will be applied. e.g. 5 / 2 == 2 1 / 2 == 0 Make averageExamScore into a double, and also cast your other integers to doubles. Edit To print out do if(numStudent &gt; 0) { averageExamScore = sum/numStudent; System.out.println ("average score is " + averageExamScore ); }

http://stackoverflow.com/q/26183966
downvote count: 1
tagged with: spring-mvc
has title: Rest Service which gets details based on IP address
tagged with: java
score: -1
type: Question
tagged with: google-maps
answer count: 1
has answer: http://stackoverflow.com/a/26184132
tagged with: rest
has body: I have to write a restful web service which takes a user ip address as a input and the response output has to be the location , city , state and country and zip code. So based on the user IP address, how can i get the user details. Is there any api for that? By using google maps api , can we achieve that? I need to save those user location details in database Please help me how to approach to write a restful webservice for the above requirement? Thanks in advance..!
favorite count: 0
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26077495
score: 3
has comment: http://stackoverflow.com/comment/40859868
upvote count: 3
answers question: http://stackoverflow.com/q/26077297
accepted answer of: http://stackoverflow.com/q/26077297
type: AcceptedAnswer
has body: Check if your company's network uses a proxy. If yes, add the below code with the proxy IP:port details: properties.setProperty("proxySet","true"); properties.setProperty("socksProxyHost","(proxy IP)"); properties.setProperty("socksProxyPort","(proxy port)"); Sample below: properties.setProperty("proxySet","true"); properties.setProperty("socksProxyHost","192.168.155.1"); properties.setProperty("socksProxyPort","1080");
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40887739
score: 0
type: AnswerComment
has text: its worked successfully for me, if this code is not working for you, check your jar files and its versions.
type: Comment
comment on: http://stackoverflow.com/a/26092701

http://stackoverflow.com/q/26037324
accepted answer: http://stackoverflow.com/a/26084906
answer count: 2
linked to: http://stackoverflow.com/q/26065611
score: 0
has body: How to request by date using SolrJ? I get as a parameter a date in this format '01/10/2014'. Then I convert this format to a Date object and convert the object to a UTC format. Here is a code example of what I am doing : public class DateHelper { public static final String DD_MM_YYYY_FORMAT = "dd/MM/yyyy"; public static final String SOLR_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; public static Date getDateFromString(String date, String format) { if (StringUtils.isNotEmpty(date)) { try { return FastDateFormat.getInstance(format).parse(date); } catch (ParseException e) { LOGGER.error(e.getMessage()); } } return null; } public static String getStringFromDate(Date date, String format) { if (date != null) { try { return FastDateFormat.getInstance(format).format(date); } catch (Exception e) { LOGGER.error(e.getMessage()); } } return ""; } public static void main(String...args){ Date dateFromString = DateHelper.getDateFromString('01/10/2014', DateHelper.DD_MM_YYYY_FORMAT); String date = DateHelper.getStringFromDate(dateFromString, DateHelper.SOLR_DATE_FORMAT); System.out.println(date); } } This small program displays '2014-10-01T00:00:00Z'. When I try to submit this date in Solr using a filter query, I receive this error from Sorl : org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Invalid Date String:'2014-10-01T00' Here is my Solr query : SolrQuery solrQuery = new SolrQuery("*:*"); String date = String.format( "date:%s",dateInput); query.addFilterQuery(date); getSolrServer().query(solrQuery, METHOD.POST); How can I solve this problem? THx for your help. P.S : The class FastDateFormat is from Apache Commons Lang 3. I am using solr version 4.8.1.
tagged with: solrj
has answer: http://stackoverflow.com/a/26084906
tagged with: solr
has answer: http://stackoverflow.com/a/26037561
type: AnsweredQuestion
has title: Solrj Date request
possible better answer: http://stackoverflow.com/a/26037561
tagged with: java
tagged with: date
type: Question

http://stackoverflow.com/comment/41081898
has text: I don't see the ios Base64 encoding.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26182593
type: Comment

http://stackoverflow.com/comment/41062972
has text: Try formatting the code and indenting it. You're missing a closing curly brace for the 'do' statement. Also, what are the errors?
comment on: http://stackoverflow.com/q/26187870
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40865229
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26080498
has text: Thanks for the help, appreciate it!
score: 0

http://stackoverflow.com/q/26097679
score: -1
answer count: 1
tagged with: url
favorite count: 0
tagged with: java-ee-7
has body: I am java developer. Are there any standard tools for URL normalization and standardization? URL normalization (or URL canonicalization) is the process by which URLs are modified and standardized in a consistent manner. The goal of the normalization process is to transform a URL into a normalized or canonical URL so it is possible to determine if two syntactically different URLs are equivalent.
type: AnsweredQuestion
tagged with: java
has title: Standard tools for URL normalization and standardization?
has answer: http://stackoverflow.com/a/26097841
accepted answer: http://stackoverflow.com/a/26097841
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/comment/40877495
has text: @MennoGouw clarify meaning of afaik plz?
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26087061

http://stackoverflow.com/comment/41042659
comment on: http://stackoverflow.com/a/26171947
has text: @Alexander `input.next()` takes the next string, not necessarily representing an `int`. That's the difference: `nextInt` will not take anything unless the user typed a sequence of digits, while `next` will take whatever is there. The reason there's no variable to assign it to is that I do not need to use the string returned by `next()` - I know it's not an `int`, so I want to discard it right away.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26175034
accepted answer: http://stackoverflow.com/a/26175052
tagged with: https
type: Question
answer count: 2
tagged with: apache
has comment: http://stackoverflow.com/comment/41038832
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/26175275
score: 0
has answer: http://stackoverflow.com/a/26175275
has body: I have java web application which is running on several tomcats behind apache. Application use HTTPS protocol. Some pages from the app include images from sites which use only HTTP protocol. On pages with this images the client's web browser shows message (warning) that despite service is certified correctly some contents are not secure. What should I do to avoid this message? Should I use some proxy for this images? Can I do something in java code? Thanks in advance.
has answer: http://stackoverflow.com/a/26175052
type: AnsweredQuestion
has title: How to avoid web browser warning when my site use HTTPS protocol, and it's pages include images from sites without HTTPS?
tagged with: java

http://stackoverflow.com/comment/40887233
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26089211
has text: I don't want the view to have the width of it's parent, i've edited with a screenshot of the result.
type: Comment

http://stackoverflow.com/comment/85933077
type: QuestionComment
comment on: http://stackoverflow.com/q/26052623
has text: I have the similar problem and I am using log4j2, how to apply LevelRangeFilter in log4j2 xml configuration
score: 0
type: Comment

http://stackoverflow.com/a/26076732
answers question: http://stackoverflow.com/q/26076542
downvote count: 0
has body: Simply do like this: Long to String long x=1411833674288L; String longToString = Long.toString(x);//or you can use String.valueOf(x); String back to Long long y = Long.parseLong(longToString); Edited note that this value exceed the limit of long data type so you should use long within its range or put L or l at the end of the value as @Rustum said in the comment
type: Answer
has comment: http://stackoverflow.com/comment/40858262
upvote count: 3
score: 3

api
tags question: http://stackoverflow.com/q/26087018
tags question: http://stackoverflow.com/q/26060322
tags question: http://stackoverflow.com/q/26075266
tags question: http://stackoverflow.com/q/26174607
tags question: http://stackoverflow.com/q/26181063
tags question: http://stackoverflow.com/q/26055767
tags question: http://stackoverflow.com/q/26171666
type: Tag
tags question: http://stackoverflow.com/q/26071166
tags question: http://stackoverflow.com/q/26126413
tag name: api
tags question: http://stackoverflow.com/q/26055220
tags question: http://stackoverflow.com/q/26058930
tags question: http://stackoverflow.com/q/26112014
tags question: http://stackoverflow.com/q/26106527
tags question: http://stackoverflow.com/q/26037422
tags question: http://stackoverflow.com/q/26149410

http://stackoverflow.com/a/26194676
answers question: http://stackoverflow.com/q/26193297
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41076252
has body: Richard's answer was what you're missing, I created the project and found this to be the problem, please update those in your Adapter class: @Override public int getCount() { return ArrayListActors.size(); } @Override public Object getItem(int i) { return ArrayListActors.get(i); } And this in your onPostExecute method: if (result != null) { actorsList.clear(); actorsList.addAll(result); adapter.notifyDataSetChanged(); } And please mark Richard's answer as correct if this works for you.
downvote count: 0
has comment: http://stackoverflow.com/comment/41076149

http://stackoverflow.com/a/26187446
answers question: http://stackoverflow.com/q/26187333
type: AcceptedAnswer
downvote count: 1
upvote count: 3
type: Answer
score: 2
has body: Declare an extra variable before using printf: String format = "%-" + dateTimeWidth + "s%" + locationWidth + "s"; System.out.printf(format, dateTime, location);
accepted answer of: http://stackoverflow.com/q/26187333

http://stackoverflow.com/a/26086349
accepted answer of: http://stackoverflow.com/q/26086298
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26086298
has comment: http://stackoverflow.com/comment/40875877
has body: In Java, primitives have no methods, only their boxed types do. If you want to get the uppercase version of a char, the Character class has a method just for that: Character.toUpperCase: firstInitial = Character.toUpperCase(firstInitial); (Do the same for lastInitial)

http://stackoverflow.com/comment/40853462
type: Comment
has text: Thanks for your efforts tho
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26073595

http://stackoverflow.com/comment/41058485
type: Comment
comment on: http://stackoverflow.com/a/26185595
score: 1
has text: Reflection should be used, when nothing else can be used. There, `Integer` may be replaced with `AtomicInteger` or OP can pass array (not so good as using just some king of mutable `Integer`, but also possible).
type: AnswerComment

http://stackoverflow.com/a/26133458
type: Answer
answers question: http://stackoverflow.com/q/26133427
has comment: http://stackoverflow.com/comment/40961714
has comment: http://stackoverflow.com/comment/40962161
has comment: http://stackoverflow.com/comment/40961767
has comment: http://stackoverflow.com/comment/40961670
score: 0
has body: Your program can't just submit a job and terminate. So, once you have submitted all the jobs, you'll have to do the following: Future&lt;Void&gt; result = threadPool.submit(new Multiplier(this.getColumnsOfRow(i), B.getRowsOfColumn(j), C, i, j)); result.get() This will ensure your code waits for the thread to complete before terminating the main thread. Also, you could take a look at CompletionService. See this for example. [Based on Edit] public Matrix multiply(Matrix B, ExecutorService threadPool) { System.out.println("In multiply.."); Matrix C = new Matrix(this.rows, B.cols); // create matrix C of appropriate size ArrayList&lt;Future&lt;?&gt;&gt; futures = new ArrayList&lt;Future&lt;?&gt;&gt;(); for (int i = 0; i &lt; C.rows; i++) { System.out.println(C.rows); for (int j = 0; j &lt; C.cols; j++) { System.out.println(C.cols); System.out.println("Here"); futures.add(threadPool.submit(new Multiplier(this.getColumnsOfRow(i), B.getRowsOfColumn(j), C, i, j))); } } for(Future&lt;?&gt; future: futures) { future.get() } return C; } This will ensure that you're waiting for the threads to complete, before you actually pull the result of multiplication. Your code might require a bit of refactoring for this.
has comment: http://stackoverflow.com/comment/40961688

http://stackoverflow.com/comment/40951520
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26127943
has text: of course don't use it .just rename to Timer1 or anything
score: 2

http://stackoverflow.com/q/26074516
downvote count: 0
has comment: http://stackoverflow.com/comment/40854207
favorite count: 0
has body: I have a simple application in struts 2 that allows the user to input the name and submitted.In the server side in struts 2 action class a new session is created and stored the value of username in the session.In the user.jsp I tried to display the value stored in session but it is not displaying anything. The code for Index.jsp is given below The code in struts.xml is given below user.jsp The code in hart.test.Welcome is given below public class Welcome extends ActionSupport { private String user; public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String execute() { HttpServletRequest request = ServletActionContext.getRequest(); HttpSession session=request.getSession(); //Checking session is new and creating a session if (session.isNew() == false) { session.invalidate(); session = request.getSession(true); } session.setAttribute("user1", user); return SUCCESS; } } The code in User.jsp is given below Welcomeee <s:property value="%{#session.user1}"/> The problem is that it is displaying only 'Welcomeee'.Can anyone please tell the reason for it
has title: Session value not displaying in jsp struts 2
has answer: http://stackoverflow.com/a/26080150
linked to: http://stackoverflow.com/q/19538970
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26078060
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26080150
possible better answer: http://stackoverflow.com/a/26078060
tagged with: jsp
tagged with: struts2
answer count: 2
has comment: http://stackoverflow.com/comment/40874516

http://stackoverflow.com/a/26122731
has comment: http://stackoverflow.com/comment/41104295
score: 0
has comment: http://stackoverflow.com/comment/40963852
type: Answer
has body: I think you are trying to make ajax call to spring services.Do something below.Pass the full URL of your backend service.Make sure that you are passing correct URL,header information and post parameters. Ext.Ajax.request({ url: 'http://ip_address:port/HelloWorld', method: 'POST', params: { id: openwindows, state: space }, scope : this, success: function(response){ var text = response.responseText; // process server response here //alert(text); console.log(text); }, failure: function ( response ) { var text = response.responseText; //alert(text); console.log(text); } });
answers question: http://stackoverflow.com/q/26122306

http://stackoverflow.com/a/26180723
score: 0
type: Answer
has body: The startup of Jetty 8 is old and now very different than Jetty 9. Important Note: Jetty 8 is soon EOL, would highly encourage upgrading to Jetty 9 pronto. For Jetty 8, the ${jetty.home} path is where everything takes place (aka your jetty-distribution directory). For Jetty 8, it looks for a ${jetty.home}/start.ini and then starts to build up the command line, xml files, properties, start.d OPTIONS declarations, etc to start your environment. For Jetty 9, this is radically different, there is a clear split between ${jetty.home} the unmodified distribution, and a new ${jetty.base} where you configure for your specific jetty instance. You can even have multiple ${jetty.base} directories for different instances. There is even support for a tiered ${jetty.base} declaration to further separate roles in an organization (ops installs jetty-dist into a common ${jetty.home}, configures a infrastructure ${jetty.base} to handle logging and monitoring, and the application is in its own ${jetty.base}, at which point all 3 are combined to form the configuration that instance uses)
answers question: http://stackoverflow.com/q/26180535

http://stackoverflow.com/q/26185826
has comment: http://stackoverflow.com/comment/41063763
downvote count: 0
has title: Java Datagram Socket.recieve() freeze
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
answer count: 0
score: 1
tagged with: java
has body: While using datagram sockets in java for a game, a very weird issue appears. I'm trying to recieve a packet on the client but nothing happens. This is not what's weird however. I have set a timeout for the socket directly in front of the socket.receive() call and it still never times out. What's even more odd is that the implementation seems to be working completely at random. Sometimes it works like a charm and a steady package exchange stream appears between the server and the client. In this case, I can see my friend walking around and he can see me as well. Sometimes however, the client completely freezes in the socket.recieve(). The server and client are run on separate threads and only handle network communications. Basically, the issue is that the client socket.receive() seems to freeze and never time out. Any ideas of what might be wrong would be greatly appreciated. The Client run() method: public void run() { try { while(running) { byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); try { System.out.println("BEFORE RECEIVE"); socket.setSoTimeout(1000); socket.receive(packet); System.out.println("AFTER RECEIVE"); }catch (SocketTimeoutException e) { if(!disconnected){ System.out.println("TIMEOUT, RESENDING"); sendData(loginPacket.getData()); } // e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } parsePacket(packet.getData(), packet.getAddress(), packet.getPort()); } }finally { System.out.println("SOCKET CLOSED"); socket.close(); } } The server run() method: public void run() { try { socket.setSoTimeout(10); while(running) { byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); try { socket.receive(packet); }catch (SocketTimeoutException e) { continue; }catch (IOException e) { e.printStackTrace(); } System.out.println("REcieve Packet: " + new String(packet.getData())); parsePacket(packet.getData(), packet.getAddress(), packet.getPort()); } }catch (SocketExcepti…
upvote count: 1
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/41062960
has comment: http://stackoverflow.com/comment/41090089
has comment: http://stackoverflow.com/comment/41099119
tagged with: udp

http://stackoverflow.com/a/26653504
score: 1
answers question: http://stackoverflow.com/q/26076613
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41910494
has body: javax.enterprise.context.SessionScoped is missing in Glassfish 4.1. It's a bug.
has comment: http://stackoverflow.com/comment/41918418
upvote count: 1

http://stackoverflow.com/q/26053490
has body: private final SimpleDateFormat gmailDateFormatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); But when i parse the date String "Thu, 25 Sep 2014 16:26:20 +0300" i get the following exception java.text.ParseException: Unparseable date: "Thu, 25 Sep 2014 16:26:20 +0300"
accepted answer: http://stackoverflow.com/a/26053567
tagged with: datetime
has comment: http://stackoverflow.com/comment/40815504
has comment: http://stackoverflow.com/comment/40815490
has answer: http://stackoverflow.com/a/26053625
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40815530
tagged with: java
possible better answer: http://stackoverflow.com/a/26053625
has answer: http://stackoverflow.com/a/26053567
type: Question
has title: Why my date is not parsing
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40815625

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/26188311
tags question: http://stackoverflow.com/q/26049904
tag name: android-actionbar
tags question: http://stackoverflow.com/q/26183228

http://stackoverflow.com/q/26119170
accepted answer: http://stackoverflow.com/a/26122355
possible better answer: http://stackoverflow.com/a/26119402
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
tagged with: jpa
has body: ERRORS INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Tue Sep 30 16:01:51 NPT 2014]; root of context hierarchy INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml] INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [datasource-tx-jpa.xml] INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring WARN : org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.info.ch17.respository.ContactRepository com.info.ch17.service.jpa.ContactServiceImpl.contactRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.info.ch17.respository.ContactRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:326) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1204) at org.springframework.beans.factory.suppo…
answer count: 2
has title: Error creating beans name with contactService and Injection of autowired dependency failed
has answer: http://stackoverflow.com/a/26122355
has answer: http://stackoverflow.com/a/26119402

http://stackoverflow.com/q/26182008
has answer: http://stackoverflow.com/a/26182060
tagged with: boolean
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/26182135
has title: Change return method from boolean to int
favorite count: 0
possible better answer: http://stackoverflow.com/a/26182073
tagged with: android
has answer: http://stackoverflow.com/a/26182073
has comment: http://stackoverflow.com/comment/41051739
has comment: http://stackoverflow.com/comment/41051594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41051579
score: 1
tagged with: java
upvote count: 1
type: Question
has body: Can i convert in some way this method from boolean to int? so when i will call the method instead return true or false i can return 1 or 0: public boolean openMode() { return Settings.System.getBoolean(contxt.getConentResolver(), Setting.System.START_METHOD, true); }
has answer: http://stackoverflow.com/a/26182135
linked to: http://stackoverflow.com/q/3793650

http://stackoverflow.com/a/26201170
type: Answer
accepted answer of: http://stackoverflow.com/q/26189268
answers question: http://stackoverflow.com/q/26189268
score: 0
type: AcceptedAnswer
has body: E and D conflict as was mentioned. D is correct (We wouldn't do it). According to E: I think that choice is not regarding the question (It's not "We would't do all of the above, to preserve encapsulation", its the opposite - "All of the above - preserve encapsulation" which is false and not related to the question therefore D is correct.

http://stackoverflow.com/comment/40865671
comment on: http://stackoverflow.com/a/26080691
type: AnswerComment
score: 0
type: Comment
has text: Yeah not allowed to change anything from the Observer class.

http://stackoverflow.com/q/26160236
score: 9
has answer: http://stackoverflow.com/a/26160506
has comment: http://stackoverflow.com/comment/41010678
answer count: 6
accepted answer: http://stackoverflow.com/a/26160289
has answer: http://stackoverflow.com/a/26160331
has answer: http://stackoverflow.com/a/26160391
has title: Difference between local variable initialize null and not initialize?
possible better answer: http://stackoverflow.com/a/26160332
favorite count: 0
has body: In Java, what is the difference and best way to do? Integer x = null; // x later assign some value. Integer y; // y later initialize and use it.
has answer: http://stackoverflow.com/a/26160332
has answer: http://stackoverflow.com/a/26160257
has comment: http://stackoverflow.com/comment/41010688
has comment: http://stackoverflow.com/comment/41010776
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26160289
tagged with: java
downvote count: 2
type: Question

http://stackoverflow.com/comment/41050745
comment on: http://stackoverflow.com/a/26181549
type: Comment
score: 0
type: AnswerComment
has text: @wrongAnswer: Generic variance doesn't distinguish between interfaces and classes.

http://stackoverflow.com/a/26219680
has body: I can't get it to run JPL on my machine anymore, but from looking at the docs you might want to use a Variable object and construct your query like your did for q3: Variable X = new Variable("X"); Query q4 = new Query("is_bigger", new Term[]{X, new Atom("ant")}); while ( q4.hasMoreElements() ) { java.util.Hashtable solution = (Hashtable) q4.nextElement(); System.out.println( "X = " + (Term) solution.get("X")); }
score: 0
has comment: http://stackoverflow.com/comment/41195855
type: Answer
has comment: http://stackoverflow.com/comment/43920179
answers question: http://stackoverflow.com/q/26180781

http://stackoverflow.com/comment/41437775
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26106671
has text: You could be right, although maybe the designers specifically want to imply the method was intentionally omitted rather than just forgotten. Anyway, you might get more traction filing a bug here: https://jira.spring.io/browse/DATAREST/
score: 0

http://stackoverflow.com/comment/40990242
has text: it looks like the dependency you are looking for ( is it hosted in an in-house repository? ) is not setup correctly the repository is returning an HTML page saying this resource is not found when you're expecting a pom or a jar file...
comment on: http://stackoverflow.com/q/26148560
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/42704185
comment on: http://stackoverflow.com/a/27067445
type: Comment
has text: Thank you for your answer. But finally I preferred the way with configuration of cache in XML-file.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26140454
favorite count: 0
has answer: http://stackoverflow.com/a/26195919
tagged with: android
has answer: http://stackoverflow.com/a/26144208
has title: Getting key/pair values from HashMap
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40973878
possible better answer: http://stackoverflow.com/a/26143907
has comment: http://stackoverflow.com/comment/40974357
tagged with: java
has answer: http://stackoverflow.com/a/26143907
accepted answer: http://stackoverflow.com/a/26195919
downvote count: 1
type: Question
has body: Let us suppose that we add a link from an RSS Feeder into a HashMap as follows. if (currentChild.getNodeName().equalsIgnoreCase("link")) { //L.m(currentChild.getTextContent()); currentMap.put("link", currentChild.getTextContent()); } In other words our HashMap containts a key/value pairs as shown... ("link",http://........), ("link",http://........), ("link",http://........) and so on.... Now I want to extract those links in the following method.. @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub } I want to open the links in WebViews. I did something similar,but was saving data like titles and links into a simple ArrayList..Now I am trying something similar with HashMaps,and I am stuck. Thank you in advance.
upvote count: 0
has comment: http://stackoverflow.com/comment/40974868
score: -1
answer count: 3

http://stackoverflow.com/comment/40782094
type: QuestionComment
has text: But it would mean two iterations, one towards the beginning of the list and another towards the end as to find it's right place among the case-insensitive strings that equals the key
comment on: http://stackoverflow.com/q/26034565
score: 0
type: Comment

http://stackoverflow.com/comment/40986484
has text: *"compare each subsequent letter to it lexicographically"* I'm pretty sure thats the part he's trying to figure out
comment on: http://stackoverflow.com/a/26147029
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40934482
score: 0
comment on: http://stackoverflow.com/q/26118736
type: Comment
type: QuestionComment
has text: then set other activity reference to GCMBaseIntentService using static method in GCMBaseIntentService.

http://stackoverflow.com/q/26049821
type: Question
has answer: http://stackoverflow.com/a/26049881
answer count: 2
downvote count: 4
upvote count: 0
has body: I just started programming and am doing pretty well but am not sure why this program has no output. Any pointers would be great, or what I am missing. Thank you so much and I'm glad to be a part of this site now. package temperature; import java.util.Scanner; public class Temperature { public static void main(String[] args) { int count; double temp, temptotal, average, farenheit, ftotal, ctotal, caverage, faverage; Scanner keyboard = new Scanner(System.in); temp = 0; count = 0; while( temp &lt;= -100.0){ System.out.println("Enter Temp in Centigrade or &lt;= -100.0 to quit: "); temp = keyboard.nextDouble(); ctotal = 0; ftotal = 0; caverage = 0; faverage = 0; farenheit = (9.0/5.0) * temp + 32.0; ctotal += temp; ftotal += farenheit; count++; if (temp &lt;= -100.0){ caverage = ctotal / count; faverage = ftotal /count; System.out.print(caverage); System.out.print(faverage); System.out.print("Average: Centigrade" +caverage); System.out.println("Average: Farenheit" +faverage); } else{ System.out.print("Temperature: F" +farenheit ); System.out.println("C " +temp); } } } }
favorite count: 0
type: UnansweredQuestion
score: -4
has title: I'm wondering why this program won't run, temperature program
tagged with: java
has answer: http://stackoverflow.com/a/26049845

http://stackoverflow.com/q/26068941
has answer: http://stackoverflow.com/a/26070571
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/26070571
tagged with: jpanel
linked to: http://stackoverflow.com/q/7229226
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40844596
tagged with: paintcomponent
favorite count: 0
has title: Java-Graphics-Importing a Background Image
has comment: http://stackoverflow.com/comment/40846726
tagged with: imageicon
linked to: http://stackoverflow.com/q/19125707
has body: I am messing with java graphics for the first time, after a lot of searching I still can not seem to successfully add in a background, I Have my background image in a seperate file, pre-drawn and i'm trying to import it into my project.... Any help would be VERY appreciated! public static void startMenu(){ ImagePanel panel = new ImagePanel(new ImageIcon("C:/Background.jpg").getImage()); // Loads the background image and stores in img object Window game = new Window(); JFrame frame = new JFrame(); JButton startButton = new JButton("Start"); //makes a button with the text Start startButton.setBounds(300, 400, 89, 23); startButton.setVisible(true); frame.getContentPane().add(startButton); frame.getContentPane().add(panel); frame.add(game); frame.pack(); frame.setTitle(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setSize(WIDTH, HEIGHT); frame.setLocationRelativeTo(null); // starts it in the center of the // screen frame.setVisible(true); game.start(); // Initialize start method } public static void startButton(){ } } class ImagePanel extends JPanel { private Image backgroundImg; public ImagePanel(String backgroundImg) { this(new ImageIcon(backgroundImg).getImage()); } public ImagePanel(Image backgroundImg) { Dimension size = new Dimension(backgroundImg.getWidth(null), backgroundImg.getHeight(null)); setPreferredSize(size); setMinimumSize(size); setMaximumSize(size); setSize(size); setLayout(null); } public void paintComponent(Graphics g) { g.drawImage(backgroundImg, 0, 0, null); } }
type: AnsweredQuestion

http://stackoverflow.com/q/26164476
has title: Eclipse Luna - Project is not showing up - Strange
tagged with: scope
score: 0
has answer: http://stackoverflow.com/a/26218850
possible better answer: http://stackoverflow.com/a/26164539
has answer: http://stackoverflow.com/a/26218661
accepted answer: http://stackoverflow.com/a/26218661
answer count: 4
has body: I just installed Luna. I imported 3 projects all went well for a while. Then I restarted eclipse and now it shows only two projects. I tried to import the missing project, but it says it already exists in the workspace. I closed all other projects and pressed Ctrl+Shift+T to see if it still shows up the types from that invisible project. Yes, it shows files from that invisible project. I opened one of the files and selected Show In Project Explorer. Nothing happens. Also, in the code when I press . after an String object, nothing shows up. Seems to be strange. Any help? Also, if I can do fresh import of all projects, that would help too. But again, I don't know why context assist is not working. I can try importing everything afresh. For this, what are all the eclipse related folders / files I need to remove? Edit this helped me with workingset / missing projects. But when I press . after an object, nothing comes up.
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26164539
has answer: http://stackoverflow.com/a/36857966

http://stackoverflow.com/a/26164030
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26163971
upvote count: 1
answers question: http://stackoverflow.com/q/26163971
has body: For debugging purposes it is better wrap original exception into new one

http://stackoverflow.com/q/26051577
has answer: http://stackoverflow.com/a/26053427
type: Question
has body: I already have the random text created but I don't know how to let people save it.
has title: How can I use an option dialog to display the random text and to ask the user if he or she wishes to save the text to a file
downvote count: 0
has comment: http://stackoverflow.com/comment/40812160
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26053427
tagged with: joptionpane
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40828755
type: QuestionComment
type: Comment
has text: Just guessing here, but it looks like a path issue. Put everything, the jars etc in your classpath and then try. Hope this helps
comment on: http://stackoverflow.com/q/26060105
score: 0

http://stackoverflow.com/comment/41003452
has text: it is easy. BufferedInputStream output = new BufferedInputStream(InputStream in);
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26155943

http://stackoverflow.com/q/26044533
accepted answer: http://stackoverflow.com/a/26125268
has body: I use Mule 3.5.0 I have a mule configuration where I accept HTTP requests, I add a SOAP header to them and I forward them to an external service and the result of that service call is returned: Since I want to see what happens I write the generated request and response messages to folders. (Requests and Responses components). For testing purposes I created a test method using the MuleClient functionality: @Test public void testOnlineServiceFlow() throws Exception { MuleClient client = new MuleClient(muleContext); MuleMessage result = client.send("http://localhost:1234/in", "&lt;acc:AccountDetailsRequest xmlns:acc=\"http://com/blog/samples/webservices/accountservice\"&gt;&lt;acc:accountNumber&gt;12345&lt;/acc:accountNumber&gt;&lt;/acc:AccountDetailsRequest&gt;", null); System.out.println(result.getPayloadAsString()); } Everything works fine and after executing my test my response message is written to the folder location by the Responses component: &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;SOAP-ENV:Header/&gt; &lt;SOAP-ENV:Body&gt; &lt;ns3:AccountDetailsResponse xmlns:ns2="http://webservices.samples.blog.com" xmlns:ns3="http://com/blog/samples/webservices/accountservice"&gt; &lt;ns3:AccountDetails&gt; &lt;ns2:AccountNumber&gt;12345&lt;/ns2:AccountNumber&gt; &lt;ns2:AccountName&gt;Joe Bloggs&lt;/ns2:AccountName&gt; &lt;ns2:AccountBalance&gt;3400.0&lt;/ns2:AccountBalance&gt; &lt;ns2:AccountStatus&gt;Active&lt;/ns2:AccountStatus&gt; &lt;/ns3:AccountDetails&gt; &lt;/ns3:AccountDetailsResponse&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; But then when my message returns in my client and I want to print it, I got following exception: org.mule.api.transformer.TransformerException: Could not read InputStream. at org.mule.transformer.simple.ObjectToString.createStringFromInputStream(ObjectToString.java:83) at org.mule.transformer.simple.ObjectToString.doTransform(ObjectToString.java:54) at org.mule.transformer.AbstractTr…
downvote count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26125268
score: 1
tagged with: java
tagged with: mule
tagged with: mule-studio
has title: Mule - MuleMessage.getPayloadString() gives me java.io.IOException: Bad chunk size
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26167968
has comment: http://stackoverflow.com/comment/41028054
tagged with: java
has comment: http://stackoverflow.com/comment/41026927
has comment: http://stackoverflow.com/comment/41025613
score: 0
has title: AsyncTask error occured while executing doInBackground()
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41027038
tagged with: android
has comment: http://stackoverflow.com/comment/41026708
tagged with: android-asynctask
type: AnsweredQuestion
tagged with: multithreading
has body: I'm getting an error in following code, calling asyn method for http request. It gives me a java.lang.RuntimeException error inside doInBackground() method. _____________MAIN class____________ TextView testoInput = (TextView) findViewById(R.id.input); final String località = testoInput.getText().toString(); bottone1.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { TaskAsincrono nuovo = new TaskAsincrono(); nuovo.execute(località); } __________ASYNC Class________ public class TaskAsincrono extends AsyncTask > { protected ArrayList&lt;String&gt; doInBackground(String...params) { String s = params[0]; ArrayList&lt;String&gt; risultato =null; //Inizio sessione di invio dati rest con sistema GET DefaultHttpClient client = new DefaultHttpClient(); String url ="http://www.replycoupon.it/php/rest_Server/index.php?nome="+s; try { URI uri = new URI(url); HttpGet get = new HttpGet(uri); HttpResponse res = client.execute(get); InputStream data = res.getEntity().getContent(); //Inizio l'operazione di buffering per la lettura BufferedReader streamReader = new BufferedReader(new InputStreamReader(data)); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr =null; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); JSONObject jObj = new JSONObject(responseStrBuilder.toString()); String clima = jObj.getString("clima"); String temperatura = jObj.getString("temperatura"); //Prima di inviare alla main metto il risultato in un arrylist risultato.add(clima); risultato.add(temperatura); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } return risultato; } protected void onPostExecute(final ArrayList&…
has answer: http://stackoverflow.com/a/26169709
upvote count: 1
accepted answer: http://stackoverflow.com/a/26169709
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41026568

http://stackoverflow.com/q/26048155
has comment: http://stackoverflow.com/comment/40806085
favorite count: 0
has comment: http://stackoverflow.com/comment/40806034
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/26048281
accepted answer: http://stackoverflow.com/a/26048281
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40806139
has body: i want to check some url at 9:00 a.m everyday.But how can i do this? I did check some topic and article about AlarmManager and IntentService but i can't get together for my application , is there any example code or something ?Thank you..
has title: how to do something at specific time for everyday in android
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40806185
answer count: 1

gwt
tags question: http://stackoverflow.com/q/26119024
tags question: http://stackoverflow.com/q/26171642
tag name: gwt
tags question: http://stackoverflow.com/q/26193428
tags question: http://stackoverflow.com/q/26137734
tags question: http://stackoverflow.com/q/26063029
tags question: http://stackoverflow.com/q/26041769
tags question: http://stackoverflow.com/q/26111350
tags question: http://stackoverflow.com/q/26137995
type: Tag
tags question: http://stackoverflow.com/q/26096195
tags question: http://stackoverflow.com/q/26137095
tags question: http://stackoverflow.com/q/26183036
tags question: http://stackoverflow.com/q/26123772
tags question: http://stackoverflow.com/q/26037905
tags question: http://stackoverflow.com/q/26094217
tags question: http://stackoverflow.com/q/26038014
tags question: http://stackoverflow.com/q/26110327
tags question: http://stackoverflow.com/q/26154172
tags question: http://stackoverflow.com/q/26047374
tags question: http://stackoverflow.com/q/26081594
tags question: http://stackoverflow.com/q/26181579
tags question: http://stackoverflow.com/q/26073453
tags question: http://stackoverflow.com/q/26164463
tags question: http://stackoverflow.com/q/26062140
tags question: http://stackoverflow.com/q/26176483
tags question: http://stackoverflow.com/q/26170518
tags question: http://stackoverflow.com/q/26121332
tags question: http://stackoverflow.com/q/26055384

http://stackoverflow.com/comment/40791434
score: 1
has text: You should have no issues having a single listener wired into two listener containers. Your Gist only has one connection factory. Turn on DEBUG logging and report back if the logs don't clear up the problem you are having.
comment on: http://stackoverflow.com/q/26038811
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41017037
has text: Also, make sure you're calling something like `setContentView(R.layout.fragment_main);` in your activity/fragment.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26162901

http://stackoverflow.com/comment/40804958
comment on: http://stackoverflow.com/a/26047386
score: 0
type: Comment
has text: Thanks! Though I am having a problem after adding the {, it now doesn't print "Password entered!" anymore. Also, I changed } else { to } else if(!code.equals(input)) { to make sure it doesn't check for a specific string.
type: AnswerComment

http://stackoverflow.com/q/26054803
has body: I'm encountering this issue on this line of code even I use .append() inside the loop. for (final FieldError fieldError : result.getFieldErrors()) { errors = new StringBuilder(errors).append(fieldError.getField()).append(" - ") .append(getErrorMessageFromProperties(fieldError.getCode())).append("*").toString(); } how can I fix this?
score: 4
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26054895
has comment: http://stackoverflow.com/comment/40817704
tagged with: sonarqube
upvote count: 4
has comment: http://stackoverflow.com/comment/40817877
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40817745
possible better answer: http://stackoverflow.com/a/26073048
favorite count: 0
has answer: http://stackoverflow.com/a/26073048
has comment: http://stackoverflow.com/comment/40817799
has comment: http://stackoverflow.com/comment/40817732
has title: Performance - Method concatenates strings using + in a loop
has answer: http://stackoverflow.com/a/26054895

list
type: Tag
tags question: http://stackoverflow.com/q/26103501
tags question: http://stackoverflow.com/q/26060664
tags question: http://stackoverflow.com/q/26169465
tags question: http://stackoverflow.com/q/26146307
tags question: http://stackoverflow.com/q/26057148
tags question: http://stackoverflow.com/q/26097282
tags question: http://stackoverflow.com/q/26088757
tags question: http://stackoverflow.com/q/26042532
tags question: http://stackoverflow.com/q/26057685
tags question: http://stackoverflow.com/q/26152000
tags question: http://stackoverflow.com/q/26188173
tags question: http://stackoverflow.com/q/26073024
tag name: list
tags question: http://stackoverflow.com/q/26072242
tags question: http://stackoverflow.com/q/26081006
tags question: http://stackoverflow.com/q/26043413
tags question: http://stackoverflow.com/q/26135928
tags question: http://stackoverflow.com/q/26035940
tags question: http://stackoverflow.com/q/26051412
tags question: http://stackoverflow.com/q/26052826
tags question: http://stackoverflow.com/q/26179001
tags question: http://stackoverflow.com/q/26066748
tags question: http://stackoverflow.com/q/26069906
tags question: http://stackoverflow.com/q/26157641
tags question: http://stackoverflow.com/q/26154411
tags question: http://stackoverflow.com/q/26041568
tags question: http://stackoverflow.com/q/26080542
tags question: http://stackoverflow.com/q/26051076
tags question: http://stackoverflow.com/q/26151428

http://stackoverflow.com/q/26177889
tagged with: java
tagged with: web-applications
has body: I need to route requests to my application server through a http server. I have gone through the IBM documentation but it seems very complex. As far as I understand, these are the steps: Install Apache server on separate machine Install WAS on separate machine Login to WAS console and Add Web Server Install Apache WAS plugin in Apache server machine Generate a plugin-config xml in WAS Console Place the plugin-config file in the Apache WAS plugin folder Is this roughly correct? Is there any requirement to add/edit virtual host for this?
type: Question
tagged with: apache
score: 0
tagged with: websphere
answer count: 1
has title: How to setup Apache frontend for Websphere 8
has answer: http://stackoverflow.com/a/26178564
accepted answer: http://stackoverflow.com/a/26178564
type: AnsweredQuestion

http://stackoverflow.com/comment/40820661
type: QuestionComment
comment on: http://stackoverflow.com/q/26056411
has text: You current implementation will throw IllegalStateException please post actual code.
score: 0
type: Comment

http://stackoverflow.com/q/26108352
type: UnansweredQuestion
tagged with: lwjgl
downvote count: 1
tagged with: java
score: -1
tagged with: collision-detection
has comment: http://stackoverflow.com/comment/40921661
has comment: http://stackoverflow.com/comment/40916240
type: Question
has body: I am building a 2d tile based game, similiar to a Legend of Zelda game, and my collision method is not working properly. The method will return collisions when the player is far below an impassable tile. There must be a logic error I do not see here. This is in Java. From static collision class: public static boolean collisionAbovePlayer(TileGrid grid, float x, float y, int width, int height) { boolean collision = false; for (Tile[] row : grid.map) { for (Tile t : row) { // Each Tile t in map: if (t.getType().getPassable() == false) { // Each impassable tile: if ( (x-t.getX() &gt; 0 &amp;&amp; x - t.getX() &lt; t.getWidth()) || (x - t.getX() &lt; 0 &amp;&amp; Math.abs(x - t.getX()) &lt; width )) { // Tile is within collision x range if ((t.getY() + t.getHeight() + 1) - y &lt; Math.abs(5)) { collision = true; } else { collision = false; } } else { collision = false; } } } } return collision; } This is being called by this method in my Player class (I haven't implemented collision methods for the other directions yet): public void Update() { if (first) first = false; else { if ((Keyboard.isKeyDown(Keyboard.KEY_W)) &amp;&amp; (!collisionAbovePlayer(grid, x, y, width, height))) { y -= Delta() * speed; } if (Keyboard.isKeyDown(Keyboard.KEY_A)) { x -= Delta() * speed; } if (Keyboard.isKeyDown(Keyboard.KEY_S)) { y += Delta() * speed; } if (Keyboard.isKeyDown(Keyboard.KEY_D)) { x += Delta() * speed; } } } Let me know if you need to see more of the code, thanks for your time.
upvote count: 0
answer count: 1
has title: Collision method gone crazy;
favorite count: 0
has comment: http://stackoverflow.com/comment/40916415
has answer: http://stackoverflow.com/a/26111616
has comment: http://stackoverflow.com/comment/40921457

http://stackoverflow.com/comment/41061742
type: Comment
type: QuestionComment
score: 0
has text: In that case you handle the puase and cancel and call Thread.interrupt(). This should stop the sleep and continue on. You may take a look at this http://stackoverflow.com/questions/5915156/how-can-i-kill-a-thread-without-using-stop
comment on: http://stackoverflow.com/q/26187167

http://stackoverflow.com/q/26125049
has comment: http://stackoverflow.com/comment/40946057
accepted answer: http://stackoverflow.com/a/26125236
has body: What benefit gives us the second signature method with wildcard &lt;?&gt;? public static &lt;T&gt; void firstCheckList(List&lt;T&gt; myList, T obj) public static &lt;T&gt; void secondCheckList(List&lt;?&gt; myList, T obj)
duplicate of: http://stackoverflow.com/q/10943137
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40946310
tagged with: java
has comment: http://stackoverflow.com/comment/40945995
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40946626
has title: What's the benefit of wildcard generics in Java?
has answer: http://stackoverflow.com/a/26125236
answer count: 1
downvote count: 0
score: 1
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/10943137

http://stackoverflow.com/comment/40992105
score: 6
has text: a little formatting effort, may be?
comment on: http://stackoverflow.com/q/26149981
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26188328
has body: for (j = 0; j &lt; examNum; j++) { exam=-1 while (exam&lt;0){ exam = s.nextDouble(); examAdd = (examAdd + exam); if (exam&lt;0) System.out.println("negative write again"); } } or for (j = 0; j &lt; examNum; j++) { while (true){ exam = s.nextDouble(); examAdd = (examAdd + exam); if (exam&lt;0) System.out.println("negative write again"); else continue; }
answers question: http://stackoverflow.com/q/26188291
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40916857
type: QuestionComment
has text: Failsafe is almost the same as surefire and has the same options regarding forks.
comment on: http://stackoverflow.com/q/26107721
score: 0
type: Comment

http://stackoverflow.com/comment/40995887
type: QuestionComment
comment on: http://stackoverflow.com/q/26152000
has text: Don't add duplicate values if the List already `contains()` it?
score: 0
type: Comment

http://stackoverflow.com/comment/40986540
type: Comment
has text: And, barring time travel, just where is the program supposed to get the `nextStick` parameter for the constructor?
comment on: http://stackoverflow.com/a/26147033
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40929715
type: Comment
has text: Have you checked if the CableContent.INSTANCE.updateContentProvider() function does the update correctly?
type: AnswerComment
comment on: http://stackoverflow.com/a/26096506
score: 0

http://stackoverflow.com/comment/40910346
score: 0
comment on: http://stackoverflow.com/q/26104019
type: Comment
type: QuestionComment
has text: What do you mean by dimens? Can you copy snippet?

http://stackoverflow.com/a/26148892
type: Answer
has comment: http://stackoverflow.com/comment/40990147
upvote count: 3
has body: If I'm understanding your question, you're trying to read the excel file like a text file. The challenge is that .xls files are actually binary files containing the text, formatting, sheet information, macro information, etc... You'd either need to save the files as .csv (Either via Excel before running your program or through your program directly), upgrade them to .xlsx (which has numerous libraries that can read the file as an XML at that point) or use a library (such as apache POI or anything similar) or even query the data out using ADO. Good luck and I hope that's what you were implying via your question.
has comment: http://stackoverflow.com/comment/40990367
score: 3
has comment: http://stackoverflow.com/comment/40990172
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26148732
has comment: http://stackoverflow.com/comment/40990218
answers question: http://stackoverflow.com/q/26148732

http://stackoverflow.com/comment/40794273
comment on: http://stackoverflow.com/q/26040340
has text: Anyway you cant just use Net dll. Java works with native dll's only. You need to wrap you Net dll into native one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40961847
score: 0
comment on: http://stackoverflow.com/q/26112494
type: Comment
type: QuestionComment
has text: I've updated this question here http://stackoverflow.com/questions/26133663/namingexception-jta-usertransaction

http://stackoverflow.com/comment/40993891
type: Comment
has text: It is still throwing exceptions at me when I am trying to store numbers to an array. Exception in thread "main" java.lang.NumberFormatException: For input string: "1 1 1" I entered "1, 1, 1"
type: AnswerComment
comment on: http://stackoverflow.com/a/26150377
score: 0

http://stackoverflow.com/comment/40908441
type: Comment
comment on: http://stackoverflow.com/a/26104201
has text: Sorry for the mistake.. Are you sure that the service is returning utf-8? You can check the http headers with soapui
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41009614
comment on: http://stackoverflow.com/q/26159630
score: 3
type: QuestionComment
has text: What output are you getting? Please show the code where you actually sort the intervals.
type: Comment

http://stackoverflow.com/a/26175185
answers question: http://stackoverflow.com/q/26172967
has body: You have two constructors. My guess is that you're loading an FXML somewhere which will instantiate your controller using the no-args constructor. In this case menuCtrl is not initialized. If you're instantiating menuCtrl in the FXML, then add a @FXML annotation to the field.
score: 0
type: Answer

http://stackoverflow.com/a/26227773
answers question: http://stackoverflow.com/q/26126814
type: Answer
downvote count: 0
score: 1
has body: I'll post my answer in hopes that someone with a similar issue will some day benefit from this. First, I switched to the official InfluxDB Java client, which actually works just fine. I was quite happy using this solution, but it involved pulling in another dependency to my project which I wasn't particularly happy about. There is also an open bug, in which milliseconds are interpreted as microseconds (https://github.com/influxdb/influxdb-java/issues/13). Kinda a party crasher. The second way is a little bit of trickery. Sotirios Delimanolis provided me a clue in his comment. First, wrap the response object in an array: new InfluxDbStat[]{influxDbStat}; Second, screws JAXB. None of the marshallers I could find, Jackson, Jettison, Moxy, (sadly, even yes the trusty Eclipse Moxy) fail to produce "normal" interest-hipster-like JSON. All is not lost though, we were already pulling in GSON transitively as a dependency, so we decided to just make in a declared dependency and use it. So, just do a gson.toJson(new InfluxDbStat[]{influxDbStat}) and you're good to go! One other bug we discovered from my first post is that the points variable actually needs to be declared as public int[][] points, since InfluxDB allows you to submit multiple rows at once. Anyway good luck and happy InfluxDBing!
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26126814

http://stackoverflow.com/comment/40995677
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26146873
score: 0
has text: What the * are you asking??? Are you doing a simulation? Does it matter for displaying a time? Are you using Eclipse? Is you application using Eclipse? Does it matter? Sorry, but no wonder that you couldn't google out anything, they haven't implemented a crystal ball yet.

http://stackoverflow.com/q/26142743
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: criteria-api
answer count: 1
tagged with: java
has body: I have an entity called User, which has the following relationship to an entity called Company: @Entity public class User { ... @ManyToOne @JoinColumn(name="COMPANY_ID",referencedColumnName="ID") private Company company = null; ... } And on my database, I have a User table with a "COMPANY_ID" column. How can I create a JPA criteria query using this field? Using a criteria builder, I've tried the following expressions without success: CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(User.class); Root mockEntityRoot = cq.from(User.class); //cq.where(cb.equal(mockEntityRoot.get("company"), 2)); //cq.where(cb.equal(mockEntityRoot.get("COMPANY_ID"), 12)); cq.where(cb.equal(mockEntityRoot.get("company.id"), 8)); entityManager.createQuery(cq).getResultList(); But I got the following error: "The attribute [company.id] from the managed type User is not present." Thanks in advance.
has answer: http://stackoverflow.com/a/26143045
tagged with: jpa
downvote count: 0
tagged with: persistence
accepted answer: http://stackoverflow.com/a/26143045
type: AnsweredQuestion
has title: jpa criteria - expression based on db field name

http://stackoverflow.com/a/71954899
type: Answer
score: 0
has body: Complementing Remko Popma's answer - you can deny anything above and below desired level using two Threshold Filters. <PatternLayout pattern="%d{yyyy-mm-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%nZ" /> <ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
answers question: http://stackoverflow.com/q/26108045

http://stackoverflow.com/q/26136844
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/96974146
type: Question
tagged with: weblogic
has body: I am currently working with weblogic and the thing is that I deploy several applications on my weblogic server. Sadly, when one of this application fail to deploy for X/Y reason, I just want to force stop this application and to pass to the other one. I've already looked into the WLST doc and I don't find what I am searching for. Here is the function I use : stopApplication(applicationName, gracefulProductionToAdmin="true", gracefulIgnoreSessions="true") It takes about 5 minutes to stop application this way. When I stop application through Administration Console (force stop actually) it takes about 5 seconds to stop application. So is there any way to force stop application through WLST script? Thanks
has answer: http://stackoverflow.com/a/26177888
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: weblogic-10.x
tagged with: python
accepted answer: http://stackoverflow.com/a/26177888
has title: WLST - force stop application
tagged with: wlst
type: AnsweredQuestion

http://stackoverflow.com/comment/40907446
has text: Thanks Giovanni, that did the trick! And that explains the 11 hours time difference, it must have been using Bangladesh Standard Time.
comment on: http://stackoverflow.com/a/26103039
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26095671
type: UnansweredQuestion
has title: Font for different resolution Libgdx
score: 3
downvote count: 0
has body: I have a problem with fonts: I have a bitmapFont and I use it for write words in Label, my problem is that when change the resolution of screen the font seems pixellated. Looking at network I discovered that this problem can be resolved using FreeTypeFontGenerator class, but I don't understand how. Could you give me a tip about. Thank for your time
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/40900082
upvote count: 3
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26289021
tagged with: libgdx

http://stackoverflow.com/a/26186408
downvote count: 0
answers question: http://stackoverflow.com/q/26183635
type: Answer
score: 2
upvote count: 2
has body: @Component Indicates that an annotated class is a "component". That is, in a context where component scanning is enabled, Spring generates bean definitions for @Component annotated types. These bean definitions end up being turned into beans. @Configuration, which is itself annotated with Indicates that a class declares one or more @Bean methods and may be processed by the Spring container to generate bean definitions and service requests for those beans at runtime, [...] So any @Configuration type, for which Spring generates a bean, acts as a factory for beans. The javadoc of @Bean states @Bean methods may also be declared within classes that are not annotated with @Configuration. For example, bean methods may be declared in a @Component class or even in a plain old class. In such cases, a @Bean method will get processed in a so-called 'lite' mode. Bean methods in lite mode will be treated as plain factory methods by the container (similar to factory-method declarations in XML), with scoping and lifecycle callbacks properly applied. The containing class remains unmodified in this case, and there are no unusual constraints for the containing class or the factory methods. In contrast to the semantics for bean methods in @Configuration classes, 'inter-bean references' are not supported in lite mode. Instead, when one @Bean-method invokes another @Bean-method in lite mode, the invocation is a standard Java method invocation; Spring does not intercept the invocation via a CGLIB proxy. This is analogous to inter-@Transactional method calls where in proxy mode, Spring does not intercept the invocation — Spring does so only in AspectJ mode. So @Bean methods have full functionality in @Configuration annotated classes and limited functionality in @Component annotated classes. why it is Accepting even without @Configuration annotation? That's how the class is designed. An ApplicationContext is a BeanFactory. AnnotationConfigApplicationContext simply offers an extra way to reg…

http://stackoverflow.com/comment/40815706
score: 0
has text: The best you can do is to make an APK that once opened will download and install another apk. You can't install two APKs at one time
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26053636

http://stackoverflow.com/comment/40879383
has text: Where did you read this?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26088277

http://stackoverflow.com/comment/41070814
type: Comment
type: QuestionComment
has text: Sir , I already solved the problem I am facing with... BY the way SIR, THANKS A LOT. BECAUSE YOU REPLIED TO MY QUESTIONS. I just keep on working on it then I accidentally found the problem :) THANKS FOR YOUR REPLY AND CONCERN SIR.
score: 0
comment on: http://stackoverflow.com/q/26192209

compression
tags question: http://stackoverflow.com/q/26113345
tags question: http://stackoverflow.com/q/26139463
tag name: compression
tags question: http://stackoverflow.com/q/26139434
type: Tag
tags question: http://stackoverflow.com/q/26111357

http://stackoverflow.com/comment/72256067
score: 2
type: AnswerComment
has text: The question is to explain right way of using expected and actual in testing framework.
type: Comment
comment on: http://stackoverflow.com/a/40936878

http://stackoverflow.com/comment/41048966
score: 0
has text: @VenkateshV read a little about regex, you obvisouly don't understand them. When I say that `$` mean end of line and I give a you a link explaining in detail each part of the regex , If you don't follow the advice to read the right panel, you won't learn ...
type: Comment
comment on: http://stackoverflow.com/q/26180094
type: QuestionComment

http://stackoverflow.com/comment/40854950
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26057248
has text: The sourceset example worked.but in the build folder all the configs are getting generated all together but that I can live with.thanks for the help
score: 0

http://stackoverflow.com/comment/40921800
type: AnswerComment
comment on: http://stackoverflow.com/a/26108167
type: Comment
has text: haha, yes we agree :0) a `CompactHashMap`, `ChronicleMap` would be great solutions to this problem. Thank you for a great discussion, walked out learning a lot :) Hope you have a great day ahead!
score: 1

http://stackoverflow.com/a/26167163
has body: Check the server logs to see if your application is indeed using a MySQL datasource or the embedded default H2 datasource. Your persistence.xml does not contain a &lt;jta-data-source&gt;, so I'd say the default datasource is being used. See the Wiki article about Datasource Configuration.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41054652
answers question: http://stackoverflow.com/q/26166616
downvote count: 0
score: 1

http://stackoverflow.com/q/26071567
answer count: 2
downvote count: 0
tagged with: polymorphism
accepted answer: http://stackoverflow.com/a/26071888
favorite count: 0
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26071888
score: 3
has answer: http://stackoverflow.com/a/26072115
has title: Is is good practice to add a dummy method into a superclass so the subclass can override it?
tagged with: overriding
has body: I have a problem. It stems from calling a subclass method from a superclass, but with a twist. Any insight would be greatly appreciated. For example let's say I have a subclass MultipleChoice that extends an abstract superclass Question. The class MultipleChoice has a method addChoice(String choice), while Question does everything any question should do, like display the question prompt, and check for the correct answer. I'd like to create an instance of MultipleChoice that references Question, and then call the addChoice(String choice) method. The reason for this is because I'd like to create a list of questions, and then put different types of questions in there (e.g. multiple choice, true and false, etc.). Something like this: ArrayList&lt;Question&gt; list = new ArrayList(); list.add(new MultipleChoice()); //this is valid list.get(0).addChoice("abc"); list.get(0).addChoice("xyz"); //etc However, this of course is a compile error, since not every question is a multiple choice type of question. I know of two solutions for this. Typecast: ((MultipleChoice)list.get(0)).addChoice("abc"); Add the method addChoice(String choice) into the superclass Question, so it can be overridden by MultiplceChoice. Since I'm going to be accessing list many times, option 1 is well... ugly, while option 2 just seems to really poor practice, especially since Question is abstract. How can I approach this elegantly?
has comment: http://stackoverflow.com/comment/40849951
tagged with: inheritance
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26072115

http://stackoverflow.com/q/26067136
favorite count: 0
possible better answer: http://stackoverflow.com/a/26067555
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I am making my program to throw a die (as in dices) for a school assignment in Java SE. The user can place a character as standard input, so the character the user picks will represent the eyes of the die. Sometimes when I print the result, it shows a completely different character. package ThrowADie; import java.util.Scanner; public class ThrowADie { public static void main(String[] args) { //Ask user for the char in which the dices eyes should be printed in. System.out.print("Which character should I use for the eye: "); //Allow user to place input in the eye variable Scanner input = new Scanner(System.in); //Make the stdinput object char eye = input.next().charAt(0); //Time to throw the die. Place result in dieResult int dieResult = throwDie(); //Reveal of the result printDieResult(dieResult, eye); } /* * Method name: throwDie() * Purpose: Picks a number from 1 to 6 randomly, like a die does * Parameters: N/A * Returns: Integer number from 1 to 6 */ public static int throwDie(){ int range = (6 - 1) + 1; return (int)(Math.random() * range) + 1; } /* * Method name: printDieResult() * Purpose: Generate result of the die throw in ASCII art * Parameters: numberOfEyes, typeOfEyes * Returns: N/A */ public static void printDieResult(int numberOfEyes, char typeOfEyes){ if (numberOfEyes == 1){ //Print art System.out.println( " " + " " + " \n" + " " + typeOfEyes + " \n" + " " + " " + " "); } else if (numberOfEyes == 2){ //Print art System.out.println( typeOfEyes + " " + " \n" + " " + " " + " \n" + " " + " " + typeOfEyes); } else if (numberOfEyes == 3){ //Print art System.out.println( typeOfEyes + " " + " \n" + " " + typeOfEyes + " \n" + " " + " " + typeOfEyes); } else if (numberOfEyes == 4){ //Print art System.out.println( typeOfEyes + " " + typeOfEyes + "\n" + " " + " " + " \n" + typeOfEyes + " " + typeOfEyes); } else if (numberOfEyes == 5){ //Print art System.out.println( typeOfEyes + " " + typeOfEyes + "\n" + " " + typeOfEyes + " \n" + typeOfEyes + " " + typeOfEyes); } e…
type: Question
has answer: http://stackoverflow.com/a/26067169
tagged with: java
accepted answer: http://stackoverflow.com/a/26067169
has answer: http://stackoverflow.com/a/26067555
answer count: 2
has title: Why is the char value transforming during the output?
downvote count: 0
linked to: http://stackoverflow.com/q/17124992

http://stackoverflow.com/q/26069708
has body: The existing codes that I'm trying to port in is implemented in C++. After I write my java wrapper and run javah on the class to get a .h header file, .... is there a "correct" way to do things? Should my corresponding wrapper for my existing code be written in C or C++? Thanks!
type: Question
has comment: http://stackoverflow.com/comment/40846213
has comment: http://stackoverflow.com/comment/40848996
tagged with: java-native-interface
answer count: 1
has answer: http://stackoverflow.com/a/26069937
accepted answer: http://stackoverflow.com/a/26069937
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40845730
has comment: http://stackoverflow.com/comment/40846483
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40845823
has comment: http://stackoverflow.com/comment/40846063
has title: When using JNI to port in existing C++ code, use C or C++ to interface with JAVA?
has comment: http://stackoverflow.com/comment/40845909
tagged with: java

http://stackoverflow.com/comment/40853681
has text: @Powerslave me neither :D.
comment on: http://stackoverflow.com/q/26074217
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40867554
type: Comment
has text: You should update your answer to say "*check to see if `guess` contains only numbers before using it*". He could replace all the `Integer.parseInt(int)` with an `int` variable that, if guess contains only numbers, gets assigned to guess parsed as an `int` (0 if guess contains anything other than numbers), but he currently isn't checking
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26081517

http://stackoverflow.com/q/26136335
has title: How private fields accessible on jsp page in struts 2.x?
answer count: 2
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/26142628
has answer: http://stackoverflow.com/a/26142628
tagged with: struts2
has body: Hello every one I am working with struts 2.x and very new for this framework . I follow list of tutorials and steps and my application working properly but there is one thing which is not clear to me Like when I declare one private field in my action class and using struts tag that private field is accessible to the jsp page . So how it happen that is not understandable for me: struts.xml <?xml version="1.0" encoding="UTF-8"?> /hello.jsp /bye.jsp /hello.jsp /bye.jsp MessageAction.java package com.csc.action; import com.csc.service.BussniessServ; public class MessageAction { private String result; private String value; private String fstvalue; private String scndvalue; public String getFstvalue() { return fstvalue; } public void setFstvalue(String fstvalue) { this.fstvalue = fstvalue; } public String getScndvalue() { return scndvalue; } public void setScndvalue(String scndvalue) { this.scndvalue = scndvalue; } // method which get value from input parameter public String getValue() { return value; } // method which show the value of input parameter public void setValue(String value) { this.value = value; } // method which run as default and execute public String execute() { BussniessServ serv = new BussniessServ(); setMessag(serv.Addition(fstvalue, scndvalue)); return "hello"; } // method to show message on jsp page public String getResult() { return result; } // method for save message public void setResult(String result) { this.result = result; } } Result.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> Insert title here <s:property value="result"/>
accepted answer: http://stackoverflow.com/a/26136557
favorite count: 0
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26136557
upvote count: 3
has comment: http://stackoverflow.com/comment/40968684
tagged with: java
type: Question

http://stackoverflow.com/comment/40919435
comment on: http://stackoverflow.com/a/26051658
score: 0
type: Comment
has text: Yeah I know that spring supports wild card loading, that is the reason I asked the question, I thought Java has in built mechanism to scan classpath.
type: AnswerComment

http://stackoverflow.com/a/26159940
score: 0
has body: Simply you can change your code as follows boolean status=true; do { Scanner s = new Scanner(System.in); System.out.println("Enter name: "); String name = s.nextLine(); System.out.println("Enter address: "); String address = s.nextLine(); System.out.println("Enter card number: "); int cardNo = s.nextInt(); System.out.println("Enter card expiration date: (DDMMYY)"); int expirationDate = s.nextInt(); System.out.println("You want to add more or quit(type continue to add another, type quit to exit): "); String word=s.next(); if(word.equals("quit")){ status=false; } } while (status);
has comment: http://stackoverflow.com/comment/41010349
type: Answer
has comment: http://stackoverflow.com/comment/41010587
answers question: http://stackoverflow.com/q/26159896

http://stackoverflow.com/q/26138714
has comment: http://stackoverflow.com/comment/40970918
tagged with: exception
has comment: http://stackoverflow.com/comment/40991727
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4036144
possible better answer: http://stackoverflow.com/a/26139760
has answer: http://stackoverflow.com/a/26149771
accepted answer: http://stackoverflow.com/a/26149771
tagged with: annotations
type: Question
tagged with: testing
has title: Java-how to use annotation in Junit - eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/40982273
has body: I am trying to test if a method throws a IllegalArgumentException in Junit with the code below, however it didn't work. Eclipse suggested to create an annotation class, which confuses me a bit. Can I get away without using an annotation? Otherwise what's the best solution for this? @Test(expected = IllegalArgumentException.class) public void testRegister(){ myProgram.register(-23); //the argument should be positive }
has comment: http://stackoverflow.com/comment/40988420
has comment: http://stackoverflow.com/comment/40990339
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26139760
tagged with: junit
has comment: http://stackoverflow.com/comment/40972761

http://stackoverflow.com/comment/40976900
has text: ok, now got your point, `ALL` means all operations, not like any single operation, means not `one of the above types.` . The link in your question tells the same thing --> `The meaning of CascadeType.ALL is that the persistence will propagate (cascade) all EntityManager operations (PERSIST, REMOVE, REFRESH, MERGE, DETACH) to the relating entities.`
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26141550
type: AnswerComment

http://stackoverflow.com/q/26062542
tagged with: java
has comment: http://stackoverflow.com/comment/40832158
tagged with: eclipse
score: 0
has body: I am currently working on a simple language with a parser using JavaCC, Eclipse and the JTB. I am doing this for learning purposes. When I run the .java file it gives me the following Error: Encountered " "var" "var "" at line 2, column 5. Was expecting: ":" ... But when I look through my code there is no such thing at line 2??!! I know that this error should not be there I have been debugging due to a previous error for like 2 hours now... EDIT this is my token code that includes the "var": TOKEN : { &lt; REQUIRE: "require" &gt; | &lt; IF: "if" &gt; | &lt; WHILE:"while" &gt; | &lt; VAR:"var" &gt; | &lt; STOP:"stop" &gt; | &lt; EXEC:"exec" &gt; | &lt; ELSE:"else" &gt; } and this is the rule definition for "var": void VariableDeclaration():{} { "var" VariableName() "=" MathExpression() "." } void VariableAssign():{} { VariableName() "=" MathExpression() "." } Hope this helps :)
tagged with: abstract-syntax-tree
has comment: http://stackoverflow.com/comment/40874415
answer count: 1
has comment: http://stackoverflow.com/comment/40834518
has answer: http://stackoverflow.com/a/26067728
has title: "Encountered" error which should not be there
has comment: http://stackoverflow.com/comment/40878847
tagged with: token
has comment: http://stackoverflow.com/comment/40951116
type: AnsweredQuestion
tagged with: javacc
has comment: http://stackoverflow.com/comment/40904457
accepted answer: http://stackoverflow.com/a/26067728
has comment: http://stackoverflow.com/comment/40834458
has comment: http://stackoverflow.com/comment/40875402
has comment: http://stackoverflow.com/comment/40842258
has comment: http://stackoverflow.com/comment/40871145
has comment: http://stackoverflow.com/comment/40967381
type: Question

http://stackoverflow.com/q/26042542
accepted answer: http://stackoverflow.com/a/26042657
has body: import java.text.DecimalFormat; import java.util.Scanner; public class DecimalFormatExample { public static void main(String[] args) { Scanner input=new Scanner(System.in); double number1; double number2; double number3; System.out.print("Insert first number:"); number1=input.nextInt(); System.out.print("Insert second number:"); number2=input.nextInt(); System.out.print("Insert third number:"); number3=input.nextInt(); DecimalFormat df = new DecimalFormat("0.00"); System.out.println(df.format(number1)); System.out.println(df.format(number2)); System.out.println(df.format(number3)); }} when i insert the first number for example: Insert first number:1 it will print out 1.00 if i insert the number Insert first number:1.00, i get error. How can i put insert the number with decimal point?
possible better answer: http://stackoverflow.com/a/26043031
has answer: http://stackoverflow.com/a/26043031
has comment: http://stackoverflow.com/comment/40795487
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40795486
tagged with: java
has answer: http://stackoverflow.com/a/26042657
tagged with: floating-point
type: Question
tagged with: decimal
has title: how to input two decimal number
score: 0
answer count: 2

http://stackoverflow.com/a/26176358
accepted answer of: http://stackoverflow.com/q/26176327
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41041402
has body: You are not importing java.awt.Font but another Font class. The constructor for java.awt.Font should allow your initialization.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26176327
upvote count: 2

ormlite
tags question: http://stackoverflow.com/q/26106455
tag name: ormlite
tags question: http://stackoverflow.com/q/26087363
tags question: http://stackoverflow.com/q/26186413
type: Tag

http://stackoverflow.com/a/73763988
type: Answer
has body: None of the answers were working for me in Kotlin so I did my own implementation: val SERVER_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss" // Adjust as per your use case val gson = GsonBuilder() .setDateFormat(SERVER_DATE_FORMAT) .registerTypeAdapter(Date::class.java, object : JsonSerializer<Date> { private val utcDateFormat = SimpleDateFormat( SERVER_DATE_FORMAT, Locale.ENGLISH ).apply { timeZone = TimeZone.getTimeZone("UTC") } // Avoid using local date formatter (with timezone) to send UTC date override fun serialize(src: Date?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement { return JsonPrimitive(src?.let { utcDateFormat.format(it) }) } }) .create() val gsonConverterFactory = GsonConverterFactory.create(gson) val retrofit = Retrofit.Builder() .baseUrl("Your URL") .addConverterFactory(gsonConverterFactory) .build() I hope this can be useful for somebody else!
score: 0
answers question: http://stackoverflow.com/q/26044881
has comment: http://stackoverflow.com/comment/130253219

http://stackoverflow.com/a/26147103
downvote count: 0
score: 1
has body: Checkout what is going on with OSGi enRoute.
upvote count: 1
answers question: http://stackoverflow.com/q/26144276
type: Answer

http://stackoverflow.com/comment/41104625
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26175783
has text: Thanks for the tip! However what I want is to be able to right click my element and inspect (when having a clicklistener on the layout).
type: AnswerComment

http://stackoverflow.com/q/26057743
possible better answer: http://stackoverflow.com/a/72459509
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72459509
has body: I am using DropZone.js My configuration is Dropzone.options.myAwesomeDropzone = { url: 'UploadImages', previewsContainer: ".dropzone-previews", uploadMultiple: true, parallelUploads: 5, maxFiles: 20, addRemoveLinks: true, init: function() { this.on("success", function(file, response) { $('.dz-progress').hide(); console.log(response); console.log(file); }); } } }); This code is working perfectly with my local host. I am uploading files to UploadImages url. I have entered one message in that url method that is working properly. My problem is I am not getting which name should i use to get the content in server. Like what is name of imageFile variable, imageName variable, imageContent Type that should i access in my server side implementation. Edit : Server side implementation of DropZone Dropzone does not provide the server side implementation of handling the files, but the way files are uploaded is identical to simple file upload forms like this: &lt;form action="" method="post" enctype="multipart/form-data"&gt; &lt;input type="file" name="file" /&gt; &lt;/form&gt; I got it includes &lt;input type="file" name="file" /&gt; automatically in form so we can access it using file If &lt;input name="file" type="file" multiple /&gt; then we can access it using file[] in server side I tried public class ImageAction extends ActionSupport { private List&lt;File&gt; file; private List&lt;String&gt; fileContentType; private List&lt;String&gt; fileFileName; System.out.println("Inside Image upload "); System.out.print("\n\n---------------------------------------\n"); int i = 0; for (File f : file) { System.out.print("\nFile [" + i + "] "); System.out.print(" length: " + f.length()); System.out.print(" name:" + getFileFileName().get(i)); System.out.print(" contentType: " + getFileContentType().get(i)); i++; } System.out.println("\n---------------------------------------\n"); } //getter setter } It is printing Inside Image upload. How to make access fields of file on Action class.
tagged with: java
tagged with: struts2
type: Question
answer count: 2
tagged with: jsp
tagged with: jquery
score: 4
tagged with: dropzone.js
has title: Upload multiple files in Struts2 with Dropzone.js
upvote count: 4
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/26080212
accepted answer: http://stackoverflow.com/a/26080212

http://stackoverflow.com/q/26079115
duplicate of: http://stackoverflow.com/q/218384
type: Question
has body: I have a java program that contain four classes, but I'll post two just to show my object interaction. After I run it I receive AWT-EventQueue-0" java.lang.NullPointerException I believe it because of my objects interaction. How to fix it? public class myFrame extends JFrame { public PanelOne P1 = new PanelOne(); public PanelTwo P2 = new PanelTwo(); public myFrame mf; public myFrame() { super("MyFrame"); setLayout(new BorderLayout()); add(P1,BorderLayout.CENTER ); add(P2,BorderLayout.EAST); setSize(600,500); setVisible(true); } public static void main(String args[]) { myFrame mf = new myFrame(); mf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } public class PanelTwo extends JPanel { private myFrame mf; private JButton quit = new JButton("quit"); private ButtonHandler bh = new ButtonHandler(); private JRadioButton start = new JRadioButton("Start", true); private JRadioButton stop = new JRadioButton("Stop"); private ButtonGroup group = new ButtonGroup(); public PanelTwo(){ super(); setLayout(new GridLayout(9,1)); setBackground(Color.RED); add(new JLabel("PanelTwo")); add(quit); quit.addActionListener(bh); add(start); add(stop); group.add(start); start.addActionListener(bh); group.add(stop); stop.addActionListener(bh); } public PanelTwo(myFrame mf){ super(); this.mf=mf; } public class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent ac){ if(ac.getSource()==quit){ System.exit(0); } if(ac.getSource()==stop){ mf.P1.timer.stop(); } if(ac.getSource()==start){ mf.P1.timer.start(); } } } } And this is what I got: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Sep16and2014.PanelTwo$ButtonHandler.actionPerformed(PanelTwo.java:45) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) ......... So, it said that my mistake starts in line with mf.P1.timer.stop(); I believe I somewhere assigned a null value. How to fix …
has answer: http://stackoverflow.com/a/26079155
score: 0
answer count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/26079167
has title: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException bouncing ball
linked to: http://stackoverflow.com/q/218384
tagged with: java
has comment: http://stackoverflow.com/comment/40863049
has comment: http://stackoverflow.com/comment/40862564
type: UnansweredQuestion

http://stackoverflow.com/comment/40929583
has text: @Yann4 - I think The Op also wants to check in the String `dadsabobsada`. We could use a simple regex, but I don't think the OP would understand that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26116132

http://stackoverflow.com/a/26164155
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/74013855
has comment: http://stackoverflow.com/comment/62975248
has comment: http://stackoverflow.com/comment/73862077
has comment: http://stackoverflow.com/comment/134779022
has comment: http://stackoverflow.com/comment/68046246
has comment: http://stackoverflow.com/comment/140109605
has comment: http://stackoverflow.com/comment/74032194
has comment: http://stackoverflow.com/comment/140109653
has comment: http://stackoverflow.com/comment/41019297
type: Answer
has comment: http://stackoverflow.com/comment/68085900
has comment: http://stackoverflow.com/comment/62922149
has comment: http://stackoverflow.com/comment/140110192
answers question: http://stackoverflow.com/q/26162407
has comment: http://stackoverflow.com/comment/68085743
has comment: http://stackoverflow.com/comment/140109638
downvote count: 3
has comment: http://stackoverflow.com/comment/68239895
has comment: http://stackoverflow.com/comment/67825298
accepted answer of: http://stackoverflow.com/q/26162407
has comment: http://stackoverflow.com/comment/62921554
has comment: http://stackoverflow.com/comment/74020883
has comment: http://stackoverflow.com/comment/111753328
score: 83
upvote count: 86
has comment: http://stackoverflow.com/comment/67824753
has comment: http://stackoverflow.com/comment/68033455
has comment: http://stackoverflow.com/comment/111736042
has comment: http://stackoverflow.com/comment/111716662
has body: There is no Either type is Java 8, so you need to create one yourself or use some third-party library. You may build such a feature using the new Optional type (but read to the end of this answer): final class Either&lt;L,R&gt; { public static &lt;L,R&gt; Either&lt;L,R&gt; left(L value) { return new Either&lt;&gt;(Optional.of(value), Optional.empty()); } public static &lt;L,R&gt; Either&lt;L,R&gt; right(R value) { return new Either&lt;&gt;(Optional.empty(), Optional.of(value)); } private final Optional&lt;L&gt; left; private final Optional&lt;R&gt; right; private Either(Optional&lt;L&gt; l, Optional&lt;R&gt; r) { left=l; right=r; } public &lt;T&gt; T map( Function&lt;? super L, ? extends T&gt; lFunc, Function&lt;? super R, ? extends T&gt; rFunc) { return left.&lt;T&gt;map(lFunc).orElseGet(()-&gt;right.map(rFunc).get()); } public &lt;T&gt; Either&lt;T,R&gt; mapLeft(Function&lt;? super L, ? extends T&gt; lFunc) { return new Either&lt;&gt;(left.map(lFunc),right); } public &lt;T&gt; Either&lt;L,T&gt; mapRight(Function&lt;? super R, ? extends T&gt; rFunc) { return new Either&lt;&gt;(left, right.map(rFunc)); } public void apply(Consumer&lt;? super L&gt; lFunc, Consumer&lt;? super R&gt; rFunc) { left.ifPresent(lFunc); right.ifPresent(rFunc); } } Example use case: new Random().ints(20, 0, 2).mapToObj(i -&gt; (Either&lt;String,Integer&gt;)(i==0? Either.left("left value (String)"): Either.right(42))) .forEach(either-&gt;either.apply( left -&gt;{ System.out.println("received left value: "+left.substring(11));}, right-&gt;{ System.out.println("received right value: 0x"+Integer.toHexString(right));} )); In retrospective, the Optional based solution is more like an academic example, but not a recommended approach. One problem is the treatment of null as “empty” which contradicts the meaning of “either”. The following code shows an Either that considers null a possible value, so it’s strictly “either”, left or right, even if the value is null: abstract class Either&lt;L,R&gt; { pu…
has comment: http://stackoverflow.com/comment/41106986
has comment: http://stackoverflow.com/comment/67825412

http://stackoverflow.com/a/26175216
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26175099
has body: Actually you are not getting the activity in this function but the Activity's Context The best practice for getting Context in a non-Activty class is using a ContextWrapper Class please check the following link ...you'll get a clear idea, how it's work http://itekblog.com/android-context-in-non-activity-class/

http://stackoverflow.com/q/26034288
type: Question
has title: JavaFX AceEditor
has comment: http://stackoverflow.com/comment/40783187
has comment: http://stackoverflow.com/comment/40783318
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/40780663
has body: i have a problem with initializing the Ace editor inside WebView. The content of the HTML is shown (Sample Text), but if i'm trying to call a javascript function inside the HTML nothing happens. The javascript files are in the same folder as the HTML The content of the HTML Sample text Initialization of WebView WebEngine webEngine = ((WebView)scene.lookup("#myWebView")).getEngine(); webEngine.load(getClass().getResource("../../../html/editor.html").toExternalForm()); Thanks
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: javafx

http://stackoverflow.com/q/26191083
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/26191106
has answer: http://stackoverflow.com/a/26191106
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26191100
type: Question
has body: I just started learning java and I want to make a simple program where it requests the persons name, outputs the name then asks for the thier favorite number. It will then compare their number to the number 6 and will output something depending on if the number is larger or smaller than 6. I am getting a "String to int convert" error in Netbeans which has to do with the scanner. Hopefully I am asking this correctly but how can I make the scanner pick-up integers? Thanks package javaapplication2; import java.util.Scanner; import java.lang.String; public class JavaApplication2 { public static void main(String[] args) { // Creating an instance of the scanner class. // Gets name and numbers. Scanner getName = new Scanner(System.in); Scanner getNumber = new Scanner(System.in); //Holds name and number String userName; int userNumber; // Asks for the users name. // Holds name in userName. System.out.println("What is your name?"); userName = getName.nextLine(); //Reponds with the users name. System.out.println("Hello" + userName + "!"); //Asks for favorite number. // Holds number in userNumber. System.out.println("What is your favorite number?"); userNumber = getNumber.nextLine(); // Checks if users number is larger than 6. if (userNumber &gt; 6) { // Stuff goes here. } } }
score: 0
answer count: 2
has title: How do I use java.util.Scanner with integers
has answer: http://stackoverflow.com/a/26191100
has comment: http://stackoverflow.com/comment/41068505

http://stackoverflow.com/a/26116279
answers question: http://stackoverflow.com/q/26116141
upvote count: 1
has body: NumberFormatException is a sub type of RuntimeException When you caught RuntimeException, It will caught all type of RuntimeException including NumberFormatException. That's why it's says already caught.
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/26111679
answer count: 3
has comment: http://stackoverflow.com/comment/40922617
has comment: http://stackoverflow.com/comment/40927261
has comment: http://stackoverflow.com/comment/40925800
favorite count: 0
has answer: http://stackoverflow.com/a/26121566
tagged with: spring
has comment: http://stackoverflow.com/comment/40926522
has comment: http://stackoverflow.com/comment/40923295
tagged with: spring-mvc
score: 2
has body: This is my Model class in my Spring MVC Mongodb project public class SampleProject{ @Id String id; public String getId() { return id; } String regNo; String name; ArrayList&lt;String&gt; result; public String getRegNo() { return regNo; } public String getName() { return name; } public ArrayList&lt;String&gt; getResult() { return result; } } This is how my Service class looks like @Repository("resultService") public class ResultService { @Autowired private MongoTemplate mongoTemplate; public static final String COLLECTION_NAME = "collectionName"; public StudentResult getStudentResult(String regNo) { Query query = new Query(Criteria.where("regNo").is(regNo)); StudentResult Ek = mongoTemplate.findOne(query, StudentResult.class); return Ek; } } This is how my controller class looks like public class ResultController { private final ResultService resultService; @Autowired public ResultController(ResultService resultService) { this.resultService = resultService; } @RequestMapping(value ="/search", method = RequestMethod.GET) public String getStudentResult(String regNo, ModelMap model){ model.addAttribute("studentResult",resultService.getStudentResult(regNo)); return "output"; } } This is how my jsp looks like &lt;%@ taglib prefix="c" uri="Oracle Technology Network for Java Developers" %&gt; &lt;c:out value="${studentResult.name}"/&gt; &lt;c:out value="${studentResult.regNo}"/&gt; &lt;c:out value="${studentResult.deptName}"/&gt; &lt;c:out value="${studentResult.collName}"/&gt; &lt;c:out value="${studentResult.result}"/&gt; &lt;!--This line prints the arraylist as arraylist.--&gt; &lt;!--But the following iteration using foreach doesn't work --&gt; &lt;c:forEach var="student" items="${studentResult}"&gt; &lt;tr&gt; &lt;td&gt;${student.name}&lt;/td&gt; &lt;td&gt;${student.regNo}&lt;/td&gt; &lt;td&gt;&lt;input type="button" value="delete" onclick="window.location='person/delete?id=${person.id}'"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; This is what the db looks { "_id" …
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40925619
tagged with: java
accepted answer: http://stackoverflow.com/a/26201295
has title: How can I iterate an arrayList which is returned as part of result from Mongodb?
type: Question
upvote count: 2
tagged with: mongodb
possible better answer: http://stackoverflow.com/a/26112220
has comment: http://stackoverflow.com/comment/40927998
tagged with: jsp
has answer: http://stackoverflow.com/a/26112220
has answer: http://stackoverflow.com/a/26201295
has comment: http://stackoverflow.com/comment/40922965

fxml
tags question: http://stackoverflow.com/q/26105650
tags question: http://stackoverflow.com/q/26098736
tags question: http://stackoverflow.com/q/26186572
tags question: http://stackoverflow.com/q/26077009
tags question: http://stackoverflow.com/q/26057108
tags question: http://stackoverflow.com/q/26104580
tags question: http://stackoverflow.com/q/26082823
tags question: http://stackoverflow.com/q/26111826
tags question: http://stackoverflow.com/q/26177177
tags question: http://stackoverflow.com/q/26144060
tags question: http://stackoverflow.com/q/26097213
tag name: fxml
type: Tag

http://stackoverflow.com/a/26121180
downvote count: 0
has comment: http://stackoverflow.com/comment/40938591
type: Answer
has comment: http://stackoverflow.com/comment/40938766
has comment: http://stackoverflow.com/comment/40938537
answers question: http://stackoverflow.com/q/26121128
has body: Change sign > for &lt; inside for (k = 0; k &gt; intArray.length; k++) { Probably it should help you
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40938432

http://stackoverflow.com/comment/40967546
score: 0
type: Comment
has text: When it comes to excluding properties into `jar` or `war` You need to google for 'gradle exclude properties'. It can be done in `jar` or `war` task or probably also in `processResources` configuration. I don't remember it by heart :/
comment on: http://stackoverflow.com/a/26130222
type: AnswerComment

http://stackoverflow.com/q/26122487
has answer: http://stackoverflow.com/a/26124957
upvote count: 1
type: Question
tagged with: java
has body: I am using Jodd Madvoc web framework and define actions (classes and methods) using annotations. Everything works fine, but now I need to have these action definitions in an external file, so Madvoc don't need to scan my class path for the action classes (and for some other reasons). I could probably code this by myself, since Madvoc is quite open for extension, but just wonder if there is already a way to do this? Thank you!
accepted answer: http://stackoverflow.com/a/26124957
tagged with: jodd
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has title: Define Jodd Madvoc mappings from external file
type: AnsweredQuestion

http://stackoverflow.com/comment/100593330
has text: This doesn't seem to work. It just moves on without waiting for an `Enter`. What's happening and how can I fix it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26184535
type: Comment

http://stackoverflow.com/comment/40827567
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26048888
has text: Same thing happens with the lenguaje name. Java dont have all the names for all languages in the locale you specified. Thats why it will return the english name

http://stackoverflow.com/comment/40992637
has text: They're both static methods, within the same declarative scope, I mean, you did point out *Whereas in a **non static method** you make the call like this*
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26150272
type: Comment

http://stackoverflow.com/a/26113791
score: 4
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26113394
has body: Most decompilers will automatically transform the compiler generated StringBuilder sequences back into string concatenation with +. One of the few that doesn't is Krakatau. If you decompile the class with Krakatau, you'll get something like public class MainClass { public MainClass() { super(); } public static void main(String[] a) { new StringBuilder().append("abc").append("def").toString(); } } So as you can see, the StringBuilder code is there. You can also look at the disassembly to be sure. .version 51 0 .source MainClass.java .class super public MainClass .super java/lang/Object .method public &lt;init&gt; : ()V ; method code size: 5 bytes .limit stack 1 .limit locals 1 aload_0 invokespecial java/lang/Object &lt;init&gt; ()V return .end method .method static public main : ([Ljava/lang/String;)V ; method code size: 26 bytes .limit stack 2 .limit locals 4 ldc 'abc' astore_1 ldc 'def' astore_2 new java/lang/StringBuilder dup invokespecial java/lang/StringBuilder &lt;init&gt; ()V aload_1 invokevirtual java/lang/StringBuilder append (Ljava/lang/String;)Ljava/lang/StringBuilder; aload_2 invokevirtual java/lang/StringBuilder append (Ljava/lang/String;)Ljava/lang/StringBuilder; invokevirtual java/lang/StringBuilder toString ()Ljava/lang/String; astore_3 return .end method
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26113394
downvote count: 0

http://stackoverflow.com/comment/40951863
comment on: http://stackoverflow.com/q/26128041
has text: Interesting, I added a debug message "Triggered" in the for-loop, and it was not executed. That either means the loop did not worked, or the if-statement returned false.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26114563
score: 0
tagged with: adb
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26114606
has title: stop adb logcat from running
type: AnsweredQuestion
has body: I am using Runtime.getRuntime().exec("logcat -f log.txt -c"); In my android application. The problem with is is that it keeps running and never stops. Is there a command to stop the code/adb command from executing?
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/26114606

http://stackoverflow.com/a/26064661
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40836500
has comment: http://stackoverflow.com/comment/40836243
score: 2
answers question: http://stackoverflow.com/q/26064646
has body: Just pass a "typeName" and "interestRate" by parameter to your constructor AccountType type = new AccountType("savings", 0.012f);
downvote count: 0
has comment: http://stackoverflow.com/comment/40836461
has comment: http://stackoverflow.com/comment/40836289

http://stackoverflow.com/comment/40967217
type: AnswerComment
comment on: http://stackoverflow.com/a/26121130
score: 0
type: Comment
has text: I'm following all your instructions @Iker-Aguayo and I appreciate your help, thanks. I added the snippet in the pom, but I still get the same error. pom.xml --> http://pastebin.com/raw.php?i=ms33V8Pu

http://stackoverflow.com/a/26108684
has body: From a set {a, b, c, ...}, you want {a} and {} joined with the set-of-all-subsets of {b, c, ...} recursively.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26107036

http://stackoverflow.com/a/26163151
has comment: http://stackoverflow.com/comment/98828450
has comment: http://stackoverflow.com/comment/95098189
downvote count: 0
score: 19
has body: There is no Either in the Java Standard Library. However there is an implementation of Either in FunctionalJava, along with many other nice classes.
has comment: http://stackoverflow.com/comment/97568602
answers question: http://stackoverflow.com/q/26162407
type: Answer
upvote count: 19

http://stackoverflow.com/q/26085740
has body: I have to model breakwater that controls permissions in certain coast. My solution implements a class "Ship" and classes "OilShip", "FishingShip" and "CarriageShip", I used inheritance and made public class OilShip extends Ship{ ... } public class FishingShip extends Ship{ ... } public class CarriageShip extends Ship{ ... } In another class I have Ship ship=new Ship(...); and I'd like to somehow make an Oilship into Ship, i.e. public Class Abcd{ Ship ship; public Abcd(OilShip oship){ ship=oship; //************* } } There seems to be a problem with the code, please tell me.
has title: How to convert an object from class to superclass
score: -1
has answer: http://stackoverflow.com/a/26086039
has comment: http://stackoverflow.com/comment/40875024
type: Question
has comment: http://stackoverflow.com/comment/40874851
upvote count: 0
has comment: http://stackoverflow.com/comment/40874667
answer count: 1
has comment: http://stackoverflow.com/comment/40874701
tagged with: inheritance
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/40874663
has comment: http://stackoverflow.com/comment/40874742
has comment: http://stackoverflow.com/comment/40874916
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/40878539
has comment: http://stackoverflow.com/comment/40874645
tagged with: java

android-layout
tags question: http://stackoverflow.com/q/26075540
tag name: android-layout
tags question: http://stackoverflow.com/q/26134482
tags question: http://stackoverflow.com/q/26098359
tags question: http://stackoverflow.com/q/26171126
tags question: http://stackoverflow.com/q/26131188
tags question: http://stackoverflow.com/q/26133035
tags question: http://stackoverflow.com/q/26124858
tags question: http://stackoverflow.com/q/26152815
tags question: http://stackoverflow.com/q/26166761
tags question: http://stackoverflow.com/q/26113167
type: Tag
tags question: http://stackoverflow.com/q/26176253
tags question: http://stackoverflow.com/q/26173100
tags question: http://stackoverflow.com/q/26159483
tags question: http://stackoverflow.com/q/26175423
tags question: http://stackoverflow.com/q/26125544
tags question: http://stackoverflow.com/q/26176645
tags question: http://stackoverflow.com/q/26046440
tags question: http://stackoverflow.com/q/26043258
tags question: http://stackoverflow.com/q/26052894
tags question: http://stackoverflow.com/q/26040820
tags question: http://stackoverflow.com/q/26092959
tags question: http://stackoverflow.com/q/26100208
tags question: http://stackoverflow.com/q/26089642

http://stackoverflow.com/a/26166911
has comment: http://stackoverflow.com/comment/41023828
score: 0
has comment: http://stackoverflow.com/comment/41023876
has comment: http://stackoverflow.com/comment/41023809
type: Answer
has comment: http://stackoverflow.com/comment/41023852
has comment: http://stackoverflow.com/comment/41023928
answers question: http://stackoverflow.com/q/26166711
has comment: http://stackoverflow.com/comment/41024014
has comment: http://stackoverflow.com/comment/41023732
has body: The test2.class needs to be on your CLASSPATH. For example, if it is at /Users/you/classes/test2.class then /Users/you/classes/ needs to be on your CLASSPATH. Since you are building with Gradle, you could also just let Gradle sort all of that out for you using JavaExec. See http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.JavaExec.html for more info. A simple example in your build.gradle might be something like this: task myTask(type: JavaExec, dependsOn: 'classes') { main = 'test2' classpath = sourceSets.main.runtimeClasspath } I hope that helps.

http://stackoverflow.com/a/26083104
score: 0
has body: In old versions of java, you cannot iterate in switch over a string. That is allowed only since java 7: https://stackoverflow.com/a/12521398/1276062 Either update your java version or convert the p to char
type: Answer
answers question: http://stackoverflow.com/q/26083064

http://stackoverflow.com/comment/40873754
type: Comment
type: QuestionComment
has text: Ok. So you probably cannot serve 1000 clients using a (native) thread per connection. However you _can_ do it with I/O multiplexing. That's why I/O multiplexing is useful.
comment on: http://stackoverflow.com/q/26085099
score: 0

http://stackoverflow.com/comment/40886439
score: 0
type: Comment
type: QuestionComment
has text: I understand the performance bottleneck if we have to make so many calls on page load. I was thinking to ease page load time using lazy-loading. Say i have to show only 5 documents thumbnail on page load, how can i do the same on client side. I am very much interested to know how we can achieve this on client side ?
comment on: http://stackoverflow.com/q/26087656

http://stackoverflow.com/a/43138039
score: -1
downvote count: 1
type: Answer
upvote count: 0
has body: I had the exact same issue and just deleted the server from my workspace and added a new one, didnt get the error again. Its working fine for now.
answers question: http://stackoverflow.com/q/26143894

http://stackoverflow.com/comment/40993788
has text: You forgot to mention on which line you got the error.
type: Comment
comment on: http://stackoverflow.com/q/26150832
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40806299
type: QuestionComment
has text: @Alter I didn't get you.What exactly u want to know.Can u explain clearly ?
score: 0
comment on: http://stackoverflow.com/q/26047945
type: Comment

http://stackoverflow.com/comment/41023172
has text: If you can try, try to place your package structure under src folder of your project in eclipse and than add this src folder under the Build Path configuration. like "your project name/src". See if it can help you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26166136

http://stackoverflow.com/q/26066032
linked to: http://stackoverflow.com/q/7229226
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40839296
has answer: http://stackoverflow.com/a/26068343
has title: Sending information between panels and main frame
favorite count: 0
has answer: http://stackoverflow.com/a/26066257
tagged with: jframe
type: UnansweredQuestion
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40839099
linked to: http://stackoverflow.com/q/3066590
score: 1
tagged with: java
tagged with: jpanel
has body: My midterm assignment for my comp sci class is that I have to create a tictactoe game. I have 9 individual JPanel objects that represent the tiles, all with the int value "turn" that determines which graphic gets put into the panel. My problem is that I need to make it so that when you click the button within a panel, it changes the value of turns for all of the CellPanel objects within the frame, not just that instance of it, so that next time you take a panel, it puts a new graphic up, instead of the same graphic as before. My Mid1 class with the main method: import java.awt.*; import javax.swing.*; public class Mid1 extends JFrame { public Mid1() { setLayout(new GridLayout(3, 3)); CellPanel panel1 = new CellPanel(); add(panel1); CellPanel panel2 = new CellPanel(); add(panel2); CellPanel panel3 = new CellPanel(); add(panel3); CellPanel panel4 = new CellPanel(); add(panel4); CellPanel panel5 = new CellPanel(); add(panel5); CellPanel panel6 = new CellPanel(); add(panel6); CellPanel panel7 = new CellPanel(); add(panel7); CellPanel panel8 = new CellPanel(); add(panel8); CellPanel panel9 = new CellPanel(); add(panel9); } public static void main(String[] args) { Mid1 frame = new Mid1(); frame.setTitle("mid1"); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); // Center the frame frame.setVisible(true); } } My CellPanel class: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; class CellPanel extends JPanel implements ActionListener{ Image cross = new ImageIcon("image/x.gif").getImage(); Image not = new ImageIcon("image/o.gif").getImage(); JButton button; int turn = 0; int draw; public CellPanel(){ BorderLayout layout = new BorderLayout(); setLayout(layout); button = new JButton("Take"); button.setPreferredSize(new Dimension(0,20)); button.addActionListener(this); this.add(button, layout.SOUTH); } public void setTurn(int t){ turn = t; } public in…

http://stackoverflow.com/a/33484552
type: Answer
has body: Assume jPathStrB is a StringBuilder of the json above. (Edit: I now realize you are using the other jayway jsonpath library, not the groovy based one. This answer below uses the JsonPath that comes with rest-assured and relies on the groovy "max()" method.) JsonPath jPath = new JsonPath(jPathStrB.toString()); jPath.prettyPrint(); Float price = jPath.get("store.book.price.max()"); System.out.println("Max price: " + price); }
answers question: http://stackoverflow.com/q/26187865
score: 0

http://stackoverflow.com/q/26181769
tagged with: methods
has answer: http://stackoverflow.com/a/26181925
linked to: http://stackoverflow.com/q/2448843
upvote count: 0
has title: have trouble with calling methods. what am i missing?
has answer: http://stackoverflow.com/a/26181900
favorite count: 0
has answer: http://stackoverflow.com/a/26181807
tagged with: calling-convention
answer count: 3
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/41388050
type: Question
has body: fix me plz. i get multiple error messages "variable airSpeed_km might not have been initialized" "variable width might not have been initialized" "variable length might not have been initialized" import java.util.Scanner; public class V4_________1{ public static void main (String args[]) { Scanner keyboard = new Scanner(System.in); double KNOTS_TO_KMPHR; double airSpeed_km; double airSpeed_knots; double width; double length; ***// need to do something in the main but not sure what exactly*** airSpeed_knots = keyboard.nextDouble(); System.out.println("what is your current airspeed in knots?"); System.out.println("your current airspeed in km is: " + airSpeed_km + "your holding pattern width is: " + width + "your holding patter length is: " + length); } public static double getAirSpeed(double airSpeed_knots, double KNOTS_TO_KMPHR, double airSpeed_km) { KNOTS_TO_KMPHR = 1.852; airSpeed_km = airSpeed_knots * KNOTS_TO_KMPHR ; return airSpeed_km; } public static double calcPatternWidth(double width, double airSpeed_km) { width = (airSpeed_km) / (60 * Math.PI) * 2; return width; } public static double calcPatternLength(double airSpeed_km, double length) { length = (airSpeed_km) / (60 * Math.PI) * 2 + ((airSpeed_km) / 60); return length; } }
score: -2
tagged with: java

http://stackoverflow.com/comment/41060757
has text: This seems similar to this question: http://stackoverflow.com/questions/10420137/jaxb-xjc-mapping-to-existing-domain-objects
comment on: http://stackoverflow.com/q/26186689
score: 0
type: Comment
type: QuestionComment

security
tags question: http://stackoverflow.com/q/26071429
tags question: http://stackoverflow.com/q/26156163
tags question: http://stackoverflow.com/q/26039920
tags question: http://stackoverflow.com/q/26105184
tags question: http://stackoverflow.com/q/26068460
tags question: http://stackoverflow.com/q/26097641
tags question: http://stackoverflow.com/q/26107987
tags question: http://stackoverflow.com/q/26126763
tags question: http://stackoverflow.com/q/26038715
tags question: http://stackoverflow.com/q/26063607
tags question: http://stackoverflow.com/q/26106307
tags question: http://stackoverflow.com/q/26068048
tags question: http://stackoverflow.com/q/26057468
tags question: http://stackoverflow.com/q/26151908
tags question: http://stackoverflow.com/q/26140203
tags question: http://stackoverflow.com/q/26121105
tags question: http://stackoverflow.com/q/26178652
tags question: http://stackoverflow.com/q/26057803
tags question: http://stackoverflow.com/q/26085748
type: Tag
tags question: http://stackoverflow.com/q/26086443
tag name: security

http://stackoverflow.com/comment/40878227
score: 0
comment on: http://stackoverflow.com/q/26087645
has text: `return value;` ends method flow of control, so code after it (in your case `switch`) will not be invoked (is unreachable)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40968753
type: Comment
type: QuestionComment
score: 0
has text: @raj2103 If you have new information to add to the question click the `edit` link under your question and edit the existing question, please do not post a new duplicate question
comment on: http://stackoverflow.com/q/26113316

http://stackoverflow.com/q/26187972
tagged with: if-statement
has comment: http://stackoverflow.com/comment/41063139
has body: public class Calculator extends JFrame{ JButton button1, button2, button3, button4, button5, button6, button7, button8, button9, equal; JButton plus, minus, times, divide, root, trig, factorial, square, log, cube, ln; // trig button -&gt; next line var. JButton sin, cos, tan, arcsin, arccos, arctan, sinh, cosh, tanh; JLabel answer; public Calculator() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); answer = new JLabel(""); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 0; add(answer, gbc); gbc.gridwidth = 3; cube = new JButton("^3"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; // right gbc.gridy = 1; // down gbc.gridwidth = 1; add(cube, gbc); factorial = new JButton("!"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 1; add(factorial, gbc); trig = new JButton("="); // expansion button gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 2; gbc.gridy = 1; add(trig, gbc); log = new JButton("log"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 2; add(log, gbc); ln = new JButton("ln"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 2; add(ln, gbc); root = new JButton("sqrt()"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 2; gbc.gridy = 2; add(root, gbc); square = new JButton("^2"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 3; add(square, gbc); plus = new JButton("+"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 3; add(plus, gbc); minus = new JButton("-"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 2; gbc.gridy = 3; add(minus, gbc); times = new JButton("*"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 4; add(times, gbc); divide = new JButton("/"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 4; add(divide, gbc); equal = new JButton("="); // gives answer gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 2; gbc…
answer count: 2
upvote count: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/41064420
tagged with: variables
has comment: http://stackoverflow.com/comment/41063085
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41063088
has answer: http://stackoverflow.com/a/26187983
score: -2
has comment: http://stackoverflow.com/comment/41063227
has comment: http://stackoverflow.com/comment/41063137
has answer: http://stackoverflow.com/a/26188001
tagged with: java
downvote count: 2
has title: Java variable suddenly equals 0
type: Question
has comment: http://stackoverflow.com/comment/41063202

http://stackoverflow.com/comment/40811526
has text: Thank you for your prompt response. Unfortunately the issue still persist, and I am receiving the same error. It has been rewritten as such ParseAnalytics.trackAppOpened(getAcitivty().getIntent()); // inform the Parse Cloud that it is ready for notifications PushService.setDefaultPushCallback(getActivity().getApplicationContext(), getActivity()); ParseInstallation.getCurrentInstallation().saveInBackground();
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26051161

http://stackoverflow.com/comment/40882412
score: 0
has text: Joda data time there is a compare to you can use that.
type: Comment
comment on: http://stackoverflow.com/q/26089785
type: QuestionComment

http://stackoverflow.com/comment/40882096
type: Comment
type: QuestionComment
score: 0
has text: What does the getResources() return ?
comment on: http://stackoverflow.com/q/26089642

http://stackoverflow.com/q/26124304
has body: I've got a problem logging in with facebook on my app. Logging in only works when the Android Facebook app is not installed. In that case you'll get a popup from facebook. When the Facebook app is installed, the login will redirect to the app. In this case I don't get my session token back, instead I get the message: CLOSED_LOGIN_FAILED I've been looking all over the place, but I really can't find the problem. This is the code in my Fragment, The login button is created through XML: private void initButtons() { btnFacebook.setApplicationId(v.getContext().getResources().getString(R.string.app_id)); btnFacebook.setReadPermissions(Arrays.asList("email", "public_profile", "user_birthday")); btnFacebook.setFragment(this); btnFacebook.setSessionStatusCallback(new StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { Log.d("Token:",session.getAccessToken()); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this.getActivity(), requestCode, resultCode, data); } Any ideas what I might be missing? Again, the login only works without the facebook app installed EDIT: I get a Session Closed Login Failed message when the account which is used, already registered the app. When user first logs in using this app (added to their account) the results are as they should be
tagged with: java
type: Question
score: 0
answer count: 1
has title: Facebook Login not working through app
has answer: http://stackoverflow.com/a/26124693
tagged with: android
tagged with: facebook
type: UnansweredQuestion

http://stackoverflow.com/a/26105263
type: Answer
has comment: http://stackoverflow.com/comment/40910316
has comment: http://stackoverflow.com/comment/40910245
has comment: http://stackoverflow.com/comment/40918784
downvote count: 1
answers question: http://stackoverflow.com/q/26105157
score: 0
upvote count: 1
has body: Please, note that substring method may be the cause for leaks. substring method in String class causes memory leak This is 'feature' is fixed in java 7u6

http://stackoverflow.com/a/26060647
has comment: http://stackoverflow.com/comment/40833766
has comment: http://stackoverflow.com/comment/40829756
type: Answer
downvote count: 0
has body: Create an inheritance tree for all your instances. abstract class Card { protected String icon; public Card(String icon) { this.icon = icon; } public String getIcon() { return this.icon; } } Here is an example of subclass: class CardA extends Card { public CardA() { super("Icon A"); } } Do something like that with all of your cards. After that you can do: List&lt;Card&gt; cardList = new ArrayList&lt;Card&gt;(); cardList.add(new CardA()); cardList.add(new CardB()); and lets say you want to iterate it: for(Card card : cardList) { System.out.println(card.getIcon()); } That will print: Icon A Icon B As you see, with this procedure you can create and add any subclass and you don't have to modify previous created classes.
score: 1
has comment: http://stackoverflow.com/comment/40851333
upvote count: 1
answers question: http://stackoverflow.com/q/26060471

http://stackoverflow.com/q/26181484
has comment: http://stackoverflow.com/comment/41051136
has comment: http://stackoverflow.com/comment/41050742
type: UnansweredQuestion
has title: Parse any string to Sql date
has comment: http://stackoverflow.com/comment/41050863
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41053609
has comment: http://stackoverflow.com/comment/41052093
has comment: http://stackoverflow.com/comment/41050753
has answer: http://stackoverflow.com/a/26182646
has comment: http://stackoverflow.com/comment/41050637
has body: I wonder if it's possible to parse any string (at least to try) to sql Date without specifing the string format? In other words I want to make a generic method who take as input a string and return an sql Date. For instance I have: String date1="31/12/2099"; String date2="31-12-2099"; and call parseToSqlDate(date1) and parseToSqlDate(date2) which will returns sql dates.
answer count: 1

http://stackoverflow.com/q/26063607
has comment: http://stackoverflow.com/comment/40835070
has answer: http://stackoverflow.com/a/26064874
score: 4
tagged with: tomcat
upvote count: 4
tagged with: security
answer count: 1
has comment: http://stackoverflow.com/comment/40849789
favorite count: 0
has title: Does -XX:+HeapDumpOnOutOfMemoryError create any security or performance issues?
type: AnsweredQuestion
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/40835947
has body: Does the instruction to create an Heap Dump on out of memory error (-XX:+HeapDumpOnOutOfMemoryError) result in any security or noteworthy performance issues for Tomcat 7 in a production environment? (Of curse the server has to write the file when it "crashes" and this take some amout of time/space - but I am more interested in performance issues while the server is still in business.)
accepted answer: http://stackoverflow.com/a/26064874
tagged with: heap-dump
type: Question
downvote count: 0

http://stackoverflow.com/a/42755706
type: Answer
answers question: http://stackoverflow.com/q/26169557
has body: You can apparently use JDK8 to create JRE7 compatible byte code, and this seems to be what Google recommends: https://cloud.google.com/appengine/docs/standard/java/download -source 1.7 -target 1.7
score: 0

http://stackoverflow.com/q/26047486
has comment: http://stackoverflow.com/comment/40804829
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: Hi I am new to java I am trying to do hibernate in eclipse this is my configuration file Hibernate.cfg.xml I edited it in note pad and copied it my app <hibernate-configuration> update org.hibernate.dialect.SqlServerDialect hmohamed Kocroc1234 com.microsoft.sqlserver.jdbc.SqlServerDriver <mapping resource="employee.hbm.xml"/> </hibernate-configuration> I am getting error Cannot parse configuration file Hibernate.cfg.xml
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has answer: http://stackoverflow.com/a/26048095
type: Question
tagged with: configuration
tagged with: database
has title: Hibernate error :cannot parse configuration file
accepted answer: http://stackoverflow.com/a/26048095

http://stackoverflow.com/a/26189327
has body: We see runtime performance issues compiling Java 6 bytecode with Java 7. Is that expected? No. It is not expected. It is possible ... but I wouldn't have predicted it, and I can't think of an obvious explanation. What are the downsides/benefits of doing that? I can think of no real benefits to your problem (migration) of compiling code using Java 7 tools and setting to "-target" to "1.6". I would go straight to compiling for the Java 7 platform. Certainly, there is nothing to be gained from trying to figure out why the code apparently runs slower. It might be a real effect, or an illusion; e.g. an artefact of the way you are doing your benchmarking / performance measurement. But either way, it doesn't tell you anything about what will happen if you compile for Java 7 and run on Java 7 ... which is where you are trying to get to. In general, you would not expect performance to be slower in a newer release of Java. However, there are factors that could cause performance characteristics to change. For example: Changes in the JIT compiler might in theory cause certain atypical applications to run slower. Changes in JIT compilation strategy might result in code being JIT compiled later ... which could affect performance during startup / warmup. (A benchmarking should be designed to compensate for that ...) Changes in heap organization / garbage collection algorithms could require tuning / retuning. And so on.
accepted answer of: http://stackoverflow.com/q/26188412
answers question: http://stackoverflow.com/q/26188412
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/40989056
type: Comment
score: 0
has text: Well, in your code you haven't given the definiton of `simulationForm` it should be like this `Form<Simulation> form = Form.form(Simulation.class);` A more compact approach for form binding would be `Form<Simulation> filledForm = Form.form(Simulation.class).bindFromRequest();`
comment on: http://stackoverflow.com/a/26147797
type: AnswerComment

http://stackoverflow.com/q/26138285
has title: Java program DriverLicence using files
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26138457
tagged with: java
has answer: http://stackoverflow.com/a/26138807
score: 0
answer count: 2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26138807
has body: Hi I am stuck with this particular question. I create a program called DriverExam which reads from user and match it to array and gets the answer but I want to read from files instead of array. so far I am able to read first line. can someone help me how to read all line and store in the appropriate class and get the output on no of people passed, failed and how many got correct and how many get more than 10 questions correct. This is my code so far The files have input something like this B D A A C A B A C D B C D A D C C B D A B D A A C A B A C D B C D A D C C B D A A B D C A D C D A B A D C A B C D A B A A B D C A D C D A B A D C A B C D A B A public class DriversLicenceExam { private char[] key = { 'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A' }; private char[] answers; public DriversLicenceExam(char[] answers) { this.answers = answers; } public boolean passed(){ return(totalCorrect()&gt;=15); } public int totalCorrect(){ int correct = 0; for(int i = 0; i&lt;key.length;i++){ if(key[i]==answers[i]){ correct++; } } return correct; } public int totalIncorrect(){ int incorrect = 0; incorrect = key.length - totalCorrect(); return incorrect; } public int questionMissed(){ int size = key.length - totalCorrect(); int[] missed = null; if(size&lt;1) return size; else missed = new int[size]; int pos=0; for(int i = 0; i&lt;key.length;i++){ if(key[i]!=answers[i]){ missed[pos] = (i+1); pos+=1; } } return size; } } import java.io.File; import java.io.IOException; import java.util.Scanner; public class DriverLicenceFilesDemo { public static void main(String[] args) throws IOException { // create scanner object for keyboard input Scanner kb = new Scanner(System.in); String fileName; File myfile; char[] answers = new char[20]; do { System.out.print("Please enter the name of the file: "); fileName = kb.next(); myfile = new File(fileName); if (myfile.exists()) { Scanner infile = new Scanner(myfile); while (infile.hasNext()) { for…
favorite count: 0
has answer: http://stackoverflow.com/a/26138457
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5868369
tagged with: file
upvote count: 1

http://stackoverflow.com/q/26126639
has answer: http://stackoverflow.com/a/26128181
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26128181
tagged with: string
has answer: http://stackoverflow.com/a/26126741
has comment: http://stackoverflow.com/comment/40949326
type: AnsweredQuestion
has title: Splitting at the first captial letter in a string
linked to: http://stackoverflow.com/q/5640334
tagged with: java
type: Question
has body: So, I'm scraping from a lyric site and I want to format it just like the site has it. Right now when I get my output the string is all on the same line like this. I'm using Jsoup to get the information from the HTML. What I want to do is split each line before the capital letter like the lyrics on the site. I was told a million times Of all the troubles in my way How I had to keep on trying Little better ev'ry day But if I crossed a million rivers And I rode a million miles Then I'd still be where I started Bread and butter for a smile Well I sold a million mirrors In a shop in Alley Way But I never saw my face In any window any day Well they say your folks are telling you To be a super star But I tell you just be satisfied To stay right where you are Keep yourself alive keep yourself alive It'll take you all your time and a money Honey you'll survive Well I've loved a million women In a belladonic haze And I ate a million dinners Brought to me on silver trays Give me ev'rything I need To feed my body and my soul And I'll grow a little bigger Maybe that can be my goal I was told a million times Of all the people in my way How I had to keep on trying And get better ev'ry day But if I crossed a million rivers And I rode a million miles Then I'd still be where I started Still be where I started Keep yourself alive keep yourself alive It'll take you all your time and money honey You'll survive Keep yourself alive Keep yourself alive It'll take you all your time and money To keep me satisfied Do you think you're better ev'ry day No I just think I'm two steps nearer to my grave Keep yourself alive Keep yourself alive mm You take your time and take your money Keep yourself alive Keep yourself alive Keep yourself alive All you people keep yourself alive Keep yourself alive Keep yourself alive It'll take you all your time and a money To keep me satisfied Keep yourself alive Keep yourself alive All you people keep yourself alive Take you all your time and money honey You will…
tagged with: split
accepted answer: http://stackoverflow.com/a/26126741
tagged with: jsoup
has comment: http://stackoverflow.com/comment/40949014

http://stackoverflow.com/comment/40884027
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26090639
score: 0
has text: do you have `PythonInterpreter` in your manifest file

http://stackoverflow.com/a/26110967
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26110933
has body: The problem is here: if (count &lt;= length) { Eventually, this is going to try to reference cellsInput[y++][length] Where length is the length of that second array. However, the last index in the second array is actually at length - 1. The problem here occurs because all arrays in Java start with 0. So you always want to do if (count &lt; length) { whenever length is the length is the length of the array. Length is always the number of objects in the array, which starts counting at 1. Example: Array arr1 = [a, b, c, d] Length of arr1 = 4, it has 4 elements Element | Index -------------------- a | 0 b | 1 c | 2 d | 3 As you can see index 4 is out of bounds. So when you try to reference arr1[arr1.length] you get an IndexOutOfBoundsException
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26110933

http://stackoverflow.com/comment/41054444
type: QuestionComment
has text: What do you mean by _"emit 2 Observalbes"_ ? 2 items in the resulting observable or 2 Observables in the resulting observable ? Could you show a marble diagram ?
comment on: http://stackoverflow.com/q/26172555
score: 0
type: Comment

http://stackoverflow.com/comment/41042475
has text: OK, I gave my try on the yet better version while bending the assignment yet a bit more, but did not manage it. At the moment I do not get it better then the Semaphore version.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26167620
type: AnswerComment

http://stackoverflow.com/comment/40972945
type: QuestionComment
has text: when no scrolling is necessary, see @SergiyMedvynskyy... `lError.setPreferredSize(new Dimension(w,h));`
comment on: http://stackoverflow.com/q/26139762
score: 0
type: Comment

http://stackoverflow.com/q/26048941
accepted answer: http://stackoverflow.com/a/26049100
score: -2
has answer: http://stackoverflow.com/a/26048965
has answer: http://stackoverflow.com/a/26049100
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/26048965
favorite count: 0
has body: my goal is to take the first letter of a word and moving it to the end until the first letter is a vowel. this is pig latin System.out.println("Enter a word: "); String word = keyboard.nextLine(); String y = word.substring(0,1); String z = word.substring(1); char x = Character.toLowerCase(word.charAt(0)); if ((x=='a') || (x=='e') || (x=='i') || (x=='o') || (x=='u')) { System.out.println(word + "ay "); } while ((x!='a') || (x!='e') || (x!='i') || (x!='o') || (x!='u')) { String s = z+y; System.out.println(s); }
has title: Can anyone help me figure out why I'm stuck in a loop? And can I write it simpler?
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/26162702
has title: Cannot parse DateTime - Illegal instant due to time zone offset transition (Europe/Berlin)
tagged with: java
score: 10
upvote count: 10
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/26162790
answer count: 1
downvote count: 0
favorite count: 0
tagged with: datetime
accepted answer: http://stackoverflow.com/a/26162790
type: AnsweredQuestion
has body: Why can't I parse the following date? DateTime.parse("2015-03-29 02:35:00", DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")); Result: org.joda.time.IllegalInstantException: Cannot parse "2015-03-29 02:35:00": Illegal instant due to time zone offset transition (Europe/Berlin) at org.joda.time.format.DateTimeParserBucket.computeMillis(DateTimeParserBucket.java:471) at org.joda.time.format.DateTimeParserBucket.computeMillis(DateTimeParserBucket.java:411) at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:882) at org.joda.time.DateTime.parse(DateTime.java:160) at Testasd.test(Testasd.java:9) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.i…

http://stackoverflow.com/q/26185055
tagged with: java
has answer: http://stackoverflow.com/a/26185130
has comment: http://stackoverflow.com/comment/41057415
has title: (First time programming) How do you check an array of a class for a specific value?
upvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/26185126
favorite count: 0
has comment: http://stackoverflow.com/comment/41057441
has comment: http://stackoverflow.com/comment/41057748
has answer: http://stackoverflow.com/a/26185122
answer count: 4
downvote count: 0
type: UnansweredQuestion
has body: So I have to design a simple banking program for school and I'm having trouble checking my array for a specific account number. Base info, not the full code: public class Account { public String name; int number; double Balance; private Account [] accounts; public Account[] getAccounts() { return accounts; } public boolean hasAccountNumber(int accountNumber) { // How do I check my array of type Account if it has the passed in account number? // I was trying to use the following: Account[] b = getAccounts(); if(Arrays.asList(b).contains(accountNumber)){ return true; } else{ return false; } } } why isn't this working?
type: Question
has answer: http://stackoverflow.com/a/26185117
score: 1

http://stackoverflow.com/comment/40792173
comment on: http://stackoverflow.com/q/26040840
score: 0
type: Comment
has text: Which java version are you using?
type: QuestionComment

cordova
tags question: http://stackoverflow.com/q/26157810
tags question: http://stackoverflow.com/q/26123835
tags question: http://stackoverflow.com/q/26171642
tags question: http://stackoverflow.com/q/26174798
tags question: http://stackoverflow.com/q/26038026
tag name: cordova
tags question: http://stackoverflow.com/q/26184475
tags question: http://stackoverflow.com/q/26095851
tags question: http://stackoverflow.com/q/26147644
type: Tag
tags question: http://stackoverflow.com/q/26187847

http://stackoverflow.com/comment/40963823
type: Comment
type: AnswerComment
has text: byte[] encodedBytes = Base64.encodeBase64("mudit02@gmail.com".getBytes()); String url = "http://"+new String(encodedBytes)+":password@sphreg.asiaone.com/RegAuth2/enLogin.html"; I tried with this but still the same. It only goes to login page but doesn't logs in.
comment on: http://stackoverflow.com/a/26133823
score: 0

http://stackoverflow.com/q/26141942
tagged with: javascript
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: I'm building an application with Spring 3, Spring MVC, Tomcat7. I'm triying to refresh content in a jsp when something changes in server side. For this purpose I followed this tutorial: https://netbeans.org/kb/docs/javaee/maven-websocketapi.html and this one http://self-learning-java-tutorial.blogspot.com.es/2014/08/annotated-server-endpoint.html. Now I want to trigger one message to all clients (want to see the message in all oppened jsp pages) but I'm not sure how to do this. (For example when an entity is removed in server-side) As far as I undesrstand, will I need to trigger somehow the method annotated with @OnMessage? and how would I do this? maybe injecting this @ServerEndpoint... class? Thanks you all
type: Question
upvote count: 1
has title: Java websocket trigger event to javascript client
tagged with: java
answer count: 0
tagged with: websocket

http://stackoverflow.com/q/26123896
has answer: http://stackoverflow.com/a/26123967
accepted answer: http://stackoverflow.com/a/26123967
downvote count: 0
answer count: 1
has title: How to gain access to specific pdf informations?
favorite count: 0
has body: i have project going in jav where i need to filter out the following Informations out of Science PDF-Documents. Author, Title and References. There are several Problems with getting these specific Informations out of an PDF dokument. 1.There is no specific way in Writing a Paper so every paper looks different. 2.For a Programm it is hard to differentiate between names and actuall described objects. and there are some more problems but this would take us too far away from my actuall question. My question is, is there a option to gain accsess to certain kind of Information in a Pdf Dokument, like which font sizes are been used in this pdf or what kind of different fonts are used? Are there any methods or editors with which i can look inside a pdf in understandable way so i maybe can find iconic features around the Informations i need. So that i can wirte a algorythem to extract them properly. Thx for your help. And i am sorry for my english it is not my native language.
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/40941828
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26122692
has text: I cant alter the database unfortunately

http://stackoverflow.com/q/26142051
tagged with: android
possible better answer: http://stackoverflow.com/a/26142166
type: AnsweredQuestion
downvote count: 0
has body: Q. I am using the code below to carry out a task which it is doing, however when the app ends I get an error which basically says the thread below was not shut down properly. Does anyone know how to close down this kind of thread. private Handler aHandler = new Handler(); private final Runnable r = new Runnable() { @Override public void run() { updateProgress(); } }; private void updateProgress() { if (scrubber != null) Log.d("TAG", ...); aHandler.postDelayed(r, 1000); } // IN THE ON CREATE METHOD I USE runOnUiThread(new Runnable() { public void run() { updateProgress(); } }); Thankyou for your help but I am still getting error as can be seen below: 10-01 14:26:29.978: I/SurfaceView(19852): updateWindow -- OnPreDrawListener, mHaveFrame = true 10-01 14:26:29.978: D/dalvikvm(19852): threadid=15: interp stack at 0x60be9000 10-01 14:26:29.979: D/AndroidRuntime(19852): Shutting down VM 10-01 14:26:29.979: W/dalvikvm(19852): threadid=1: thread exiting with uncaught exception (group=0x41f76c98) 10-01 14:26:29.979: W/dalvikvm(19852): threadid=1: uncaught exception occurred 10-01 14:26:29.979: W/System.err(19852): java.lang.IllegalStateException 10-01 14:26:29.980: W/System.err(19852): at android.media.MediaPlayer.isPlaying(Native Method) 10-01 14:26:29.980: W/System.err(19852): at com.aviit.bluebox.MediaActivity.updateProgress(MediaActivity.java:162) 10-01 14:26:29.980: W/System.err(19852): at com.aviit.bluebox.MediaActivity.access$0(MediaActivity.java:157) 10-01 14:26:29.980: W/System.err(19852): at com.aviit.bluebox.MediaActivity$1.run(MediaActivity.java:153) 10-01 14:26:29.980: W/System.err(19852): at android.os.Handler.handleCallback(Handler.java:808) 10-01 14:26:29.980: W/System.err(19852): at android.os.Handler.dispatchMessage(Handler.java:103) 10-01 14:26:29.980: W/System.err(19852): at android.os.Looper.loop(Looper.java:193) 10-01 14:26:29.980: W/System.err(19852): at android.app.ActivityThread.main(ActivityThread.java:5292) 10-01 14:26:29.981: W/System.err(19852): …
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26142188
has comment: http://stackoverflow.com/comment/40980246
has answer: http://stackoverflow.com/a/26142166
has title: runOnUiThread how to close/shutdown thread
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26142188
has comment: http://stackoverflow.com/comment/40977090
favorite count: 0

http://stackoverflow.com/a/26071640
type: Answer
upvote count: 3
has body: As said in Oracle Documentation you can do it in the following way: Class&lt;?&gt; clazz = Class.forName(className); Constructor&lt;?&gt; ctor = clazz.getConstructor(String.class); Object object = ctor.newInstance(new Object[] { ctorArgument }); Let me to provide a very simple example of such using: Suppose we have that Main class and the class we need to instanciate are in the same package. Then we can act as follows: The class we need to instanciate: public class MyClass { public int myInt; public MyClass(Integer myInt){ this.myInt = myInt; } } main method: public static void main(String[] args) throws Exception { //Class name must contain full-package path // e.g. "full.pack.age.classname" String className = Main.class.getPackage().getName() + ".MyClass"; Class&lt;?&gt; clazz = Class.forName(className); //Class.getConstructor(Class&lt;?&gt; ... parameters) gives you a suitable constructor //depends on the argument types you're going to pass to them. Constructor&lt;?&gt; ctor = clazz.getConstructor(Integer.class); //Object creation and constructor call Object object = ctor.newInstance(new Object[] { 1 }); //1 is just myInt value passes to a contructor being invoked. System.out.println(((MyClass) object).myInt); //Prints 1 }
answers question: http://stackoverflow.com/q/26071619
downvote count: 0
score: 3

http://stackoverflow.com/comment/40893288
score: 0
has text: Why do you think the input has linebreaks? Maybe it is a string that must be parsed?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26095758

http://stackoverflow.com/comment/41039552
score: 0
has text: Further, re "collisions (i.e., keys that have distinct hash codes but fall into the same slot modulo the table size)" - a collision is a collision whether the hash codes were the same or not... that distinction is meaningful to whether a resize might remove the collision though.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26112957

http://stackoverflow.com/comment/40947281
has text: All you want to do is convert characters to numbers?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26125033

http://stackoverflow.com/a/26101947
has comment: http://stackoverflow.com/comment/40904380
type: Answer
has body: This should be enough to get the results. String.format("%,.2f", amount.setScale(2, RoundingMode.DOWN));
score: 18
upvote count: 18
downvote count: 0
answers question: http://stackoverflow.com/q/26101918

http://stackoverflow.com/a/26038085
type: Answer
answers question: http://stackoverflow.com/q/26037816
score: 0
has comment: http://stackoverflow.com/comment/40813144
has body: Yes definitely possible to come up a solution for the requirement specified above. Basically solr is a full text search engine, and all the fields are indexed in solr by default. One can carryout different type of operation on these fields through analyzers and tokenizers combinations. You can map all the searchable field to one specific field(which are called copy fields i.e like city name and street name -> text name) and operate your search on this one field to get result as desired. solr is RESTful search engine, and it serves data in xml and optional JSON format. Its really useful platform to operate over huge data and doesn't help mush over analytics part like calculations. Few of the benefits include auto-suggest, highlighting, facets, synonym search, n-gram search, auto-correct etc.
has comment: http://stackoverflow.com/comment/40788683

localhost
tags question: http://stackoverflow.com/q/26087194
type: Tag
tag name: localhost

http://stackoverflow.com/comment/40886004
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26091682
has text: Strange indeed. Rolled back and flagged.
score: 0

http://stackoverflow.com/q/26101996
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26102090
answer count: 2
has answer: http://stackoverflow.com/a/26102090
upvote count: 1
accepted answer: http://stackoverflow.com/a/26102085
has title: how to add days to date(set in jlabel)
favorite count: 0
has body: private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { Date date3=null; try { date3 = new SimpleDateFormat("dd-MM-YYYY").parse(jLabel1.getText()); System.out.println(date3); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY"); Calendar cal = Calendar.getInstance(); cal.setTime(date3); cal.add(Calendar.DATE, 1); String expDateString = sdf.format(cal.getTime()); jLabel2.setText(expDateString); } catch (ParseException ex) { Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex); } } jlabel1 input value is :29-09-2014.> Add 1 day.expected output is:30-09-2014.(jlabel2) But No error occured,output displayed:30-12-2014.(meaningless).
has answer: http://stackoverflow.com/a/26102085
tagged with: swing

http://stackoverflow.com/q/26165433
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26166273
favorite count: 0
has body: I'm a Java developer that hasn't coded in about 5 years and wants to polish up my skills. I am going to create a small app that uses an OAuth 2.0 authentication flow and then makes a few REST calls and displays the results. I've got my credentials setup with the OAuth provider. I used Eclipse back in the day, is that still a solid IDE for this type of project? If I want to share the app with others to show my work, where could I host the code? Thanks for these and any other pointers.
type: Question
tagged with: oauth
tagged with: oauth-2.0
upvote count: 1
answer count: 1
has title: Please suggest approach for Java-based web app
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41021824
has comment: http://stackoverflow.com/comment/41024091

http://stackoverflow.com/comment/41030728
type: Comment
has text: Make up your mind. 'Don't assume', or 'I would assume'? The exception isn't thrown by the class you mention.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26166388

http://stackoverflow.com/q/26177232
tagged with: eclipse
tagged with: gradle
type: Question
answer count: 2
upvote count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41042464
favorite count: 0
has answer: http://stackoverflow.com/a/26177375
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41042541
has title: Android Studio or Eclipse working with maven/gradle
score: -3
tagged with: maven
has answer: http://stackoverflow.com/a/26178405
has body: I would like to make progress in development of android mobile distributed systems. It would cover introducing TDD with continuous integration and especially support for maven/gradle. It would be good to make all robust. Regards The question is (regarding further specs), what would be the most suitable IDE choice. I know mostly it is the matter of a personal pros and cons. But the aim is to be robust and support automaticity during development. So no personal factors.
tagged with: java
downvote count: 3

http://stackoverflow.com/a/26057452
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26057245
type: AcceptedAnswer
has body: The equation of movment with constant speed is simple positionX = startPositionX + speedX * time positionY = startPositionX + speedY * time where speedX = speed * sin(angle) speedY = speed * cos(angle) But most of the game use incremental aproach posX = posX + speedX / lengthOfTick posY = posY + speedY / lengthOfTick
answers question: http://stackoverflow.com/q/26057245
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/40898554
type: AnswerComment
has text: then i'll ping you after 2 days! :D
type: Comment
comment on: http://stackoverflow.com/a/26097142
score: 0

http://stackoverflow.com/q/26105254
answer count: 3
has answer: http://stackoverflow.com/a/26364397
has answer: http://stackoverflow.com/a/26306455
favorite count: 0
linked to: http://stackoverflow.com/q/18463543
tagged with: pdf-generation
type: AnsweredQuestion
has body: I'm trying to add underlined text to a blank pdf page using PDFBox, but I haven't been able to find any examples online. All questions on stackoverflow point to extracting underlined text, but not creating it. Has this function not been implemented for PDFBox? Looking at the PDFBox documentation, it seems that fonts are pre-rendered as bold, italic, and regular. For example, Times New Roman Regular is denoted as: PDFont font = PDType1Font.TIMES_ROMAN. Times New Roman Bold is denoted as: PDFont font = PDType1Font.TIMES_BOLD Italicized is denoted as: PDFont font = PDType1Font.TIMES_ITALIC There seems to be no underlined option. Is there anyway to underline text, or is this not a feature?
accepted answer: http://stackoverflow.com/a/26364397
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/18781923
score: 5
has comment: http://stackoverflow.com/comment/40914619
upvote count: 5
has title: Setting a text style to underlined in PDFBox
downvote count: 0
tagged with: pdfbox
possible better answer: http://stackoverflow.com/a/58813794
has comment: http://stackoverflow.com/comment/40913443
has answer: http://stackoverflow.com/a/58813794

http://stackoverflow.com/comment/41070322
comment on: http://stackoverflow.com/q/26192111
score: 1
type: Comment
has text: if you refer to "!" it'not a typo, it's the negation operator! anyway, if you need to decide the type of item at runtime, the only way to do it is to replace Object fields with generics. If "item" can be an instance of a your class, you have to provide an equals() override, and the game is done
type: QuestionComment

http://stackoverflow.com/comment/40972514
comment on: http://stackoverflow.com/a/26097553
score: 0
has text: @EmrehanTuzun: The behaviour you explain sounds strange. Please post your exact code that failed. (The method and the code that called it)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41033381
has text: So I haven't gone mad staring at the screen all night. Will look into this further and see if I can work it out. Thanks for maintaining my sanity.
comment on: http://stackoverflow.com/q/26171897
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26089576
has comment: http://stackoverflow.com/comment/40905723
answers question: http://stackoverflow.com/q/26041712
has comment: http://stackoverflow.com/comment/40917589
has comment: http://stackoverflow.com/comment/40910217
has comment: http://stackoverflow.com/comment/40884627
score: 4
has comment: http://stackoverflow.com/comment/40992330
has comment: http://stackoverflow.com/comment/40986678
has comment: http://stackoverflow.com/comment/40992079
has comment: http://stackoverflow.com/comment/41128023
type: Answer
has comment: http://stackoverflow.com/comment/40991226
upvote count: 4
has comment: http://stackoverflow.com/comment/41118297
has comment: http://stackoverflow.com/comment/40986767
has comment: http://stackoverflow.com/comment/40887190
has comment: http://stackoverflow.com/comment/40987106
has comment: http://stackoverflow.com/comment/40981561
has comment: http://stackoverflow.com/comment/40910005
downvote count: 0
has body: Please see this page on the slf4j site. I suspect you've not included the appropriate bridge jar. For example, for log4j, you're going to need the following stanzas in your pom.xml: org.slf4j slf4j-api 1.7.7 org.slf4j slf4j-log4j12 1.7.7 org.slf4j log4j-over-slf4j 1.7.7 log4j log4j 1.2.17 Hope that helps. If not, feel free to leave a comment.

http://stackoverflow.com/a/26039382
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26039335
upvote count: 8
accepted answer of: http://stackoverflow.com/q/26039335
type: Answer
score: 8
has body: In Java 8 you could make use of the Streams API: List&lt;String&gt; mObj = Stream.of("m1","m2","m3").collect(Collectors.toList()); Pre Java 8 simply use: List&lt;Model&gt; mObj = new ArrayList&lt;&gt;(Arrays.asList(m1, m2, m3)); For for information on this see: Collectors Arrays.asList

http://stackoverflow.com/comment/41053269
type: QuestionComment
comment on: http://stackoverflow.com/q/26043895
score: 0
type: Comment
has text: That's not existent atm because I can't get it to bind so I just scrapped it. I'll grab my code when I get a chance. I was more asking how would I structure the server-side code to deal with the nested classes.

http://stackoverflow.com/q/26145425
score: 2
accepted answer: http://stackoverflow.com/a/26221786
tagged with: jxloginpane
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41045756
answer count: 3
has body: I've got a dialog window for logging in a user to a main program in Java. I've recently discovered, however, that if the user clicks the "Cancel" button or the window's native Close button, the program still runs, even if the login window itself has been disposed of. I have to force quit it. My instincts tell me that it has to do with the LoginService that is created as part of creating a JXLoginPane. Here is my (well-documented) code: package info.chrismcgee.sky; import info.chrismcgee.beans.Login; import info.chrismcgee.dbutil.LoginConnectionManager; import info.chrismcgee.login.PasswordHash; import info.chrismcgee.tables.LoginManager; import java.awt.BorderLayout; import java.awt.Component; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jdesktop.swingx.JXLoginPane; import org.jdesktop.swingx.auth.LoginService; public class LoginDialog extends JDialog { // For logging! static final Logger log = LogManager.getLogger(LoginDialog.class.getName()); /** * Serialize, to keep Eclipse from throwing a warning message. */ private static final long serialVersionUID = 52954843540592996L; private final JPanel contentPanel = new JPanel(); // default. // The login pane is a field because it needs to be called // by the "OK" button later. private JXLoginPane loginPane; // User bean is a field because two inner methods need to access it, // and it would be cheaper to only create one bean. private Login bean; /** * Launch the application. * Unedited. */ public static void main(String[] args) { log.entry("main (LoginDialog)"); EventQueue.invokeLater(new Runnable() { @Ove…
possible better answer: http://stackoverflow.com/a/26147250
has answer: http://stackoverflow.com/a/26147250
upvote count: 2
has answer: http://stackoverflow.com/a/26235902
has answer: http://stackoverflow.com/a/26221786
has comment: http://stackoverflow.com/comment/41029641
has title: Login dialog window won't dispose completely
tagged with: swing
has comment: http://stackoverflow.com/comment/41125683
has comment: http://stackoverflow.com/comment/41051266
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41054031
has comment: http://stackoverflow.com/comment/41062011
tagged with: java
tagged with: dispose
type: Question
linked to: http://stackoverflow.com/q/25046336
has comment: http://stackoverflow.com/comment/41078351

http://stackoverflow.com/comment/40874753
type: Comment
has text: @Michael it is sub-optimal to have a large number of threads and having 10K threads can waste a whole CPU. While it is more complicated to use less threads, there is nothing stopping you from doing either way AFAICS.
comment on: http://stackoverflow.com/a/26085337
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40802516
score: 0
type: Comment
has text: I could have done it, but I would have to change a lot of code on my project, I have more than 300 entities, and it would require too much work to do it.
type: QuestionComment
comment on: http://stackoverflow.com/q/26045966

http://stackoverflow.com/q/26110012
type: Question
score: 0
tagged with: r.java-file
has comment: http://stackoverflow.com/comment/40919244
answer count: 1
has body: There are other questions about the topic but this one is somehow different. Basically I have this class called "Player" that I multiply for a certain number of times. This class generates random coordinates in the canvas and the bitmaps move towards those coordinates. Now the problem is that some of them overlap with one another making it look "unrealistic". I've tried a simple "if" statement inside the "Player" class but it doesn't work, since every instance of the class takes into count only its variables and ignores the variables of the other instances. Here's the code: I have this first class with another class nested: public class MainActivity extends Activity{ Game gameView; float k,l; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gameView = new Game(this); setContentView(gameView); } public class Game extends SurfaceView implements Runnable { Canvas canvas; SurfaceHolder ourHolder; Thread ourThread = null; boolean isRunning = true; Player[] player = new Player[3]; public Game(Context context) { super(context); ourHolder = getHolder(); ourThread = new Thread(this); ourThread.start(); for(int i=0; player.length &lt; i; i++){ player[i] = new Player(context); } } public void run() { while(isRunning) { if(!ourHolder.getSurface().isValid()) continue; canvas = ourHolder.lockCanvas(); canvas.drawRGB(200, 200, 200); for ( int i = 0; player.length &lt; i; i++){ player[i].draw(canvas); player[i].move(); } ourHolder.unlockCanvasAndPost(canvas); } } } } And here's the player class: public class Player { Bitmap base; float x = (float) (Math.random()*200); float y = (float) (Math.random()*200); float e = (float) (Math.random()*200); float r = (float) (Math.random()*200); public Player(Context context) { super(); base = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher); } public void draw(Canvas canvas) { if(x &gt; e-5 &amp;&amp; x &lt; e+5 &amp;&amp; y &gt; r-5 &amp;&amp; y &lt; r+5){ e = (float) (Math.r…
has title: Android: Is there a way to program "collision detection" between two instances of an object?
favorite count: 0
tagged with: android
tagged with: bitmap
has answer: http://stackoverflow.com/a/26110264
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26110264
downvote count: 1

http://stackoverflow.com/q/26046070
linked to: http://stackoverflow.com/q/1384947
type: Question
has answer: http://stackoverflow.com/a/26047073
has answer: http://stackoverflow.com/a/26046215
has comment: http://stackoverflow.com/comment/40803443
answer count: 3
tagged with: android
has body: I made this code for getting file extensions array for checking if any images are in that folder: if (file.isDirectory()) { listFile = file.listFiles(); extension = new String[listFile.length]; for (int i = 0; i &lt; listFile.length; i++) { FilePathStrings[i] = listFile[i].getAbsolutePath(); FileNameStrings[i] = listFile[i].getName(); int ex = FilePathStrings[i].lastIndexOf('.'); if (ex &gt;= 0) { extension[i] = FilePathStrings[i].substring(ex+1); } } if (!Arrays.asList(extension).contains("jpg") || !Arrays.asList(extension).contains("jpeg") || !Arrays.asList(extension).contains("png")) { //Do Something } But it's always returns true even if there are some images with exact "jpg" extension in the path (the part that gets file path and listfile is 100% working). I tried with both filename and filepath but non of them worked.
has answer: http://stackoverflow.com/a/26046456
possible better answer: http://stackoverflow.com/a/26046215
accepted answer: http://stackoverflow.com/a/26047073
has comment: http://stackoverflow.com/comment/40802192
has comment: http://stackoverflow.com/comment/40802596
type: AnsweredQuestion
score: 0
tagged with: java
has title: getting file extension method is not working properly

http://stackoverflow.com/comment/73165986
comment on: http://stackoverflow.com/a/28000846
type: Comment
has text: my example is based on this lib https://github.com/tyczj/ExtendedCalendarView and "listViewCalendar" ist just a normal ListView.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26171365
has comment: http://stackoverflow.com/comment/46474085
favorite count: 0
tagged with: svnkit
tagged with: linux
linked to: http://stackoverflow.com/q/24403997
has title: SVNKit authentication error E170001, but only when checking out and only on one computer
has body: I'm completely stumped by an SVNKit (1.8.5) error that I'm running in to. I'm using the following pattern to build up an Authentication Manager: public static SVNRepository getSvnRepository(String userName, String pass, String repoURL) throws SVNException { SVNRepository repository; repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repoURL)); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, pass); repository.setAuthenticationManager(authManager); return repository; } I use this pattern in several places to make sure that the user can authenticate against the repository, to get a listing of all of the folders in the repository, and even to explore the top level of the subfolders in order to parse a file and build up a dependency graph. All of this succeeds. But when I attempt to run a checkout, I get an authentication error. Puzzlingly, this error only happens on one computer at our office. Several other computers all running OS X, Windows, and various versions of Ubuntu take no issue with this process and can check out no problem but one particular computer running Ubuntu 12.10 fails hard trying to run the following: SVNRepository repository = getSvnRepository(userName, pass, url + "/" + subfolder); SvnOperationFactory factory = new SvnOperationFactory(); SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(repository.getLocation())); checkout.setSingleTarget(SvnTarget.fromFile(location.resolve(project).toFile())); checkout.run(); The stack trace: org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for '&lt;https://[snip]:443&gt;' at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41) at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthentica…
has comment: http://stackoverflow.com/comment/41038049
has comment: http://stackoverflow.com/comment/46482441
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77079248
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26172361
possible better answer: http://stackoverflow.com/a/51768600
has answer: http://stackoverflow.com/a/51768600
has title: log4j formatted printing in java
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26172933
has body: This is my first java program in 10 years. I am trying to do formatted printing while logging errors with log4j 2. My code is import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Feeder { private static final Logger logger = LogManager.getLogger(Feeder.class); public static void main(String args[]) throws InterruptedException { try { for (int i = 0; i &lt; 100; i++) { logger.info("Hello World " + i); Thread.sleep(4000); int x = 100 / 0; } } catch (Exception ex){ StackTraceElement var[] = ex.getStackTrace(); for(StackTraceElement s: var){ logger.error("Error in Filename = %s", s.getFileName()); logger.error("Error in Class = " + s.getClassName()); logger.error("Error in line number " + s.getLineNumber()); logger.error("Error in method " + s.getMethodName()); } //logger.error(ex.); logger.error(ex.getMessage()); } } } The log spits the following 03 Oct 2014 12:12:46,302 INFO com.bluepoint.Feeder - Hello World 0 03 Oct 2014 12:12:50,304 ERROR com.bluepoint.Feeder - Error in Filename = %s How do I get the file name instead of %s
tagged with: log4j
type: AnsweredQuestion
upvote count: 3
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26172933

http://stackoverflow.com/comment/40906921
comment on: http://stackoverflow.com/q/26102635
has text: But it doesn't work ... , When the exception occurs it s being set to true, i don t know how can i find exactly where this boolean can be set.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41018773
has text: And what is the title of the question?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26164194
type: Comment

http://stackoverflow.com/a/26122725
type: Answer
answers question: http://stackoverflow.com/q/26122525
has comment: http://stackoverflow.com/comment/40945584
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26122525
has body: Since you're using two different layouts here, you should use Android's mechanism to properly reuse convertviews. Check out the tutorial here: http://antoine-merle.com/blog/2013/06/11/making-a-multiple-view-type-adapter-with-annotations/ In your case, you have only two types of views: "my" and "their", so override getViewTypeCount() method to return 2, and getItemViewType() to return proper type based on position.

http://stackoverflow.com/comment/40783811
comment on: http://stackoverflow.com/q/26035204
has text: @MadProgrammer, add humble as well, thank you. how do you mark the question as closed?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26117425
answers question: http://stackoverflow.com/q/26117230
type: Answer
has body: The issue here is that (unlike most other languages) in java, matches() must match the whole string to be true, so add ".*" to each end of the pattern. Because you have newline chars in your input, you also need to add (?s) to turn on the DOTALL flag, which causes the dot to match newlines too: boolean b = Pattern.matches("(?s).*\\b"+searchStr+"\\b.*", line);
score: 0
has comment: http://stackoverflow.com/comment/40931900

http://stackoverflow.com/comment/40815957
has text: Actually my one project is in Spring boot and second one is Dynamic web project, I have updated the pom.xml as per requirement.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26053661

http://stackoverflow.com/comment/40972927
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26139805
has text: Prone to sql-injection, thus not recommended.

http://stackoverflow.com/q/26086760
has answer: http://stackoverflow.com/a/42093718
has body: I have a simple question. Is there a way to configure NetBeans so that after build JUnit tests in test package would run automatically ? I'm using NetBeans 8.0.1. Thanks in advance.
answer count: 2
downvote count: 0
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40879129
upvote count: 1
tagged with: junit4
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26088075
type: Question
has title: Automatically run junit tests after build in NetBeans 8.0.1

http://stackoverflow.com/a/26164538
answers question: http://stackoverflow.com/q/26158913
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/41021943
score: 4
type: Answer
has body: In Spring Reference at this link e.g. in Spring reference @Before("com.xyz.lib.Pointcuts.anyPublicMethod() &amp;&amp; @annotation(auditable)") public void audit(Auditable auditable) { AuditCode code = auditable.value(); // ... } the execution of any method defined by the AccountService interface: execution(* com.xyz.service.AccountService.*(..)) any join point (method execution only in Spring AOP) where the executing method has an @Transactional annotation: @annotation(org.springframework.transaction.annotation.Transactional) I suggest you to use... @Before("execution(* com.xyz.WithSession.*(..)) &amp;&amp; @annotation(authorization)") public void adviceBeforeWithAuthorizationMethodFromClassImplementingWithSession(WithAuthorization authorization) { // code A2 }

http://stackoverflow.com/comment/40803830
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26045798
has text: Have you tried with the default Sun/Oracle JSSE instead of RSA/Jsafe? (jTDS might also be of interest.)

http://stackoverflow.com/comment/41061295
comment on: http://stackoverflow.com/q/26187046
type: QuestionComment
score: 2
has text: it would really nice if you would share the solution that you are working on.
type: Comment

http://stackoverflow.com/comment/41003510
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26156102
type: Comment
has text: It was the jar file that got corrupted. So after I replaced the jar file, the EOF exception went away. I edited my original question and deleted the EOF exception problem I was first having. But even now, I still don't have the two files replaced.

http://stackoverflow.com/a/26036474
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26036242
downvote count: 0
has comment: http://stackoverflow.com/comment/40944318
has body: YoungGen/OldGen &amp; PermGen are the three areas where the Java Heap resides. The JVM is well versed with the boundaries of each. While collecting the garbage the GC first decides on which space to run and then identifies the GC roots of each object in that space. Whether an Object is young or old is specified by the Space in which it resides in the Heap. The GC maintains the state of each Object too like how many GC cycles each object has survived which gives the GC an estimation whether the time is appropriate to move an object from Young to Old. An Object Graph decides if a young Gen Object is referenced by an Old Gen reference. If an Object is compacted the Reference is also updated. This also happens when Objects move from Young > Old Gen.
type: Answer

http://stackoverflow.com/a/26106820
answers question: http://stackoverflow.com/q/26106783
has comment: http://stackoverflow.com/comment/40913485
type: Answer
accepted answer of: http://stackoverflow.com/q/26106783
score: 2
downvote count: 0
has body: Remove the break statements in your code. The break statements causes the inner loops to terminate prematurely. I've tested your code and it generates 81 cards without the break statements. See this example: http://ideone.com/SVsXPi
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/40864160
type: Comment
comment on: http://stackoverflow.com/a/26079898
score: 0
type: AnswerComment
has text: @user3439600 - Read the update. (The answer is that you shouldn't do it that way. Maintaining a simple list ordered by `count` will give you `O(N)` performance on insertion / update.)

http://stackoverflow.com/comment/40976636
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26141759
type: Comment
has text: I dont need to takecare of the days, only years.

http://stackoverflow.com/a/26045334
has comment: http://stackoverflow.com/comment/40903065
type: Answer
upvote count: 1
score: 1
has body: How you are making the call from Scala can matter. In particular, avoid objects and static initializers. That is, avoid running an expensive computation as part of the constructor for an object, which is run during class initialization. That tends to run deoptimized. The old issues here and especially here are symptomatic.
downvote count: 0
answers question: http://stackoverflow.com/q/26041475

http://stackoverflow.com/comment/41002497
has text: you need to define it on the build pom , which means that Your project must either defined by your local folder path or defined inside the maven repo so it can build other application depending on it
score: 0
comment on: http://stackoverflow.com/q/26155590
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26121594
tagged with: marshalling
type: Question
accepted answer: http://stackoverflow.com/a/26126582
has title: Java Object extending a list to Json with Jackson
tagged with: jackson
tagged with: inheritance
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26126582
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I want to convert a object that is extending a list to Json using Jackson. Example: public class TryToSerialize extends ArrayList&lt;String&gt; { private int number; private String word; public TryToSerialize(){ number = 0; word = ""; } @JsonProperty public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } @JsonProperty public String getWord() { return word; } public void setWord(String word) { this.word = word; } @JsonIgnore public String getAsJSON() throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(new File("c:\\tts.json"), this); return mapper.writeValueAsString(this) ; } } When I do serialize this I will only get the Array portion. TryToSerialize tts = new TryToSerialize(); tts.setNumber(10); tts.setWord("Working"); tts.add("first"); tts.add("second"); tts.add("third"); String json = tts.getAsJSON(); Json: ["first","second","third"] I am looking for a way to include the other variables of the object.

http://stackoverflow.com/q/26192484
answer count: 2
has title: JFrame - accessing my window from keylistener class
has comment: http://stackoverflow.com/comment/41169318
has answer: http://stackoverflow.com/a/26193960
has body: I am creating JFrame window In one class called Core and then in Main creating the window like this: Core window = new Core("GAME1", 0, 0, true, true); But then I decided to use keylistener and I created another class called Core_ControlsL: My problem is that in here: else if(keyCode == 113) { GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this.window); } I cannot figure out how to access window so that when I press F2 it goes into full screen again. import javax.swing.UnsupportedLookAndFeelException; This is my main.java: public class Main { public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { Core window = new Core("GAME1", 0, 0, true, true); } } This is the Core.java: import java.awt.GraphicsEnvironment; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; public class Core extends JFrame implements ActionListener { private final String Game_Title; private int Window_Width; private int Window_Height; private boolean isVisible; private boolean isResizeable; public Core(String Game_Title, int Window_Width, int Window_Height, boolean isVisible, boolean isResizeable) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); this.Game_Title = Game_Title; this.Window_Width = Window_Height; this.Window_Height = Window_Height; this.isResizeable = isResizeable; this.isVisible = isVisible; //Create JFrame JFrame window = new JFrame(Game_Title); window.setSize(Window_Width, Window_Height); window.setResizable(isResizeable); window.setExtendedState(JFrame.MAXIMIZED_BOTH); window.setVisible(isVisible); window.addKeyListener(…
has answer: http://stackoverflow.com/a/26192524
tagged with: jframe
type: UnansweredQuestion
type: Question
tagged with: java
score: 0

http://stackoverflow.com/q/26138381
tagged with: spring-security
score: 0
has body: when user login one side and another user login from same password and user name (from another machine ) ,at that time first user logout from automatically on every time when second user invalidate the first session. I am using the server side session , i have login flag in data base user is already login or not .any idea friends
has comment: http://stackoverflow.com/comment/40971332
answer count: 1
has answer: http://stackoverflow.com/a/26147980
tagged with: spring-webflow
has title: How to invalidate the session in spring web flow?
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
type: Question
tagged with: session

http://stackoverflow.com/comment/41019067
score: 0
has text: Thanks Floegipoky. Deleting all versions from my local repo (except 2.9.3) did the trick. Still very annoyed with Eclipse that was telling me it was using that version, while in fact it was not!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26162855

http://stackoverflow.com/comment/40841609
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26067298
has text: Also you never wrote a `toString()` method for the `Node` class so `System.out.println(tree.root)` simply dumps the name of the object(ex. BinaryTree$Node@1db9742)
score: 0

http://stackoverflow.com/q/26089917
type: UnansweredQuestion
has title: How to define c3p0 properties in the application.properties file of Spring
score: 2
downvote count: 0
tagged with: java
tagged with: spring-data
type: Question
has comment: http://stackoverflow.com/comment/40891365
has answer: http://stackoverflow.com/a/30863180
tagged with: c3p0
upvote count: 2
answer count: 2
has body: I want to define c3p0 properties in the application.properties file. But c3p0 properties seem not to be recognised. What goes wrong? Is there an example of an application.properties file with c3p0 settings? spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.url=jdbc:jtds:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}?autoReconnect=true spring.datasource.username=${OPENSHIFT_MYSQL_DB_USERNAME} spring.datasource.password=${OPENSHIFT_MYSQL_DB_PASSWORD} spring.jpa.properties.hibernate.show_sql=true spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect spring.jpa.properties.hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider c3p0.properties.driverClassName=com.mysql.jdbc.Driver c3p0.properties.url=jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}?autoReconnect=true c3p0.properties.username=${OPENSHIFT_MYSQL_DB_USERNAME} c3p0.properties.password=${OPENSHIFT_MYSQL_DB_PASSWORD} c3p0.properties.acquire_increment=1 c3p0.properties.idle_test_period c3p0.properties.timeout=14400 c3p0.properties.max_size=20 c3p0.properties.max_statements=50 c3p0.properties.min_size=3
has comment: http://stackoverflow.com/comment/40883499
favorite count: 0
has answer: http://stackoverflow.com/a/43160737

http://stackoverflow.com/a/26166190
upvote count: 2
answers question: http://stackoverflow.com/q/26165956
type: Answer
has body: You should really consider breaking your code apart into subroutines; breaking it up will help compartmentalize the different functions. As to your bug; I think you are saying that all accounts have the same value, and that you are not expecting that. Your code is as follows, when creating a new account: for (int i=0; i&lt;account.length; i++) { account[i] = new BankAccount(id, balance, interestRate); } Every time you run that line, you are replacing every element in your array with a new BankAccount object.
score: 2
has comment: http://stackoverflow.com/comment/41022495
downvote count: 0
has comment: http://stackoverflow.com/comment/41022841
has comment: http://stackoverflow.com/comment/41028403

http://stackoverflow.com/comment/50460083
type: Comment
comment on: http://stackoverflow.com/a/31219539
score: 0
type: AnswerComment
has text: @mattm If you look at [specifications](https://stomp.github.io/stomp-specification-1.2.html), STOMP uses frames for comminucation. That means "CONNECT" frame sent over websocket on connection, and "DISCONNECT" frame sent on disconnection, and Spring's SessionDisconnectEvent can detect it. So without timeout your server detect disconnect ASAP.

http://stackoverflow.com/comment/41022490
has text: Instead of creating one file, I get two files with the same name and same extension in the same directory.
score: 0
comment on: http://stackoverflow.com/q/26154958
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26051179
has comment: http://stackoverflow.com/comment/40811720
upvote count: 1
has comment: http://stackoverflow.com/comment/40833994
has comment: http://stackoverflow.com/comment/40811531
has comment: http://stackoverflow.com/comment/40834218
score: 1
has comment: http://stackoverflow.com/comment/40833908
has comment: http://stackoverflow.com/comment/40811670
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40833319
has comment: http://stackoverflow.com/comment/40833242
has body: 1)You cannot call getIntent() inside a Fragment as it's not an Activity and so one does not inherit Activity's methods/ You should try using getActivity().getIntent() if you are really sure that this is what you are looking for. 2)This method asks you for a Context and you are passing it an Activity, and then asks you for a class that extends an activity and you are passing it a fragment. For the first argument i would call getActivity().getApplicationContext() and as a second argument getActivity(). Edit: Try casting the getActivity() like: (Activity) getActivity() ParseAnalytics.trackAppOpened(((Activity)getActivity()).getIntent()); // inform the Parse Cloud that it is ready for notifications PushService.setDefaultPushCallback(((Activity)getActivity()).getApplicationContext(), ((Activity)getAcitivty()));
has comment: http://stackoverflow.com/comment/40811557
has comment: http://stackoverflow.com/comment/40833878
answers question: http://stackoverflow.com/q/26051126
has comment: http://stackoverflow.com/comment/40811519
has comment: http://stackoverflow.com/comment/40811706
type: Answer
has comment: http://stackoverflow.com/comment/40842049
accepted answer of: http://stackoverflow.com/q/26051126
has comment: http://stackoverflow.com/comment/40811840

http://stackoverflow.com/q/26171106
upvote count: 1
has comment: http://stackoverflow.com/comment/41031702
answer count: 1
downvote count: 1
has title: Algorithm to merge two objects the most efficiently
has body: I have a class Level1 that contains a String and a list of Level2 objects. The Level2 objects each contain a String and a list of Level3 objects. The Level3 objects each contain 2 String attributes, attribute1 and attribute2. (This is similar to a a 3 level tree) Now I have two objects of class Level1 : objectA and objectB. objectB is included in objectA. All the branches within B will have a match in A). objectA leaves will have attribute1. objectB will have attribute2. I want to most efficient way to merge objectA to objectB. By merge I mean the new object will have all the branches and attributes of objectA and the attributes of objectB where corresponding. All nodes are unique. A dummy algorithm would have a O(n^2) complexity, which is not good for my purpose. Because of the tree I'm hoping there is a O(n log n) but I can't find it Thanks! Class for Level1: public class Level1 { private String level1string; private List&lt;Level2&gt; level2List; public String getLevel1string() { return level1string; } public void setLevel1string(String level1string) { this.level1string = level1string; } public List&lt;Level2&gt; getLevel2List() { return level2List; } public void setLevel2List(List&lt;Level2&gt; level2List) { this.level2List = level2List; } } Class for Level2: public class Level2 { private String level2string; private List&lt;Level3&gt; level3List; public String getLevel2string() { return level2string; } public void setLevel2string(String level2string) { this.level2string = level2string; } public List&lt;Level3&gt; getLevel3List() { return level3List; } public void setLevel3List(List&lt;Level3&gt; level3List) { this.level3List = level3List; } } Class for Level3: public class Level3 { private String attribute1; public String getAttribute1() { return attribute1; } public void setAttribute1(String attribute1) { this.attribute1 = attribute1; } public String getAttribute2() { return attribute2; } public void setAttribute2(String attribute2) { this.attribute2 = attribu…
has comment: http://stackoverflow.com/comment/41032264
favorite count: 0
has comment: http://stackoverflow.com/comment/41031723
has comment: http://stackoverflow.com/comment/41031780
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41032367
tagged with: java
has comment: http://stackoverflow.com/comment/41031684
has comment: http://stackoverflow.com/comment/41031869
has comment: http://stackoverflow.com/comment/41032150
has comment: http://stackoverflow.com/comment/41031712
has comment: http://stackoverflow.com/comment/41031857
has comment: http://stackoverflow.com/comment/41031538
type: Question
accepted answer: http://stackoverflow.com/a/26171658
has comment: http://stackoverflow.com/comment/41031741
has comment: http://stackoverflow.com/comment/41032034
has comment: http://stackoverflow.com/comment/41032361
has comment: http://stackoverflow.com/comment/41032229
has comment: http://stackoverflow.com/comment/41031765
score: 0
has comment: http://stackoverflow.com/comment/41031829
has answer: http://stackoverflow.com/a/26171658
has comment: http://stackoverflow.com/comment/41032208

http://stackoverflow.com/a/26090362
accepted answer of: http://stackoverflow.com/q/26090262
answers question: http://stackoverflow.com/q/26090262
has body: The problem seems to be here public void setArray1 (int[] farray) { int[] data1 = new int[180]; //int[] farray = new int[180]; data1 = farray; } You're declaring a new variable called data1 and storing the content of farray to it. After that method is done, that variable will be removed, due to his scope. Remove int[] from the line int[] data1 = new int[180]; (or just remove the whole line .. it is unnecessary) and your data will be stored in the correct variable that was declared for the class. public void setArray1 (int[] farray) { data1 = farray; }
type: AcceptedAnswer
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/40883410
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/66790625
has comment: http://stackoverflow.com/comment/66789364

http://stackoverflow.com/q/26177383
type: Question
has title: Clear button not function
has comment: http://stackoverflow.com/comment/41042778
has comment: http://stackoverflow.com/comment/41042793
score: 0
has body: I just started learning about Java programming and have been trying to code a program that calculates the amount of pain that is needed for a certain area of space. The program runs but the clear button is not functioning. I have checked everything and tried everything but still can't find the problem. Please help! // declarations Color black = new Color(0, 0, 0); Color white = new Color(255, 255, 255); Color light_gray = new Color(192, 192, 192); DecimalFormat currency; JTextField currencyJTextField; JLabel roomWidthJLabel; JTextField roomWidthJTextField; JLabel roomLengthJLabel; JTextField roomLengthJTextField; JLabel numberofGallonsJLabel; JTextField numberofGallonsJTextField; JLabel subTotalJLabel; JTextField subTotalJTextField; JLabel salesTaxJLabel; JTextField salesTaxJTextField; JLabel totalAmountJLabel; JTextField totalAmountJTextField; JButton enterJButton; JButton clearJButton; double roomWidth; double roomLength; double numberofGallons; double subTotal; double salesTax; double totalAmount; public PaintCalculator() { createUserInterface(); } public void createUserInterface() { Container contentPane = getContentPane(); contentPane.setBackground(white); contentPane.setLayout(null); // initialize components // input roomWidthJLabel = new JLabel (); roomWidthJLabel.setBounds (50, 20, 150, 20); roomWidthJLabel.setFont(new Font("Default", Font.PLAIN, 12)); roomWidthJLabel.setText ("Enter Width of Room (Ft):"); roomWidthJLabel.setForeground(black); roomWidthJLabel.setHorizontalAlignment(JLabel.LEFT); contentPane.add(roomWidthJLabel); roomWidthJTextField = new JTextField(); roomWidthJTextField.setBounds(230, 20, 100, 20); roomWidthJTextField.setFont(new Font("Default", Font.PLAIN, 12)); roomWidthJTextField.setHorizontalAlignment(JTextField.CENTER); roomWidthJTextField.setForeground(black); roomWidthJTextField.setBackground(white); roomWidthJTextField.setEditable(true); contentPane.add(roomWidthJTextField); roomLengthJLabel = new JLabel(); roomLengthJLabel.setBound…
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41045473

http://stackoverflow.com/comment/40975390
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26137770
has text: How does that even add more than one element since it returns after first iteration in the loop?
score: 0

http://stackoverflow.com/q/26152578
has body: I'm trying to learn ReST for work and I am trying to make a simple test project to act as a smoke test. I made four classes. @ApplicationPath("/rest") public class RestApplication extends Application { } ... @Path("/testClassURL") @Stateless public class TestClass { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/testMethodNoParamURL") public TestBean testMethod() { TestBean ret = new TestBean(); ret.setNum(5); ret.setStr("9087".concat("1234")); return ret; } } The other two are simple classes consisting of only the getters and setters. You can see them there. Based on the path annotations I've set I should be able to enter this URL localhost:8080/TestWebRest/testClassURL/testMethodNoParamURL Which should get me a JSON response. Unfortunately all I get is the following 500 error [2014-10-01T20:00:02.360-0400] [glassfish 4.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=24 _ThreadName=http-listener-1(4)] [timeMillis: 1412208002360] [levelValue: 900] [[ StandardWrapperValve[testyTest.RestApplication]: Allocate exception for servlet testyTest.RestApplication java.lang.IllegalStateException: The resource configuration is not modifiable in this context. at org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:257) at org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:205) at org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:435) at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:261) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349) at javax.servlet.GenericServlet.init(GenericServlet.java:244) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237…
has title: Learning REST, stuck on IllegalStateException
upvote count: 5
accepted answer: http://stackoverflow.com/a/26152599
possible better answer: http://stackoverflow.com/a/29015213
answer count: 2
has answer: http://stackoverflow.com/a/26152599
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29015213
tagged with: rest
type: AnsweredQuestion
tagged with: java
type: Question
score: 5

speech
tags question: http://stackoverflow.com/q/26119715
tag name: speech
type: Tag
tags question: http://stackoverflow.com/q/26171103

http://stackoverflow.com/comment/41055588
type: QuestionComment
has text: What is n.interval in the first query? Can you show the formats of the dates?
comment on: http://stackoverflow.com/q/26183655
score: 0
type: Comment

http://stackoverflow.com/q/26055695
type: Question
has title: Java RMI - Returning a reference to another remote object on server from a remote method on server, to client
tagged with: rmi
accepted answer: http://stackoverflow.com/a/26056308
score: 4
upvote count: 4
answer count: 2
has body: The issue is that with client-server communication using RMI - I don't know how I can return anything like an object (or a reference to an object) running on the server space, back to the client whose methods I can then call from that client. I need this because, the basic RMI examples merely pass data like strings or int etc. from server to client, not a fully serialized object running on server. The only similar question I found was is it possible to pass by reference in RMI? What I'm trying to do is this: Server: Creates and exports a remote object (which implements a remote interface). The client calls a method of this remote object. This method in turn creates a new object of another class and returns a reference to it. Client: Gets a stub from the Java RMI registry. Calls the stub as per the remote object specification and gets a handle to the other object, and then using this handle it invokes the methods of this object running in server space. Is this even possible ? I may be missing a concept or two here as well. Code: //Hello.java import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { public target sayHello() throws RemoteException; } //Server.java import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class Server implements Hello { public target t; public Server() {} public target sayHello() { target t = new target(1,"target"); return t; } public static void main(String args[]) { Hello stub = null; Registry registry = null; try { Server obj = new Server(); stub = (Hello) UnicastRemoteObject.exportObject(obj, 0); registry = LocateRegistry.getRegistry(); registry.bind("Hello", stub); System.err.println("Server ready"); } catch (Exception e) { try{ registry.unbind("Hello"); registry.bind("Hello",stub); System.err.println("Server ready"); }catch(Exception ee){ System.err.println("Server exception: " + ee.toString(…
downvote count: 0
possible better answer: http://stackoverflow.com/a/34269960
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/34269960
tagged with: rpc
has answer: http://stackoverflow.com/a/26056308
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/11187548

http://stackoverflow.com/a/26175003
answers question: http://stackoverflow.com/q/26174563
score: 0
type: Answer
has body: In the project structure you can create an artifact for each of your library an specify an output directory. Try File->Project Structure then in the Project Setting add new artifact and specify output directory

http://stackoverflow.com/q/26111379
has body: How can I obfuscate plain text data so that a Java program able to deobfuscate it is difficult to reverse engineer? That is, there should be no easy way to figure out how to descramble the data yourself by decompiling/disassembling the JVM code for the program. I realize this is impossible if a bad guy is determined enough. Just want to make it as hard as possible. The only idea I have is a native extension implementing an encryption algorithm with the key stored in a quirky way, not just a simple string. But would really like to avoid a native extension. Edit I vehemently disagree with the down and close votes. This is a real problem. The app is fielded to thousands of high school kids. To scramble the data, it currently implements RC4 encryption (in Java) with the key embedded in the code. Smart kids are able to decompile this and use the decompilation to write Java that reads other kids' data files. This in turn allows various forms of cheating. We need a simple, cheap way to make it harder to deduce the scrambling algorithm. That's all. We don't care about reverse engineering the rest of this 80k line app. In fact it's open source. We just need to protect the single function that does the data descrambling.
answer count: 1
has title: Scrambling data for a Java program in non-reverse engineerable way
favorite count: 0
has comment: http://stackoverflow.com/comment/40921416
type: UnansweredQuestion
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/40921706
score: 1
upvote count: 3
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/26112141
has comment: http://stackoverflow.com/comment/40922587

http://stackoverflow.com/a/42897377
score: 0
answers question: http://stackoverflow.com/q/26190395
type: Answer
has body: I have same problem after spending 2 days finally i got the anwer First activity if (requestCode == CAMERA_REQUEST &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null) { Uri uri = data.getData(); Intent intent= new Intent(this,SecondActivity.class); selfiSrc.putExtra("imgurl", uri ); startActivity(intent); } SecondActivity Imageview iv_photo=(ImageView)findViewById(R.id.iv_photo); Bundle extras= getIntent().getExtras(); if(extras!=null) { path = (Uri) extras.get("imgurl"); iv_photo.setImageURI(path); } Another way see my answer Android - how can i transfer ImageView from one activity to another activity?

http://stackoverflow.com/comment/41019281
type: Comment
type: QuestionComment
has text: That ain't gonna happen. My boss's boss wrote the Jant (Java Ant) tool we use and he suffers from mild Stockholm syndrome regarding their continued use of it. I.e. if I suggested we change tools he would reply 'over my dead body'.
comment on: http://stackoverflow.com/q/26160499
score: 0

flyway
tags question: http://stackoverflow.com/q/26059923
type: Tag
tag name: flyway

http://stackoverflow.com/q/26144104
tagged with: jaxb
has comment: http://stackoverflow.com/comment/41037135
type: Question
has comment: http://stackoverflow.com/comment/40987191
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/30169590
has title: finding the correct architecture using jaxb, jax-rs and ejb's
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: jax-rs
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: My application comprises three layers being: Interaction layer (RestServices JAX-RS) Business layer (Stateless EJBs) Persistence layer (DAO's with queries etc.) In addition I have this domain objects layer which runs through the layers. The application was first setup to use a nosql database, but we had to abandon that. Now we are using JPA with a RDBMS but running into trouble when migrating, mainly due to the fact that the jaxb objects that the interaction layer is using, is trying to lazily load domain objects without a transaction when the are serialized. This transaction has been closed once it returned from the stateless ejb. After reading a lot on the web, I tried to annotate my restservice with @Stateless too in order to start a transaction a bit sooner and to avoid the transaction being closed once the business layer has been left. Unfortunately this doesn't work either as I still getting lazilyinitializationexceptions. So my question is how should I combine JAXB, JAX-RS and EJB's in order to avoid the LIException? regards Michael
linked to: http://stackoverflow.com/q/578433
has comment: http://stackoverflow.com/comment/43392171

http://stackoverflow.com/q/26112812
has comment: http://stackoverflow.com/comment/40923748
has comment: http://stackoverflow.com/comment/40924055
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40924236
downvote count: 0
has comment: http://stackoverflow.com/comment/40923944
has comment: http://stackoverflow.com/comment/40923721
has comment: http://stackoverflow.com/comment/40923968
has comment: http://stackoverflow.com/comment/40925526
has comment: http://stackoverflow.com/comment/40923849
has title: Crash when open activity contain fragment
has answer: http://stackoverflow.com/a/26113084
has comment: http://stackoverflow.com/comment/40923718
type: Question
accepted answer: http://stackoverflow.com/a/26113084
score: 3
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/40923739
tagged with: java
tagged with: listview
has comment: http://stackoverflow.com/comment/40924001
upvote count: 3
has comment: http://stackoverflow.com/comment/40923913
has comment: http://stackoverflow.com/comment/40924539
has comment: http://stackoverflow.com/comment/40924058
answer count: 1
has comment: http://stackoverflow.com/comment/40947676
has body: • So i'm creating 2 fragments, testing "Inter-fragment communication" pattern: • FragmentA contains a ListView, FragmentB contains a TextView. In portrait mode: MainActivity contains FragmentA(listview), if user click on an item then move to AnotherActivity which contains FragmentB(textview) with some text.. • In lanescape mode: MainActivity contains both FragmentA and B.. • My lanescape mode worked fine, by in portrait mode if i click on an item, its crashed. FragmentA.java: public class FragmentA extends Fragment implements OnItemClickListener { ListView list; Communicator comm; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub return inflater.inflate(R.layout.fragment_layout_a, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); list = (ListView) getActivity().findViewById(R.id.listView1); ArrayAdapter adapter = ArrayAdapter.createFromResource(getActivity(), R.array.titles, android.R.layout.simple_list_item_1); list.setAdapter(adapter); list.setOnItemClickListener(this); Log.d("this", "Done setting listview"); } @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub comm.respone(arg2); } void setCommunicator(Communicator c) { comm = c; } public interface Communicator { public void respone(int index); } } FragmentB.java: public class FragmentB extends Fragment { TextView display; String[] data; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub return inflater.inflate(R.layout.fragment_layout_b, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub display = (TextView) getActivity().findViewById(R.id.textView1); Resources res…
favorite count: 0
has comment: http://stackoverflow.com/comment/40925359
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40924673
tagged with: android

http://stackoverflow.com/a/26170421
type: Answer
accepted answer of: http://stackoverflow.com/q/26170318
answers question: http://stackoverflow.com/q/26170318
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/41033414
has body: This line doesn't compile: test(E1.class,E2.class); There is only one type parameter E, and Java must match the inferred types of the arguments exactly. It cannot infer Example, because the objects are Class&lt;E1&gt; and Class&lt;E2&gt;, not Class&lt;Example&gt;. The invariance of Java generics prevents this from happening. You can work around this by introducing an upper bound wildcard on test's generic type parameter: public static &lt;E extends Example&gt; void test(Class&lt;? extends E&gt;... es) This allows Java to infer Example for E, by satisfying the upper bound wildcard with E1 and E2. The second line creates a raw array of Classes, bypassing generics and generating an "unchecked call" warning. new Class[]{E1.class,E2.class} If you were to attempt to provide a type argument to Class here, you would get a compiler error with any half-way reasonable type parameter: // Needs Class&lt;Example&gt; but found Class&lt;E1&gt; and Class&lt;E2&gt; test(new Class&lt;Example&gt;[]{E1.class,E2.class}); // Needs Class&lt;E1&gt; but found Class&lt;E2&gt; test(new Class&lt;E1&gt;[]{E1.class,E2.class}); // Needs Class&lt;E2&gt; but found Class&lt;E1&gt; test(new Class&lt;E2&gt;[]{E1.class,E2.class}); Satisfying the inference by using a wildcard here just uncovers the real problem here -- generic array creation. // Generic array creation test(new Class&lt;? extends Example&gt;[]{E1.class,E2.class});
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26125626
has body: How to disable cancel button on the org.eclipse.core.runtime.jobs.Job progress bar dialog? I mean a window that is displayed when you set setUser(true).
favorite count: 0
type: UnansweredQuestion
has title: How to disable cancel button on the Job progress bar dialog?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26127137
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40947171
tagged with: rcp
tagged with: eclipse
tagged with: jobs
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41109455
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the response. The problem with unpacking it directly into `target` with no intermediate copy is that the unpack will write it into `/target/environment-dev-2.0.8-SNAPSHOT/` which causes issues for the resource lookup. This is why I'm writing it into a temp directory before copying the folder we need.
comment on: http://stackoverflow.com/a/26177722

http://stackoverflow.com/a/26186091
type: AcceptedAnswer
downvote count: 0
has body: Instead of getFragmentManager() method use getSupportFragmentManager().
type: Answer
accepted answer of: http://stackoverflow.com/q/26185916
upvote count: 3
answers question: http://stackoverflow.com/q/26185916
score: 3

http://stackoverflow.com/comment/40867994
type: Comment
comment on: http://stackoverflow.com/a/26081783
score: 0
type: AnswerComment
has text: Bro if you are digging inside JVM and JRE then help yourself.Because there are hundreds of different vendors who develop their own internal logic. : )

http://stackoverflow.com/a/26239371
accepted answer of: http://stackoverflow.com/q/26176548
has comment: http://stackoverflow.com/comment/41181843
has body: As the requirements I understood eventually, you want to fetch all documents in which none of elements of occupied falls into the specified date range. Complete on mongo shell: db.b.find({ $or : [{ occupied : null }, { occupied : { $not : { $elemMatch : { $gte : start, $lte : end } } } }] }).pretty(); Then translate to Java code as below: // Because "Criteria" has a bug when invoking its method "elemMatch", // so I build the criteria by the driver directly, almost. DBObject c1 = new BasicDBObject("occupied", null); DBObject c2 = BasicDBObjectBuilder.start().push("occupied").push("$not"). push("$elemMatch").add("$gte", start).add("$lte", end).get(); Criteria c = where("$or").is(Arrays.asList(c1, c2)); Query query = new Query().addCriteria(c); List&lt;Room&gt; rooms = mongoTemplate.find(query, Room.class);
answers question: http://stackoverflow.com/q/26176548
has comment: http://stackoverflow.com/comment/41181210
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41182862
has comment: http://stackoverflow.com/comment/41182385
has comment: http://stackoverflow.com/comment/41183627
has comment: http://stackoverflow.com/comment/41183262
has comment: http://stackoverflow.com/comment/41181995
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41183547
type: Answer

http://stackoverflow.com/q/26128560
tagged with: android
has comment: http://stackoverflow.com/comment/40953448
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26128845
accepted answer: http://stackoverflow.com/a/26128612
score: 0
answer count: 2
tagged with: nullpointerexception
has body: In my Android app, I'm trying to display a personalized message "Welcome, [name]!" when the app starts up. Through error logs I've determined that I successfully save a user's name after he/she is prompted to give it, and successfully retrieve that name on subsequent startups. But when I try to change the default "Welcome!" to "Welcome, [name]!" using settext, I get a null pointer exception. My XML (activity_main.xml) <TextView android:id="@+id/main_textview" android:text="Welcome!" android:textColor="#000000" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textSize="40sp" android:typeface="serif"/> And my Java public class main extends Activity { TextView mainTextView; private static final String PREFS = "prefs"; private static final String PREF_NAME = "name"; SharedPreferences mainSharedPreferences; @Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mainTextView = (TextView) findViewById(R.id.main_textview); String name = mainSharedPreferences.getString(PREF_NAME, ""); if(name.length() > 0){mainTextView.setText("Welcome, " + name + "!" );} else{greeting();} } } Based on other, similar posts, I've tried making sure I'm using setContentView on the xml file that contains the relevant TextView, and I've tried cleaning and rebuilding the project. It still gives me a NullPointerException. Any help would be greatly appreciated!
tagged with: textview
has answer: http://stackoverflow.com/a/26128612
has title: Android TextView settext() Nullpointer
has answer: http://stackoverflow.com/a/26128845

http://stackoverflow.com/comment/40897695
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26097290
has text: thanks, it was what expected. But it could not be imported as a project in eclipes.
score: 0

http://stackoverflow.com/q/26081018
has comment: http://stackoverflow.com/comment/44535890
answer count: 1
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/44438638
favorite count: 0
has comment: http://stackoverflow.com/comment/44289357
accepted answer: http://stackoverflow.com/a/27946921
upvote count: 3
has comment: http://stackoverflow.com/comment/44397853
type: Question
type: AnsweredQuestion
has title: AWS Opsworks Java App Server 403 Error
score: 3
tagged with: java
has body: I am a newbie to AWS Opsworks. I am trying to deploy the simplest of AWS Opsworks Application using Java App Server, by following this: http://java.awsblog.com/post/Tx1QG3W2M969014/AWS-OpsWorks-for-Java I did everything as mentioned but when I deploy and try to view the URL, it says: Forbidden You don't have permission to access /JavaBasic/HelloWorldService.jsp on this server. Can someone guide me to how I should resolve this?
has comment: http://stackoverflow.com/comment/44287646
tagged with: aws-opsworks
has answer: http://stackoverflow.com/a/27946921

http://stackoverflow.com/a/26083780
has body: You're opening a new session, not linked to the current Spring transaction, in your DAO. Don't do that. Instead, get the current session, that is linked to the current transaction: Session session = sessionfactory.getCurrentSession();
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26082435
has comment: http://stackoverflow.com/comment/40871092
answers question: http://stackoverflow.com/q/26082435
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/26037870
tagged with: prepared-statement
type: Question
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26038454
favorite count: 0
tagged with: jdbc
has title: Creating table dynamically by SQL in Servlet
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26037925
has body: I am getting error in this: prepared statement. Prepared Statement: PreparedStatement pStatement=connection.prepareStatement ("CREATE TABLE `details`.?(`ID` VARCHAR(255) NOT NULL,`Score` VARCHAR(255) NULL); INSERT INTO `testdetails`.? (`ID`) VALUES (?);"); pStatement.setString(1, "usrname"); pStatement.setString(2, "usrname"); pStatement.setString(3, "001"); pStatement.executeUpdate(); Error details: Severe: 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 ''usrname'(`ID` VARCHAR(255) NOT NULL,`Score` VARCHAR(255) NULL);INSER' at line 1 How to fix this error?
tagged with: mysql

http://stackoverflow.com/comment/41011632
has text: Walk through the code with a debugger and watch what happens. In particular, pay attention to what you're returning from `descending`.
comment on: http://stackoverflow.com/q/26160725
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41006777
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26157206
has text: There is nothing wrong in using static/singleton's in android. This is not the best practice I agree with you since you can't guarantee the content of your static fields throughout the application life time, however it's still a simple and viable solution if the OP doesn't want to implement a serializable class and pass it though intents and whatnot.

http://stackoverflow.com/comment/41049641
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26180849
has text: Please explain, **completely and precisely**, what characteristics would make up "a better solution". After all, *everything* on the Internet involves "send messages, and then the server side has to parse it and make a method call itself". For example, servlets would have to do the same thing.
score: 0

foreground
type: Tag
tag name: foreground
tags question: http://stackoverflow.com/q/26139380

http://stackoverflow.com/a/26128650
has body: The following only creates a pointer for Map object and instantiates it to null. private static final Map&lt;key, value&gt; map; The following line it's where the object is really created, in both cases is an instance of ConcurrentHashMap, and the variable map points to it's address. This is what matters, the actual instance. map = new ConcurrentHashMap&lt;key, value&gt;(); So there cannot be any difference between the two!
score: 0
answers question: http://stackoverflow.com/q/26128548
type: Answer

http://stackoverflow.com/comment/40819096
type: QuestionComment
has text: Could you provide the insertion java code for document, or the result of document queried from mongo shell?
comment on: http://stackoverflow.com/q/26051980
score: 0
type: Comment

http://stackoverflow.com/comment/40830587
comment on: http://stackoverflow.com/a/26059221
has text: Hello, Can you please provide some pointer for generating the string with brackets?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40844948
comment on: http://stackoverflow.com/q/26068678
type: Comment
score: 1
has text: Did you try extending FFMpegLocator (as per the jave docs) and override public java.lang.String getFFMPEGExecutablePath() to point at your ffmpeg?
type: QuestionComment

http://stackoverflow.com/comment/40811314
type: Comment
type: QuestionComment
has text: Also note that this formula is not suitable for large values of lambda. exp(-1000) ~= 10 ^ - 435. You might get some ideas from the answers to this question: http://stackoverflow.com/questions/5657861/generating-poisson-variables-in-c
comment on: http://stackoverflow.com/q/26046889
score: 0

http://stackoverflow.com/q/26121128
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26121414
linked to: http://stackoverflow.com/q/8938235
has comment: http://stackoverflow.com/comment/40938278
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26121180
has comment: http://stackoverflow.com/comment/40938407
has body: I am just sorting an array and need some advice on the sorting and I also need help printing the array after I have sorted it. Also no, I do not want to use the Arrays utility. Code: package Sort; public class SortCode { static int[] intArray = { 12, 34, 99, 1, 89, 39, 17, 8, 72, 68}; int j = 0; int i = 0; void printArray(int[] arrayInts) { System.out.println("Values before sorting:"); System.out.println("Index" + "\tValue"); for (; j &lt; arrayInts.length; j++) { System.out.println(j + "\t" + arrayInts[j]); } //for (int j) } //void printArray void sortArray() { System.out.println("Values after sorting:"); System.out.println("Index" + "\tValue"); int i; int k; for (i = 0; i &lt; intArray.length; i++) { for (k = 0; k &gt; intArray.length; k++) { if (intArray[i] &gt; intArray[k]) { int firstNum = intArray[i]; int secondNum = intArray[k]; intArray[i] = secondNum; intArray[k] = firstNum; } //if } //for } //for } //void sortArray } //class BranchCode
has title: Need help on sorting an array -- a new programmer
tagged with: java
downvote count: 3
type: Question
score: -2
tagged with: arrays

http://stackoverflow.com/q/26118754
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26120220
has comment: http://stackoverflow.com/comment/40933921
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26120905
has title: Regex for extracting phone numbers
tagged with: regex
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40934030
type: Question
score: -2
has body: I have following requirements: Number (in sequence or seperated by hyphen or space) Can have hyphen - in between [optional] Can have space in between [optional] Can have open braces ( and closing brace ) [optional] Can have plus + at the beginning. [optional] Right now, i'm using (^| )[0-9.() -+]{5,}( |$) Sample text: CONTACT Asia: (11) 6530-6596-3242, +9145465465465 (011)4420717696024 +1 212-904-2860

http://stackoverflow.com/comment/41376168
type: QuestionComment
comment on: http://stackoverflow.com/q/26162017
has text: @Vivek Thank you for the detailed project. I am taking a look at it. Did you arrive at this solution based on TDD or did you develop this first and the added the tests?
score: 0
type: Comment

http://stackoverflow.com/a/48192416
downvote count: 1
type: Answer
has body: The best way to go is to use the library dnsjava. The particular class you are looking for is SimpleResolver. It has two constructors. When used with no parameters it will use the system's DNS settings. If you provide an IP address it will force that as the DNS server. You can find a great example of usage here: dnsjava Examples.
score: 2
answers question: http://stackoverflow.com/q/26080161
upvote count: 3
has comment: http://stackoverflow.com/comment/107253680

http://stackoverflow.com/comment/40950405
has text: Yes. Please show any code attempt you have so far, along with any problems you've encountered; a solution won't just be given here.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26127407
type: QuestionComment

http://stackoverflow.com/comment/85907517
type: Comment
score: 1
has text: @NasBanov: Yes, because 0.1 does not fit into float. So the result `false` is correct. What is your argument here?
type: AnswerComment
comment on: http://stackoverflow.com/a/26099911

http://stackoverflow.com/comment/40867393
type: AnswerComment
type: Comment
has text: Add the line `System.out.println("gField content: "+gField.getText());` at the top of the `handleButtonAction` method, and update your question with the output.
comment on: http://stackoverflow.com/a/26081517
score: 1

http://stackoverflow.com/comment/40919327
score: 0
type: Comment
has text: On the other hand, as long as you're ok with integer percentages, this avoids the inaccuracies inherent in floating point math. You'd want to call `rnd.nextInt(100)` as its upper bound is not part of the resulting range.
comment on: http://stackoverflow.com/a/26109729
type: AnswerComment

maven
tags question: http://stackoverflow.com/q/26034494
tags question: http://stackoverflow.com/q/26177232
tags question: http://stackoverflow.com/q/26100831
tags question: http://stackoverflow.com/q/26119169
tags question: http://stackoverflow.com/q/26101363
type: Tag
tags question: http://stackoverflow.com/q/26162855
tags question: http://stackoverflow.com/q/26070816
tags question: http://stackoverflow.com/q/26176292
tags question: http://stackoverflow.com/q/26086235
tags question: http://stackoverflow.com/q/26069312
tags question: http://stackoverflow.com/q/26113769
tags question: http://stackoverflow.com/q/26083708
tags question: http://stackoverflow.com/q/26176602
tags question: http://stackoverflow.com/q/26086147
tags question: http://stackoverflow.com/q/26143840
tags question: http://stackoverflow.com/q/26169424
tags question: http://stackoverflow.com/q/26048011
tags question: http://stackoverflow.com/q/26106326
tags question: http://stackoverflow.com/q/26100947
tags question: http://stackoverflow.com/q/26144541
tags question: http://stackoverflow.com/q/26121332
tags question: http://stackoverflow.com/q/26108529
tags question: http://stackoverflow.com/q/26170406
tags question: http://stackoverflow.com/q/26086697
tags question: http://stackoverflow.com/q/26072238
tags question: http://stackoverflow.com/q/26177320
tags question: http://stackoverflow.com/q/26061664
tags question: http://stackoverflow.com/q/26066892
tags question: http://stackoverflow.com/q/26128770
tags question: http://stackoverflow.com/q/26094375
tags question: http://stackoverflow.com/q/26037569
tags question: http://stackoverflow.com/q/26048340
tags question: http://stackoverflow.com/q/26068128
tags question: http://stackoverflow.com/q/26168319
tags question: http://stackoverflow.com/q/26149711
tags question: http://stackoverflow.com/q/26140179
tags question: http://stackoverflow.com/q/26058192
tags question: http://stackoverflow.com/q/26143203
tags question: http://stackoverflow.com/q/26054397
tags question: http://stackoverflow.com/q/26079112
tags question: http://stackoverflow.com/q/26139545
tags question: http://stackoverflow.com/q/26126607
tags question: http://stackoverflow.com/q/26055838
tags question: http://stackoverflow.com/q/26108271
tags question: http://stackoverflow.com/q/26064508
tags question: http://stackoverflow.com/q/26178681
tags question: http://stackoverflow.com/q/26139272
tags question: http://stackoverflow.com/q/26040366
tags question: http://stackoverflow.com/q/26103018
tags question: http://stackoverflow.com/q/26106988
tags question: http://stackoverflow.com/q/26084437
tags question: http://stackoverflow.com/q/26120704
tags question: http://stackoverflow.com/q/26147712
tags question: http://stackoverflow.com/q/26108931
tags question: http://stackoverflow.com/q/26068658
tags question: http://stackoverflow.com/q/26118102
tags question: http://stackoverflow.com/q/26054336
tags question: http://stackoverflow.com/q/26035558
tags question: http://stackoverflow.com/q/26054020
tags question: http://stackoverflow.com/q/26147041
tags question: http://stackoverflow.com/q/26069512
tags question: http://stackoverflow.com/q/26107721
tags question: http://stackoverflow.com/q/26121499
tags question: http://stackoverflow.com/q/26194321
tags question: http://stackoverflow.com/q/26094508
tags question: http://stackoverflow.com/q/26166616
tags question: http://stackoverflow.com/q/26123592
tags question: http://stackoverflow.com/q/26055876
tags question: http://stackoverflow.com/q/26166379
tags question: http://stackoverflow.com/q/26036731
tags question: http://stackoverflow.com/q/26083237
tags question: http://stackoverflow.com/q/26119721
tags question: http://stackoverflow.com/q/26189167
tags question: http://stackoverflow.com/q/26079166
tags question: http://stackoverflow.com/q/26040155
tags question: http://stackoverflow.com/q/26117977
tags question: http://stackoverflow.com/q/26085347
tags question: http://stackoverflow.com/q/26110163
tags question: http://stackoverflow.com/q/26161632

http://stackoverflow.com/comment/40850577
type: QuestionComment
comment on: http://stackoverflow.com/q/26063600
has text: don't put logic into the cell - that's just as wrong as it was in Swing's renderers. Instead, have an external controller that updates itself as needed and let the cell check into the controller @James_D
score: 0
type: Comment

http://stackoverflow.com/a/26107215
answers question: http://stackoverflow.com/q/26106814
has body: I've found an answer. But before I tried smth like that: File fname = new File(currDir + args[i]);//currDir is the path where to create a folder //and the args[i] is folder name if (!fname.exists()) fname.mkdir(); But here's a mistake so this is the correct code: File fname = new File(currDir + "/" + args[i]); if (!fname.exists()) fname.mkdir(); That's it =)
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40918117
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26106814

http://stackoverflow.com/comment/40822113
score: 0
type: Comment
type: QuestionComment
has text: 2,500,000 records are the total records in the table that already hold their own hashcode at the time of their insertion, their is no unique id the duplicate records are to be checked on certain fields
comment on: http://stackoverflow.com/q/26057177

http://stackoverflow.com/comment/40989967
type: Comment
comment on: http://stackoverflow.com/a/26108534
score: 0
type: AnswerComment
has text: There is no `getContent()` method for the `ON` class produced by the code above, even when I delete the `mixed` attribute of the `xsd` that defines the class parameters for `JAXB`.

http://stackoverflow.com/comment/40846143
type: Comment
type: QuestionComment
has text: Thanks Alexander. I used that Window.java code referenced in the link above but am still having the same issue of the Viewer playing outside the JPanel and JFrame. Will keep digging!
score: 0
comment on: http://stackoverflow.com/q/26048942

http://stackoverflow.com/q/26064379
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26065710
has comment: http://stackoverflow.com/comment/40835672
type: Question
tagged with: android-securityexception
tagged with: uri
has comment: http://stackoverflow.com/comment/40836068
has comment: http://stackoverflow.com/comment/40836795
has title: What options are available to solve an intermittent Permission Denial SecurityException?
upvote count: 1
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/40837346
favorite count: 0
type: UnansweredQuestion
tagged with: android-intent
has comment: http://stackoverflow.com/comment/40837610
has body: I've set up a ContentProvider, for my app's internal use only, to respond to a URI with a stream, through which I construct and provide a zip file. The Uri is passed as an extra (Intent.EXTRA_STREAM) to an Intent (Intent.ACTION_SEND) in order to send it. However, when doing so, it intermittently fails with this exception: E/DatabaseUtils(26058): java.lang.SecurityException: Permission Denial: reading MyContentProvider uri content://spinner.myapp.db/file/stream/zip/1 from pid=26141, uid=10038 requires the provider be exported, or grantUriPermission() I've tried granting permissions through intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);, but that hasn't worked. I also don't see why I should need to grant permissions, as it's only my own app that's accessing the ContentProvider. UPDATE: I've now also tried using setClipData(), with no more success. Gmail apparently ignores the Uri, and Dropbox crashes. String[] mimeTypes = { "application/x-compressed" }; ClipData clip = new ClipData("zip data", mimeTypes, new ClipData.Item(uri)); intent.setClipData(clip); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
has comment: http://stackoverflow.com/comment/40835877

multithreading
tags question: http://stackoverflow.com/q/26054657
tags question: http://stackoverflow.com/q/26133427
tags question: http://stackoverflow.com/q/26175600
tags question: http://stackoverflow.com/q/26038118
tags question: http://stackoverflow.com/q/26041214
tags question: http://stackoverflow.com/q/26173204
tags question: http://stackoverflow.com/q/26165549
type: Tag
tags question: http://stackoverflow.com/q/26181462
tags question: http://stackoverflow.com/q/26189109
tags question: http://stackoverflow.com/q/26128548
tags question: http://stackoverflow.com/q/26065262
tags question: http://stackoverflow.com/q/26114145
tags question: http://stackoverflow.com/q/26043374
tags question: http://stackoverflow.com/q/26047313
tags question: http://stackoverflow.com/q/26078825
tags question: http://stackoverflow.com/q/26093295
tags question: http://stackoverflow.com/q/26177429
tags question: http://stackoverflow.com/q/26146843
tags question: http://stackoverflow.com/q/26182009
tags question: http://stackoverflow.com/q/26081093
tags question: http://stackoverflow.com/q/26098927
tags question: http://stackoverflow.com/q/26098996
tags question: http://stackoverflow.com/q/26053661
tags question: http://stackoverflow.com/q/26097487
tags question: http://stackoverflow.com/q/26143218
tags question: http://stackoverflow.com/q/26145907
tags question: http://stackoverflow.com/q/26042526
tags question: http://stackoverflow.com/q/26149061
tags question: http://stackoverflow.com/q/26101626
tags question: http://stackoverflow.com/q/26043762
tags question: http://stackoverflow.com/q/26193829
tags question: http://stackoverflow.com/q/26158705
tags question: http://stackoverflow.com/q/26171326
tags question: http://stackoverflow.com/q/26106297
tags question: http://stackoverflow.com/q/26144681
tags question: http://stackoverflow.com/q/26062448
tags question: http://stackoverflow.com/q/26082732
tags question: http://stackoverflow.com/q/26074380
tags question: http://stackoverflow.com/q/26074182
tags question: http://stackoverflow.com/q/26177772
tags question: http://stackoverflow.com/q/26153515
tags question: http://stackoverflow.com/q/26111298
tags question: http://stackoverflow.com/q/26157606
tags question: http://stackoverflow.com/q/26087593
tags question: http://stackoverflow.com/q/26109203
tags question: http://stackoverflow.com/q/26143604
tags question: http://stackoverflow.com/q/26191773
tags question: http://stackoverflow.com/q/26182461
tags question: http://stackoverflow.com/q/26097597
tags question: http://stackoverflow.com/q/26149736
tags question: http://stackoverflow.com/q/26186152
tags question: http://stackoverflow.com/q/26053367
tags question: http://stackoverflow.com/q/26167968
tags question: http://stackoverflow.com/q/26107906
tags question: http://stackoverflow.com/q/26050241
tags question: http://stackoverflow.com/q/26183287
tags question: http://stackoverflow.com/q/26088953
tags question: http://stackoverflow.com/q/26064789
tags question: http://stackoverflow.com/q/26091800
tags question: http://stackoverflow.com/q/26134929
tags question: http://stackoverflow.com/q/26149945
tags question: http://stackoverflow.com/q/26079987
tags question: http://stackoverflow.com/q/26120930
tags question: http://stackoverflow.com/q/26175181
tags question: http://stackoverflow.com/q/26190097
tags question: http://stackoverflow.com/q/26058317
tags question: http://stackoverflow.com/q/26092632
tags question: http://stackoverflow.com/q/26188562
tags question: http://stackoverflow.com/q/26111014
tags question: http://stackoverflow.com/q/26121107
tags question: http://stackoverflow.com/q/26155214
tags question: http://stackoverflow.com/q/26055315
tags question: http://stackoverflow.com/q/26110574
tags question: http://stackoverflow.com/q/26070662
tags question: http://stackoverflow.com/q/26070256
tags question: http://stackoverflow.com/q/26127932
tags question: http://stackoverflow.com/q/26063539
tags question: http://stackoverflow.com/q/26092888
tags question: http://stackoverflow.com/q/26172324

http://stackoverflow.com/a/26141345
has comment: http://stackoverflow.com/comment/40996465
has body: You could always just go with the simple approach and use a bean. public class CamelHeadersAndRows { public static class HeaderBean { String header = null; public void setHeader(String body) { header = body.substring("01,".length()); } public String useHeader(String body) { return header + "," + body.substring("02,".length()); } } public static void main(String[] args) throws Exception { final HeaderBean headerBean = new HeaderBean(); Main camelMain = new Main(); camelMain.addRouteBuilder(new RouteBuilder() { @Override public void configure() throws Exception { from("timer:foo?period=1s&amp;repeatCount=1") .setBody(constant( "01,H2,H3\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5\n" + "01,H2,H3\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5\n" + "01,H2,H3\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5\n" + "02,B2,B3,B4,B5" )) .to("direct:inventory"); from("direct:inventory") .split(body().tokenize("\n")).streaming() .choice() .when().simple("${body} regex '^01.*'") .bean(headerBean, "setHeader") .stop() .otherwise() .bean(headerBean, "useHeader") .end() .log("message: ${body}") ; } }); camelMain.run(); } }
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41132200
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41002515
has comment: http://stackoverflow.com/comment/41141857
accepted answer of: http://stackoverflow.com/q/26110377
answers question: http://stackoverflow.com/q/26110377
score: 1

http://stackoverflow.com/a/26128930
upvote count: 1
type: Answer
has body: If numbers are positive integers and can be resused (and are in a consecutive range 1 to N), then your basic idea is essentially correct, picking the largest number possible that does not guarantee an opponent's win on the second to last move will make the total equal to N+1. Then no matter what the opponent does, you can win. So if the total target sum M is divisible by N+1, then player two can win, by keeping the sum always divisible by N+1, otherwise player 1 can win by first making the sum divisible by N+1 and stealing player 2's strategy. If numbers are not consecutive and/or cannot be reused, then the problem seems a lot harder.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26128067

http://stackoverflow.com/q/26077151
answer count: 1
downvote count: 0
tagged with: key
favorite count: 0
has title: Multiple key on HashMap: it deletes existing values?
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26077219
upvote count: 1
has comment: http://stackoverflow.com/comment/40858885
has comment: http://stackoverflow.com/comment/40859649
type: Question
tagged with: hashmap
has body: I have implemented my multiple key class as follows: public class ProbabilityIndex { private int trueLabel; private int classifiedLabel; private int classifierIndex; public ProbabilityIndex(int trueLabel, int classifiedLabel, int classifierIndex) { this.trueLabel = trueLabel; this.classifiedLabel = classifiedLabel; this.classifierIndex = classifierIndex; } @Override public boolean equals(Object obj) { if ( !obj instanceof ProbabilityIndex) return false; if (obj == this) return true; ProbabilityIndex rhs = (ProbabilityIndex) obj; return new EqualsBuilder(). append(trueLabel, rhs.trueLabel). append(classifiedLabel, rhs.classifiedLabel). append(classifierIndex, rhs.classifierIndex). isEquals(); } @Override public int hashCode() { int hashCode = new HashCodeBuilder(17, 31). append(trueLabel). append(classifiedLabel). append(classifierIndex). toHashCode(); return hashCode; } } Notice that trueLabel, classifiedLabel and classifierIndex are all either 0 or 1. Then, I use my key as follows: ProbabilityIndex key = new ProbabilityIndex(trueLabel, classifiedLabel, classifierIndex); probabilities.put(key, new Double(value)); where probabilities is declared as follows: HashMap&lt;ProbabilityIndex, Double&gt; probabilities; However, different combinations of trueLabel, classifiedLabel and classifierIndex write the tuple in the same position in probabilities, thus overwriting existing tuples. How can I overcome this issue? Minimal test case: HashMap&lt;ProbabilityIndex, Double&gt; map = new HashMap&lt;ProbabilityIndex, Double&gt;(); map.put(new ProbabilityIndex(0, 0, 0), new Double(0.1)); map.put(new ProbabilityIndex(0, 0, 1), new Double(0.2)); map.put(new ProbabilityIndex(0, 1, 0), new Double(0.1)); map.put(new ProbabilityIndex(0, 1, 1), new Double(0.2)); map.put(new ProbabilityIndex(1, 0, 0), new Double(0.1)); This inserts 4 tuples instead of 5.
has comment: http://stackoverflow.com/comment/40858840
has comment: http://stackoverflow.com/comment/40858993
has comment: http://stackoverflow.com/comment/40858830
accepted answer: http://stackoverflow.com/a/26077219

http://stackoverflow.com/a/44294279
type: Answer
has comment: http://stackoverflow.com/comment/113985921
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/101347019
has body: Just like ben_wing said, you can run with: sudo -u jboss-as jmap -dump:file.bin &lt;pid&gt; (in my case the user is jboss-as, but yours could be jboss or some other.) But it was not enough, because it asked me for a password ([sudo] password for ec2-user:), although I could run sudo without prompting me for a password with other commands. I found the solution here, and I just needed to add another sudo first: sudo sudo -u jboss-as jmap -dump:file.bin &lt;pid&gt; It works with other commands like jcmd and jinfo too.
answers question: http://stackoverflow.com/q/26140182
has comment: http://stackoverflow.com/comment/113978224
has comment: http://stackoverflow.com/comment/113986973

http://stackoverflow.com/q/26050764
has comment: http://stackoverflow.com/comment/40810820
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40810830
tagged with: turtle-graphics
has answer: http://stackoverflow.com/a/59792840
has body: I'm in my first semester at university and am working on a small assignment using the educational simpleturtle/turtle class(es). I'm writing my programs using Dr. Java (IDE), and when I go to run my program, it compiles completely fine, but when I run the program it jumps out of execution at random points each time I run it. It's never consistent on when it jumps out, but only does it when I run this program that I've been working on. All my other programs work fine, when I go back to run them. It's just this one. I've uninstalled and reinstalled jdk and dr. java, I've restarted my computer, reset to the defaults on dr. java, and re-mapped my extra classes path link to my educational course files and no dice. Any ideas? import java.util.*; import java.awt.*; /** * Class that represents a turtle which is similar to a Logo turtle. * This class inherts from SimpleTurtle and is for students * to add methods to. * * Copyright Georgia Institute of Technology 2004 * @author Barb Ericson ericson@cc.gatech.edu */ public class Turtle extends SimpleTurtle { ////////////////// constructors /////////////////////// /** Constructor that takes the x and y and a picture to * draw on * @param x the starting x position * @param y the starting y position * @param picture the picture to draw on */ public Turtle (int x, int y, Picture picture) { // let the parent constructor handle it super(x,y,picture); } /** Constructor that takes the x and y and a model * display to draw it on * @param x the starting x position * @param y the starting y position * @param modelDisplayer the thing that displays the model */ public Turtle (int x, int y, ModelDisplay modelDisplayer) { // let the parent constructor handle it super(x,y,modelDisplayer); } /** Constructor that takes the model display * @param modelDisplay the thing that displays the model */ public Turtle (ModelDisplay modelDisplay) { // let the parent constructor handle it super(modelDisplay); } /** * Constructor that takes a picture to draw…
type: Question
has title: Dr. Java compiles my program with no errors/issues but isn't running the code to completion
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/q/26054755
tagged with: java
has answer: http://stackoverflow.com/a/26057506
has title: Sending message to least utilised machine in Akka cluser
type: Question
tagged with: akka
tagged with: amazon-ec2
answer count: 1
tagged with: akka-cluster
score: 0
type: UnansweredQuestion
has body: I and new to Akka &amp; want to achieve this, want to deploy few Stateful actors on fixed machines (Which will be always on) and stateless actors (Processing actors/workers) on Amazon EC2 Spot instances Now to handle failover of Stateful actors deciding to use Akka persistance. And to distribute job on stateless workers deciding to use RoundRobinPool with remotely deployed routees. And want messages to be passed to least utilized machine (CPU &amp; Memory). Using Pool so that I can use withSupervisorStrategy() for handling Actor Failure. I am going through example for Remote Deployeed Routees &amp; refering to this code http://www.typesafe.com/activator/template/akka-sample-cluster-java. And https://github.com/akka/akka/blob/cb05725c1ec8a09e9bfd57dd093911dd41c7b288/akka-samples/akka-sample-cluster-java/src/main/java/sample/cluster/stats/StatsSampleOneMasterMain.java. In StatsSampleClient it is randomly taking node &amp; passing message. I want to pass it least utilized maching as mentioned above. I want to know whether Akka support this or I will have write code to find out utilization &amp; send message to that machine accordingly. Kindly suggest if any better approach can used for what I have mentioned above. Thanks! -Devendra

http://stackoverflow.com/q/26165549
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26167620
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/52962773
linked to: http://stackoverflow.com/q/24912157
has answer: http://stackoverflow.com/a/43985757
tagged with: java.util.concurrent
linked to: http://stackoverflow.com/q/30964133
possible better answer: http://stackoverflow.com/a/26165958
type: Question
has answer: http://stackoverflow.com/a/26167620
has answer: http://stackoverflow.com/a/26165958
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/31895578
has comment: http://stackoverflow.com/comment/41022226
has comment: http://stackoverflow.com/comment/71150028
answer count: 5
has title: Synchronize Three Threads
tagged with: multithreading
has body: Was asked this question in an interview , tried to solve it ... but not successful. I thought of using CyclicBarrier There are three threads T1 prints 1,4,7... T2 prints 2,5,8... and T3 prints 3,6,9 …. How do you synchronize these three to print sequence 1,2,3,4,5,6,7,8,9.... I tried writing &amp; running the following code public class CyclicBarrierTest { public static void main(String[] args) { CyclicBarrier cBarrier = new CyclicBarrier(3); new Thread(new ThreadOne(cBarrier,1,10,"One")).start(); new Thread(new ThreadOne(cBarrier,2,10,"Two")).start(); new Thread(new ThreadOne(cBarrier,3,10,"Three")).start(); } } class ThreadOne implements Runnable { private CyclicBarrier cb; private String name; private int startCounter; private int numOfPrints; public ThreadOne(CyclicBarrier cb, int startCounter,int numOfPrints,String name) { this.cb = cb; this.startCounter=startCounter; this.numOfPrints=numOfPrints; this.name=name; } @Override public void run() { for(int counter=0;counter&lt;numOfPrints;counter++) { try { // System.out.println("&gt;&gt;"+name+"&lt;&lt; "+cb.await()); cb.await(); System.out.println("["+name+"] "+startCounter); cb.await(); //System.out.println("&lt;&lt;"+name+"&gt;&gt; "+cb.await()); } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokenBarrierException e) { e.printStackTrace(); } startCounter+=3; } } } output [Three] 3 [One] 1 [Two] 2 [One] 4 [Two] 5 [Three] 6 [Two] 8 [One] 7 [Three] 9 [One] 10 [Two] 11 [Three] 12 [Two] 14 [One] 13 [Three] 15 [One] 16 [Two] 17 [Three] 18 [Two] 20 [One] 19 [Three] 21 [One] 22 [Two] 23 [Three] 24 [Two] 26 [One] 25 [Three] 27 [One] 28 [Two] 29 [Three] 30 Can anyone help me with correct ans ? Similar Ques Thread Synchronization - Synchronizing three threads to print 012012012012..... not working

http://stackoverflow.com/q/26126607
linked to: http://stackoverflow.com/q/11773846
downvote count: 0
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/40843907
has comment: http://stackoverflow.com/comment/40954824
tagged with: maven
linked to: http://stackoverflow.com/q/27971384
has body: I am currently facing a problem with Jersey and Jackson where I can't find a solution for: When I am trying to get an POJO serialized from JSON as a POST-Parameter in an Jersey-Endpoint, it returns an error if I call it from an uberjar. If I use the same wget-call after I started the main-method from eclipse, everything works fine and I get the expected answers. I've searched for other people having problems when using jersey and post-parameter application types, like Error 415 Unsupported Media Type: POST not reaching REST if JSON, but it does if XML and JAX-RS: How to automatically serialize a collection when returning a Response object?, but the main errors where that they didn't specify headers in the call or use wrong @Consumes-tags, which I do not. According to my research no one had similiar problems that the call worked when the server was started from eclipse, but did not work when the server was started externally. The class starting the server is the following: public class ServerStarter { public static final String BASE_URI = "http://localhost:8282/test/"; public static void main(String[] args) throws IOException { final ResourceConfig rc = new ResourceConfig().packages("starter"); HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc); System.out.println(String.format("Drücke Enter um Server zu beenden.", BASE_URI)); System.in.read(); server.stop(); } } And the Endpoint looks like this: @Path("testme") public class Endpoint { @POST @Consumes(MediaType.APPLICATION_JSON) public String testMe(Parameters ep) { return ep.toString(); } } And the Parameters-class, which should be the POJO, looks like this: public class Parameters { private int x; public int getX() { return x; } public void setX(int x) { this.x = x; } } If I do mvn clean package assembly:single, start the server and then call wget localhost:8282/test/testme --post-data='{"x": 10 }' --header="Content-Type: application/json", it returns 415 Unsupported Media Type.…
type: AnsweredQuestion
has title: Unsupported Media Type when using Jersey and Jackson from uberjar
tagged with: java
has comment: http://stackoverflow.com/comment/68904769
has comment: http://stackoverflow.com/comment/44340406
has comment: http://stackoverflow.com/comment/68904533
linked to: http://stackoverflow.com/q/11771830
upvote count: 7
possible better answer: http://stackoverflow.com/a/57758007
type: Question
accepted answer: http://stackoverflow.com/a/40843907
has answer: http://stackoverflow.com/a/57758007
score: 7
tagged with: http://stackoverflow.com/tag/json
tagged with: eclipse
answer count: 2

http://stackoverflow.com/q/26106042
has title: WMQ as transaction coordinator for Java, DB2 doen't participate in transaction
tagged with: java
has comment: http://stackoverflow.com/comment/40941183
has body: We are using Websphere MQ 7.1.1 as a transaction coordinator with DB2 10.0.1 as one of the resource manager. Both WMQ and DB2 are hosted on different linux machines. Java code is deployed on MQ machine with Binding mode. I am able to connect to DB2 from MQ machine. I have configured the qm.ini for DB2. Problem is DB2 doesn't participate in transaction. We are getting MQ Exception 2195. Please tell me if I have missed any configuration.
type: Question
has comment: http://stackoverflow.com/comment/40933382
tagged with: db2
score: 0
tagged with: distributed-transactions
tagged with: ibm-mq
type: UnansweredQuestion
answer count: 0

semaphore
type: Tag
tag name: semaphore
tags question: http://stackoverflow.com/q/26165587

hashmap
tags question: http://stackoverflow.com/q/26157551
tags question: http://stackoverflow.com/q/26147746
tags question: http://stackoverflow.com/q/26069906
tags question: http://stackoverflow.com/q/26109997
tags question: http://stackoverflow.com/q/26071692
tags question: http://stackoverflow.com/q/26142696
tags question: http://stackoverflow.com/q/26087015
tags question: http://stackoverflow.com/q/26092768
tags question: http://stackoverflow.com/q/26073525
tags question: http://stackoverflow.com/q/26187676
type: Tag
tags question: http://stackoverflow.com/q/26077151
tags question: http://stackoverflow.com/q/26120131
tags question: http://stackoverflow.com/q/26193427
tags question: http://stackoverflow.com/q/26188665
tags question: http://stackoverflow.com/q/26188532
tags question: http://stackoverflow.com/q/26042496
tags question: http://stackoverflow.com/q/26096180
tags question: http://stackoverflow.com/q/26148001
tags question: http://stackoverflow.com/q/26122029
tags question: http://stackoverflow.com/q/26190959
tags question: http://stackoverflow.com/q/26179960
tags question: http://stackoverflow.com/q/26139007
tags question: http://stackoverflow.com/q/26127225
tags question: http://stackoverflow.com/q/26034965
tags question: http://stackoverflow.com/q/26072242
tags question: http://stackoverflow.com/q/26095758
tag name: hashmap
tags question: http://stackoverflow.com/q/26112957
tags question: http://stackoverflow.com/q/26073989

http://stackoverflow.com/comment/41034899
type: Comment
comment on: http://stackoverflow.com/a/26172968
score: 1
type: AnswerComment
has text: the return type is Point so I feel it is necessary

http://stackoverflow.com/q/26040405
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26053226
favorite count: 0
tagged with: hex
type: Question
has body: I feel like i want to practicing Java in a more Object-Oriented way, that it is supposed. I am doing a small hobby project that i got inspiration from a android app called HexaTime. The idea or the end result I'm aiming for is the follow scenario: Opens the application, A digital clock is showing with a hexalike format #093343 instead of the usual 09:33:44 /hh:mm:ss. The background color of the window itself is to be changed with the exact current time and counting/converting the hour, minute and seconds in to real hexadecimals. Then a color function will change the color of the background taking the hexadecimals and converting it to R,G,B format / or if its possible to put the pure hexadecimals into a Paint.valueOf(); ? At the beginning i thought i could be simple, but now that i have tried a bit i realize its possible, but take a bit more time and a bit more complex than i thought. Would really appreciate some help, for example displaying the clock on the window. Here is as far as i have got, i have tried some different approaches with Timer.scheduleFixRate or what it was called but could go forward with it due to lack of further knowledge of how to proceed. ClockView package hexatime; import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; public class ClockView extends Application{ public static void main (String[] args) throws InterruptedException{ launch(args); } public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("HexaClock"); primaryStage.setScene(new Scene(new ClockController(), 450,300)); primaryStage.show(); } } ClockController package hexatime; import java.util.Calendar; import javafx.animation.*; import javafx.event.*; import javafx.scene.control.Label; import javafx.util.Duration; public class ClockController extends Label{ public ClockModel clock; public ClockController(){ //updateTime(); } /*private void updateTime(){ Timeline timeline = new Timeline(); new KeyFrame(Duration.seconds(0), …
accepted answer: http://stackoverflow.com/a/26053226
upvote count: 1
has comment: http://stackoverflow.com/comment/40792039
tagged with: java
tagged with: javafx
has title: Dynamic HexClock Program
answer count: 1
tagged with: clock
type: AnsweredQuestion

http://stackoverflow.com/q/26150066
has answer: http://stackoverflow.com/a/26150186
possible better answer: http://stackoverflow.com/a/26150313
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40992304
score: -2
tagged with: jpanel
has body: Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at Volume.&lt;init&gt;(Volume.java:25) at VolumeDriver.main(VolumeDriver.java:6) I get the above errors when trying to run my program. My program is not complete but I just want to check what my window looks like so I can make sure it looks correct. This is my worker class for right now import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Volume extends JFrame { private static final long serialVersionUID = 1L; private JPanel topPanel; private JPanel bottomPanel; private JPanel rightPanel; private JPanel mainPanel; private JLabel message; private final int width = 500; private final int height = 400; public Volume() { setTitle("Sphere and Box Volumes"); setSize(width,height); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); getContentPane().add(topPanel, BorderLayout.NORTH); BuildTopPanel(); getContentPane().add(bottomPanel, BorderLayout.SOUTH); BuildBotPanel(); getContentPane().add(rightPanel, BorderLayout.EAST); BuildRightPanel(); getContentPane().add(mainPanel, BorderLayout.WEST); BuildMainPanel(); setVisible(true); } private void BuildTopPanel() { topPanel = new JPanel(new FlowLayout()); topPanel.setBackground(Color.WHITE); JTextField reqVolume = new JTextField(8); message = new JLabel("Enter the required amount of volume:"); topPanel.add(message); topPanel.add(reqVolume); } private void BuildBotPanel() { bottomPanel = new JPanel(new FlowLayout()); bottomPanel.setBackground(Color.WHITE); JButton intialQuant = new JButton("Set Initial Quantities"); intialQuant.setActionCommand("I"); intialQuant.addActionListener(new ButtonListener()); JButton calcVolume = new JButton("Calculate Volumes"); calcVolume.setActionCommand("V"); calcVolume.addActionListener(new ButtonListener()); JButton close = new JButton("Close"); close.setActionCommand("C"); close.addA…
has title: Java Null Pointer Exception in Worker Class
answer count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/26150186
has comment: http://stackoverflow.com/comment/40992389
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/26150313

http://stackoverflow.com/a/26178782
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26178683
score: 1
has body: The following will compile: Nested.LittleNested b = new Nested.LittleNested(); or you can import LittleNested import &lt;yourpackage&gt;.NestedClassPrac.Nested.LittleNested; Basically, you have access inside main to anything at the same hierarchical level inside NestedClassPrac without needing an import. That gives you access to Nested. However, LittleNested is not at the same level hierarchically; LittleNested is inside Nested. Therefore, you need an import.
downvote count: 0

http://stackoverflow.com/comment/99399011
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/56003380
type: Comment
has text: This worked but with a problem for the reactor (you can't reference your own dependency during the build, without compiling first).

http://stackoverflow.com/q/26105928
score: 0
tagged with: playframework
answer count: 1
tagged with: linux
type: UnansweredQuestion
has body: Trying to create a Dockerfile that'll download and install Java 8 on Amazon Linux. Currently, I have the following file. It's a Play 2.3.4 app: FROM dockerfile/java RUN \ echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections &amp;&amp; \ add-apt-repository -y ppa:webupd8team/java &amp;&amp; \ apt-get update &amp;&amp; \ apt-get install -y oracle-java8-installer &amp;&amp; \ rm -rf /var/lib/apt/lists/* MAINTAINER BeanstalkTest EXPOSE 80 443 ADD files / WORKDIR /opt/docker RUN ["chown", "-R", "daemon", "."] USER daemon RUN ["bin/playapp", "-Dconfig.file=conf/prod.conf"] The app takes a long time to deploy then fails. Any ideas what I could be doing wrong?
tagged with: java-8
has title: Dockerfile to download Java 8 on Amazon Beanstalk Linux
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26114575
has comment: http://stackoverflow.com/comment/40913487
tagged with: amazon-web-services

http://stackoverflow.com/q/26102185
has answer: http://stackoverflow.com/a/26102280
favorite count: 0
has comment: http://stackoverflow.com/comment/40904774
has title: Where do I write the code to handle my exception?
has comment: http://stackoverflow.com/comment/40904883
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40904596
has comment: http://stackoverflow.com/comment/40904666
has answer: http://stackoverflow.com/a/26102438
tagged with: java
has comment: http://stackoverflow.com/comment/40904718
has comment: http://stackoverflow.com/comment/40904760
has comment: http://stackoverflow.com/comment/40904737
tagged with: throws
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40904961
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40904779
has body: Alright. So I have this class called "PayrollDemo", which uses a class called "Payroll". I have already set up a couple of exception classes that will manage certain exceptions, now I just need to figure out how to throw these exceptions. I figure, I should do this via a series of if statements that check each field entered for the proper criteria. The problem is, since the exception handling is down in a different class than the one I'm working in, I'm not sure how I can throw it. So here I'm making sure that the name string isn't empty, if it is it's supposed to cause an exception called "InvalidNameException" and throws it to an "InvalidNameException" class that I have in the same folder as my "PayrollDemo" class. public class PayrollDemo { public static void main(String[] args) { Payroll pr = new Payroll ("Test Name", 234); System.out.println("Current Employee Information. \n"); System.out.println("Name: " + pr.getName()); System.out.println("ID: " + pr.getID()); System.out.println("Hourly Pay Rate: " + pr.getHourlyPayRate()); System.out.println("Number Hours Worked: " + pr.getNumHoursWorked()); System.out.println("Gross Pay: $" + pr.calculateGrossPay() + "\n"); System.out.println("Welcome to the payroll screen. \n"); Scanner keyboard = new Scanner(System.in); System.out.print("Please enter a name: "); String newName = keyboard.nextLine(); System.out.print("Please enter an ID: "); int newID = keyboard.nextInt(); pr.setID(newID); System.out.print("Please enter an hourly pay rate: "); double newPayRate = keyboard.nextDouble(); pr.setHourlyPayRate(newPayRate); System.out.print("Please enter the number of hours worked: "); int newHours = keyboard.nextInt(); pr.setNumHoursWorked(newHours); if (newName == "") { throw new InvalidNameException(); } else { pr.setName(newName); } Here is the InvalidNameException public class InvalidNameException extends Exception { /** No-arg constructor */ public InvalidNameException() { super("Invalid name"); } }
has comment: http://stackoverflow.com/comment/40905273

http://stackoverflow.com/comment/41113773
comment on: http://stackoverflow.com/q/26193074
score: 0
type: Comment
type: QuestionComment
has text: The solution is above. Thank you guys for taking a few time to look at this.

http://stackoverflow.com/comment/40904852
type: QuestionComment
has text: That's good to know, but unfortunately I have no control over that! Our current Java version is 7.
comment on: http://stackoverflow.com/q/26102187
score: 0
type: Comment

http://stackoverflow.com/a/26049362
has comment: http://stackoverflow.com/comment/40820361
answers question: http://stackoverflow.com/q/26048538
type: Answer
has body: First, you don't need to return INPUT from validate, adding the fieldError will be enough to instruct the Workflow Interceptor to return INPUT automatically. Second, the naming of your methods, actions and forms is overcomplicateed and potentially misleading... try keeping the things simpler for the future. Third: you are doing the validation in the Action method. That's not how it works. The action method (by default execute(), but it can be anything, and you have named it validateForm()) must take care of the business of the Action, NOT of the validation. The validation is handled by (XML, Annotations or) a validate() method, that is called by the Validation Interceptor, and is executed before the action is reached. If the validation fails, the action method won't be executed, and the request will be redirected back to the result defined as INPUT. Read more on the detailed flow if you are interested. Then in your case: public String validateForm() { return SUCCESS; } public void validate() { if (name == null || name.equals("")) { addFieldError("name", "Name is required!"); } if (surname == null || surname.equals("")) { addFieldError("surname", "Surname is required!"); } if (username == null || username.equals("")) { addFieldError("username", "Username is required!"); } if (password == null || password.equals("")) { addFieldError("password", "Password is required!"); } if (!passwordCheck.equals(password)) { addFieldError("password", "Passwords do not match!"); addFieldError("passwordCheck", ""); } } But please change that methods / actions names ASAP, for your own safety :)
score: 0

http://stackoverflow.com/comment/52864000
type: AnswerComment
comment on: http://stackoverflow.com/a/26190235
type: Comment
has text: You need to look further up the log for the cause (e.g. the 404 above); it is better to start a new question unless the problem is exactly the same. If the error __is__ a 404 then your queue is __not__ configured correctly.
score: 0

http://stackoverflow.com/a/26154770
type: Answer
has comment: http://stackoverflow.com/comment/41000944
has body: First of in here you are use two different method. display() in Emplo and dispaly() in Person. SO there is no point of talking ambiguity or overriding make that correct. Suppose you are corrected that. Then you can't code keep this way public void display(){ // method in Person System.out.println("name: "+name+"\nage: "+age); } Then void display(){ // method in Emplo System.out.println("desg: "+desg+"\nsal: "+sal); } You are using weaker modifier to override, So you can't compile this code. You can make public the method in Emplo. And answer for your last question. you can't do it. can't call both method.
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41000835
answers question: http://stackoverflow.com/q/26154690
has comment: http://stackoverflow.com/comment/41000889
has comment: http://stackoverflow.com/comment/41000773
score: 0
has comment: http://stackoverflow.com/comment/41000930

http://stackoverflow.com/comment/40911754
score: 0
type: QuestionComment
type: Comment
has text: Can you debug to see exactly which line it fails on?
comment on: http://stackoverflow.com/q/26106013

http://stackoverflow.com/q/26075904
downvote count: 0
favorite count: 0
tagged with: android
has body: I'm trying to create an activity that opens up when i click an .mp3 link in the browser. Here's my Intent Filter : &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="file" /&gt; &lt;data android:scheme="http" /&gt; &lt;data android:host="*" /&gt; &lt;data android:mimeType="application/mp3" /&gt; &lt;/intent-filter&gt; Nothing works.
possible better answer: http://stackoverflow.com/a/26075960
has answer: http://stackoverflow.com/a/26075960
tagged with: intentfilter
type: AnsweredQuestion
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/26150482
tagged with: java
accepted answer: http://stackoverflow.com/a/26150482
answer count: 2
score: 2
has title: Open my Android app when clicking on .mp3 link

http://stackoverflow.com/comment/40903418
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26101180
type: AnswerComment
has text: Sorry I am not getting what you mean here.

http://stackoverflow.com/comment/40954916
has text: That would need to be ... = ${catalina.log.path}/logs in the final code snippet
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26126889

http://stackoverflow.com/comment/41159594
has text: The thing about just providing a link is that it might be dead next year. Or maybe just offline for a day when someone really needs it. The purpose of an SO answer is to be useful on it's own. Giving a link as an extra is perfectly fine, but you'd need to provide at least a short explanation/summary of the contents for this to be a good answer.
comment on: http://stackoverflow.com/a/26192550
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26076841
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26077876
tagged with: android-intent
has body: I'm trying to broadcast after 20 seconds and receive the broadcast with an extended receiver ExtendedReceiver. Here is my function that creates an alarm and sets the PendingIntent to go off after 20 seconds: public void alert() { GregorianCalendar cal = new GregorianCalendar(); cal.add(Calendar.SECOND, 20); Intent i = new Intent(this, ExtendedReceiver.class); int _uid = (int) System.currentTimeMillis(); PendingIntent pi = PendingIntent.getBroadcast(this, _uid, i, PendingIntent.FLAG_ONE_SHOT); AlarmManager am = (AlarmManager)getSystemService(Activity.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pi); Log.i("Title", "Alarm has been set"); } Here is the ExtendedReceiver class: public class ExtendedReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.i("Title", "Broadcast received"); } } I get my first log message: Alarm has been set but I don't get my second log message. I'm unsure where the problem lies (first day on Android)
type: AnsweredQuestion
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/26077876
tagged with: java
type: Question
tagged with: android-alarms
downvote count: 0
has title: PendingIntent and AlarmManager
has comment: http://stackoverflow.com/comment/40859612
tagged with: android

http://stackoverflow.com/comment/40815842
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26051281
has text: centreCrop makes me lose part of the image due to cropping.

http://stackoverflow.com/a/26171241
downvote count: 0
has comment: http://stackoverflow.com/comment/41031796
type: Answer
accepted answer of: http://stackoverflow.com/q/26171194
upvote count: 2
has body: Yes. Consider a method to "add" or concatenate some object to yours. In this case it returns the result. public Foo add(Foo other); You might want to add or concatenate yourself to yourself, where you'd call Foo result = this.add(this)
score: 2
answers question: http://stackoverflow.com/q/26171194
type: AcceptedAnswer

http://stackoverflow.com/comment/40973281
comment on: http://stackoverflow.com/q/26139056
score: 2
has text: What do you mean by `RESET` ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26181722
type: UnansweredQuestion
has title: Log4j entries going to WebLogic managed server out file
score: 1
tagged with: java
type: Question
has body: Some of my log4j entries are going to the managed server out file. This isn't happening all the time. My log4j is set up with INFO for everything, but when it does go to the out file, I all the DEBUG is getting logged. What could be causing this? Here's the log4j.xml file: <?xml version="1.0" encoding="UTF-8"?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender-ref ref="CSF_FILE" /> <appender-ref ref="EVENT_FILE" /> <!-- Limit categories to INFO <priority value="INFO"/> --> <!-- RULES for logging DEBUG < INFO < WARN < ERROR < FATAL. --> <!-- tested and run <priority value="ERROR" /> --> <!-- Decrease the priority threshold <priority value="DEBUG"/> --> <priority value="INFO"/> <appender-ref ref="CSF_FILE" /> </log4j:configuration>
tagged with: weblogic
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41051013
has comment: http://stackoverflow.com/comment/41051285
tagged with: log4j
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/40915228
comment on: http://stackoverflow.com/a/26107660
score: 0
has text: But ok that makes sense (i + 2), i feel really stupid for asking this but how do i check to see if I'm at the end of a string in java?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40905338
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26102473
type: QuestionComment
has text: There is a Person class that has all the people and their attributes defined but I can't access them. The goal is for this class to decide who they are by the attributes

http://stackoverflow.com/comment/41067470
comment on: http://stackoverflow.com/q/26190476
type: Comment
type: QuestionComment
has text: You have an array of doubles?, why not just iterate over that array: `for(final double d: a){ System.out.println(d);}`?
score: 0

http://stackoverflow.com/comment/40870624
type: Comment
type: QuestionComment
has text: Actually I think you might need to use flatMap (instead of map) in the second step - to be able to handle the case that the input queue is empty. So you would either emit an Observable.just() or and Observable.empty().
comment on: http://stackoverflow.com/q/26080646
score: 0

http://stackoverflow.com/comment/40877820
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26087416
type: AnswerComment
has text: Lists can't sort themselves.

http://stackoverflow.com/a/26154647
answers question: http://stackoverflow.com/q/26154373
downvote count: 1
has body: Use Genymotion insted of default one. It is way faster than the default one. And yaa the emulator is compatible with both Intel and AMD. Genymotion just uses Virtualbox to run Android in VM. Genymotion Home Page
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41043928
has comment: http://stackoverflow.com/comment/41043983
upvote count: 2

http://stackoverflow.com/a/26142826
has comment: http://stackoverflow.com/comment/41046376
upvote count: 1
has body: You want to iterate 4 times.... so simply encapsulate the logic in a for loop for(int counter=0; counter&lt; 4; counter++) { // logic goes here } How this works: Step 1: When the for loop is encountered initially, the first section of the 3 code sections inside the for loop is run and if you declare a variable here it's scope is only within the loop. Step 2: The 2nd section of the for loop code is run and evaluates to "true" or "false" if it evaluates to false the for loop is exited. Step 3: The code within the for loop is executed with the variable (int this counter) available if needed within the loop (in your case I don't think you need the variable in the loop just to enforce 4 iterations) Step 4: The 3rd section of the for loop code is run. Step 5: Repeat steps 2-5 until step 2 evaluates to false Hope that helps.
score: 1
answers question: http://stackoverflow.com/q/26142592
downvote count: 0
type: Answer

http://stackoverflow.com/q/26153069
linked to: http://stackoverflow.com/q/4216123
tagged with: arrays
answer count: 1
downvote count: 0
has body: I have been messing around with re-sizing arrays of pixels. I have managed to make some code that scales up the pixels when they are rendered. The problem with the code is that I can only scale the pixels up with whole numbers (1, 2, 3, etc.). I want to be able to scale the pixels up using a double (.001, .002, etc) so I am not restrained to only a few image sizes. Here is the code I wrote: public void draw(Sprite s, int xCord, int yCord, int scale){ for(int y = 0; y &lt; s.getHeight()*scale; y++){ for(int x = 0; x &lt;s.getWidth()*scale; x++){ pixels[(x+xCord) +(y+yCord)*this.width] = s.pixels[(x/scale+ y/scale * s.getWidth())]; } } } Can this be easily tweaked to allow for non-whole number scales? The class Sprite knows its own width and height given by s.getWidth() and s.getHeight(). The height and width are the actual dimensions in pixels of the .png when it was read.
linked to: http://stackoverflow.com/q/2900801
has answer: http://stackoverflow.com/a/26153501
tagged with: scale
has title: Scaling a Pixel Array in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/40998061
upvote count: 1
accepted answer: http://stackoverflow.com/a/26153501
type: AnsweredQuestion
tagged with: pixel
score: 1
tagged with: java
type: Question
tagged with: graphics

http://stackoverflow.com/comment/40913613
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26106923
type: Comment
has text: This is a valid critique, but it doesn't solve to problem, or?

http://stackoverflow.com/q/26161279
has comment: http://stackoverflow.com/comment/41012816
tagged with: java
tagged with: jboss
has body: I have some applications running on JBoss 4.2.2, JBoss 5.1 and WildFly 8.1.0. All these applications use connection pooling. My datasources are something like that: jdbc:oracle:thin:@myserver.example.com:1521:oracle_service oracle.jdbc.OracleDriver ojdbc6.jar username MyPassWord false false <share-prepared-statements>false</share-prepared-statements> As you can see, I use Oracle Database. The server version is 10g. When Oracle DB going down for a few minutes all my applications on JBoss and WildFly start showing SQLException: Closed Connection. My question: Is it normal? Why JBoss and WildFly don't check the connections to verify this?
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26161385
type: Question
accepted answer: http://stackoverflow.com/a/26161385
tagged with: oracle-database
score: 1
favorite count: 0
tagged with: connection-pooling
has title: JBoss / WildFly connection pooling and closed connections
tagged with: wildfly
upvote count: 1
answer count: 1

http://stackoverflow.com/q/26070467
has body: I am having some problem with Alarm Manager in Android. Inside the onCreate method: notificationCount = notificationCount + 1; AlarmManager mgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent notificationIntent = new Intent(context, ReminderAlarm.class); notificationIntent.putExtra("NotifyCount", notificationCount); PendingIntent pi = PendingIntent.getBroadcast(context, notificationCount, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 60000+System.currentTimeMillis(), pi); ComponentName receiver = new ComponentName(context, BootReceiver.class); PackageManager pm = context.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); Reminder Alarm class: public class ReminderAlarm extends BroadcastReceiver { private NotificationManager mNotificationManager; private Notification notification; @Override public void onReceive(Context context, Intent intent) { mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent .getActivity(context, 0, new Intent(), 0); notification = new Notification( R.drawable.ic_launcher, "Notification", System.currentTimeMillis()); notification .setLatestEventInfo(context, "AlarmActivated", "Hello", contentIntent); mNotificationManager.notify( Integer.parseInt(intent.getExtras() .get("NotifyCount").toString()), notification); }} In the boot receiver class: public void onReceive(Context context, Intent i) { scheduleAlarms(context); } static void scheduleAlarms(Context context) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 1); AlarmManager mgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent notificationIntent = new Intent(con…
favorite count: 0
has title: Alarm Manager fail to setRepeating
tagged with: android
has answer: http://stackoverflow.com/a/26070584
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26070584
tagged with: alarmmanager
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26137241
accepted answer: http://stackoverflow.com/a/26137314
type: Question
has body: I have declared a multi- dimensional array like this: String[][] contentDetails = {}; I populated the array like this: contentDetails[][] = {{"Availability","Available from: "+empst}, {"Rate in EUR/Hour",rst.getString(25)}}; It is getting error. How can I do that? I am new this. Please help me. What I want is an empty array first and then need to populate!!
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/40968330
answer count: 3
has answer: http://stackoverflow.com/a/26137389
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40968161
possible better answer: http://stackoverflow.com/a/26137389
has answer: http://stackoverflow.com/a/26137314
has comment: http://stackoverflow.com/comment/40968218
type: AnsweredQuestion
tagged with: java
has title: Java multi-dimensional array is not populating correctly
downvote count: 2
has answer: http://stackoverflow.com/a/26137965

http://stackoverflow.com/comment/40945972
type: QuestionComment
comment on: http://stackoverflow.com/q/26123706
score: 0
has text: @thkala - As I mentioned in my question, I am aware of that particular solution. But the problem is, I am calling a shell script in which there is a function that calls "who -m" command. And this shell script is accessed by different tools that are developed using different languages. It works everywhere except Java tool. So, I need to find a solution within shell script that would work with every other tool including Java.
type: Comment

http://stackoverflow.com/a/26176969
answers question: http://stackoverflow.com/q/26176645
score: 0
has body: Maybe you can try something like this: <ImageView android:id="@+id/ImageShow" android:layout_width="wrap_content" android:layout_height="wrap_content" />
type: Answer

http://stackoverflow.com/comment/40852743
type: Comment
type: QuestionComment
score: 3
has text: Why do u still use AWT? It was replaced by Swing years ago
comment on: http://stackoverflow.com/q/26073723

http://stackoverflow.com/a/26189466
has comment: http://stackoverflow.com/comment/41143363
has comment: http://stackoverflow.com/comment/41141506
has body: Analysis routing According to your question, suppose there are some resources as below: occupied = [d1, d2, d3, d4, d5]; // for easier representation, suppose elements are in ascending order range = [start, end]; So, you want to return every document if its data satisfy one of the following criteria after sorting in ascending order: start, end, d1, d2, d3, d4, d5 // equivalent to: min(occupied) > end d1, d2, d3, d4, d5, start, end // equivalent to: max(occupied) &lt; start If elements are stored in order in occupied, it is easy to fetch the minimum and maximum value. But you don't mention it, so I suppose essentially they are not in order. Unfortunately, there is no operator to get minimum or maximum value from an array in standard query. But according to the feature of array field in comparison of standard query, matching will return true if at least one element or itself satisfying the criteria; return false only all fail the criteria. It's lucky to find that min(occupied) &gt; end is equivalent to NOT (at least one element &lt;= end), which is the key point to achieve by following method. Fulfill on mongo shell: db.b.find({ $or: [{ occupied: { $not: { $lte: end } } }, { occupied: { $not: { $gte: start } } }] }). pretty(); Then translate to Java code like this: Criteria c = new Criteria().orOperator(where("occupied").not().lte(end), where("occupied").not().gte(start)); Query query = new Query().addCriteria(c); List&lt;Room&gt; rooms = mongoTemplate.find(query, Room.class);
has comment: http://stackoverflow.com/comment/41115021
has comment: http://stackoverflow.com/comment/41117729
score: 0
has comment: http://stackoverflow.com/comment/41157688
type: Answer
answers question: http://stackoverflow.com/q/26176548

http://stackoverflow.com/comment/40975630
has text: Which DBMS are you using? Postgres? Oracle? And what exactly is the problem? Do you get an error? If yes which one? If not what *is* the problem?
score: 1
comment on: http://stackoverflow.com/q/26141312
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26147699
upvote count: 3
has comment: http://stackoverflow.com/comment/40987992
accepted answer of: http://stackoverflow.com/q/26147653
type: AcceptedAnswer
downvote count: 0
has body: So you want to pass "code" as an argument to a method. The way to do this in Java is to pass an object with you call a method on. If you don't have any arguments to the code you want to run nor is interested in any return value, you can use the Runnable interface for this. So, try this: public static void repeatThis(Runnable runnable, int times) { for (int i = 0; i &lt; times; i++) { runnable.run(); } } and invoke the method with repeatThis(new Runnable() { public void run() { System.out.println("Your action"); } }, 10); If you're on Java 8 you can use lambdas and express it as follows: repeatThis(() -&gt; System.out.println("Your action"), 10);
has comment: http://stackoverflow.com/comment/40987766
type: Answer
score: 3
answers question: http://stackoverflow.com/q/26147653

http://stackoverflow.com/comment/40802448
has text: Here is an example for how you can get variables from controller class https://gist.github.com/cooljith91112/5a2f6250b987266adaa1
comment on: http://stackoverflow.com/a/26045490
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/29394392
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26172607
upvote count: 1
has body: Yes you can optimize the internal for loop. Don't create new Color objects. Use directly the int value of RGB. This will limit the number of Objects created and the frequency of call to Garbage collection. int color1 = b1.getRGB(x, y); int alpha1 = (color1 &gt;&gt; 24) &amp; 0xFF; int red1 = (color1 &gt;&gt; 16) &amp; 0xFF; int green1 = (color1 &gt;&gt; 8) &amp; 0xFF; int blue1 = (color1 &gt;&gt; 0) &amp; 0xFF; int color2 = b2.getRGB(x, y); int alpha2 = (color2 &gt;&gt; 24) &amp; 0xFF; int red2 = (color2 &gt;&gt; 16) &amp; 0xFF; int green2 = (color2 &gt;&gt; 8) &amp; 0xFF; int blue2 = (color2 &gt;&gt; 0) &amp; 0xFF; error += Math.abs(red1 - red2); error += Math.abs(green1 - green2); error += Math.abs(blue1 - blue2); error += Math.abs(alpha1 - alpha2);

http://stackoverflow.com/comment/41008160
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26158478
has text: Can't I say this: printing will have the same amount of overhead?
type: AnswerComment

http://stackoverflow.com/a/26193368
has comment: http://stackoverflow.com/comment/41073705
has comment: http://stackoverflow.com/comment/41074386
score: 1
has comment: http://stackoverflow.com/comment/41074221
has comment: http://stackoverflow.com/comment/41073030
has comment: http://stackoverflow.com/comment/41074181
has comment: http://stackoverflow.com/comment/41073112
has comment: http://stackoverflow.com/comment/41072525
has comment: http://stackoverflow.com/comment/41072629
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41072409
type: Answer
accepted answer of: http://stackoverflow.com/q/26193297
has body: Update based on current adapter You are returning a count of 0 in your adapter. This means that your adapter will display zero rows. You should be returning the size of ArrayListActors. Rather change it to something like this: public int getCount() { // wrong // return 0; return ArrayListActors.size(); } Also your adapter is not returning any items from the data in your getItem() method. This means that once you fix the getCount() method, the adapter is still not querying your ArrayListActors for real data. This should return the correct item from your ArrayListActors. public Object getItem(int i) { // wrong // return null; return ArrayListActors.get(i); } Original Answer showing how to assign data to an adapter (I will leave this info here, as it may help future readers dealing with adapters.) You need to set the new Actors list onto your ArrayAdapter before calling notifyDataSetChanged(). Something like: protected void onPostExecute(ArrayList&lt;Actors&gt; result) { if(result != null) { /* CHANGE IN NEXT LINE */ adaptor.ArrayListActors = result; adapter.notifyDataSetChanged(); } else { Toast.makeText(getApplicationContext(), "Unable to fetch data from server", Toast.LENGTH_LONG).show(); } } Setting the result onto your actorslist changes the object that actorslist is pointing at. This means that the reference inside your adapter no longer points to the new actorslist, but still to the old one. So the display still shows the old data, which is what the adapter knows about. Another alternative, as mentioned by Nightware in his comment, is to retain the same reference, but clear out and repopulate your actorsList. This way the adapter is still referencing your same actorsList object, so when you change the contents of that object, the adapter is able to see the new information. protected void onPostExecute(ArrayList&lt;Actors&gt; result) { if(result != null) { actorsList.clear(); actorsList.addAll(result); adapter.notifyDataSetChanged(); } else { Toast.makeText(getAp…
answers question: http://stackoverflow.com/q/26193297
has comment: http://stackoverflow.com/comment/41073155
has comment: http://stackoverflow.com/comment/41072813
has comment: http://stackoverflow.com/comment/41074731

http://stackoverflow.com/a/26154809
answers question: http://stackoverflow.com/q/26154715
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: Here is one way to sort by the lengths of the sub lists: You can create a Comparator for two ArrayList&lt;Integer&gt; that compares their lengths and use it as the comparator parameter in Collections.sort() class LengthComparator implements Comparator&lt;ArrayList&lt;Integer&gt;&gt; { public int compare(ArrayList&lt;Integer&gt; list1, ArrayList&lt;Integer&gt; list2) { return list2.size() - list1.size(); // sort descending in length } } // ... ArrayList&lt;ArrayList&lt;Integer&gt;&gt; mainList; // ... initialization, adding data // sort Collections.sort(mainList, new LengthComparator()); As far as getting the max without looping... not really. I mean you can iterate through a structure in a different way other than looping (recursion for example) but in the end you have to check each element... Think about it, how can you know if something has the maximum value in a group if you don't compare it with everything else in the group?
accepted answer of: http://stackoverflow.com/q/26154715

http://stackoverflow.com/q/26064335
tagged with: http://stackoverflow.com/tag/html
has title: Controller doesn't response to the button on the website
has answer: http://stackoverflow.com/a/26064862
has comment: http://stackoverflow.com/comment/40836429
has comment: http://stackoverflow.com/comment/40835854
type: AnsweredQuestion
has body: I'm new to frontend, there is a div block on my website which is based on thymeleaf, and I created a button in it, here is the html code, please focus on the button which on the last three rows, which is the best answer option 1 Next One Following is my controller, @Controller @EnableAutoConfiguration @RequestMapping("/quiz") @Import({ QuizServiceImpl.class, QuestionServiceImpl.class }) public class ExamController { private static UUID testVariable = null; @RequestMapping(value = "/nextQuestion", method = RequestMethod.POST) public ModelAndView doNextQuestion(@ModelAttribute("answeredQuestion") AnsweredQuestion answeredQuestion) { System.out.println("run in next ques"); Question question = quizService .getNextQuestion(null, testVariable); System.out.println(question.toString()); ModelAndView modelAndView = new ModelAndView("examination"); ChoiceQuestion choiceQuestion = (ChoiceQuestion) question; modelAndView.addObject("questionStem", choiceQuestion.getQuestionStem()); modelAndView.addObject("options", choiceQuestion.getOptions()); return modelAndView; } } Additional information, the answeredQuestion is a empty class without any method or member. The issue is, when I click the button Next One, there is no any response from the controller, what I used is spring boot, I'm sure service and controller are all up. Could anyone help me with it? Thanks a lot.
type: Question
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/26064862
tagged with: java
score: 0
answer count: 1
tagged with: jquery
tagged with: controller

http://stackoverflow.com/comment/42728822
has text: hmm.. I did not quite get what you said. In your XML file you have "hostName=127.0.0.1". This will have ehcache RMI listen to itself on each host instead of listening to other hosts because each host will broadcast their caches as 127.0.0.1/cacheName. So if on each server you change this value from 127.0.0.1 to the real IP of that host and restart tomcat that server will start broadcasting its real address so the other servers will properly see it
comment on: http://stackoverflow.com/a/27067445
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26096785
has body: Use a ParsePosition as follows: try { String input = "12/31/2014XYZ"; ParsePosition pp = new ParsePosition(0); sdf.parse(input, pp); // Make sure the entire string was parsed if (pp.getIndex() != input.length()) throw new Exception(); System.out.println("Valid Date"); } catch (Exception e) { System.out.println("Invalid Date"); } Similar questions: Why does DecimalFormat allow characters as suffix? Is this a Java DateFormat bug?
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26096618
answers question: http://stackoverflow.com/q/26096618
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/26136232
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26148903
accepted answer: http://stackoverflow.com/a/26148903
answer count: 3
has comment: http://stackoverflow.com/comment/40966359
downvote count: 1
has body: There are 2 tables and I need to select the "date1" text which might be in the tr/td/a in the 1st table or tr/td in the 2nd table. How to write a xpath for this kind of scenario? date1 date1 date2 date3 date1 date2 date3 I tried this but this select the entire row. I want to select a specific column xpath=(//table)[2]//tr[td[contains(text(),'date1') and not(text()=' ')] or td/a[contains(text(),'date1') and not(text()=' ')]]
has answer: http://stackoverflow.com/a/26136382
has comment: http://stackoverflow.com/comment/40970063
favorite count: 0
has comment: http://stackoverflow.com/comment/40969077
has answer: http://stackoverflow.com/a/26148846
has title: How to write a XPath that selects a attribute value in two different levels
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
tagged with: selenium-webdriver
tagged with: xpath
has comment: http://stackoverflow.com/comment/40966961
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/26136382
type: Question

http://stackoverflow.com/comment/41047742
type: QuestionComment
comment on: http://stackoverflow.com/q/26179976
has text: Yes, it returns the value incremented.
score: 0
type: Comment

http://stackoverflow.com/q/26170990
answer count: 1
favorite count: 0
has body: I have a small query please let me explain the scenario. I have a swing jframe in which i have a button named "start" which starts the timer in seconds so whenever i click on start it converts the the button itself to "reset" which should make the seconds to zero and should again convert itself to "start". My concern is for these both scenarios i have to run two set of codes for which i used two classes which implements ActionListener interface is there any way to include these two set of codes in the same class which implements ActionListener, and switch the block of code depending on a boolean variable which changes its value as the button changes. I tried it but i am facing performance issues like freezing the application and not even working exactly as expected. please review my code below. public class SuperTimer extends JFrame { JButton start; private final StartCountDown countdown; public SuperTimer() { countdown= new StartCountDown(); start.addActionListener(countdown); } public class StartCountDown implements ActionListener { public void actionPerformed(ActionEvent l) { if(l.getSource()==start) { count = Long.parseLong(input.getText()); start.setText("Reset"); reset = new Reset(); start.removeActionListener(countdown); start.addActionListener(reset); invalid.setVisible(false); } TimeClass tc = new TimeClass(count); timer = new Timer(1000,tc); timer.start(); } } public class Reset implements ActionListener { public void actionPerformed(ActionEvent j) { start.setText("Start"); time.setText("00:00:00"); input.setText(""); timer.stop(); timeup.setVisible(false); start.removeActionListener(reset); start.addActionListener(countdown); } } }**
has title: Using boolean variable instead of ActionListner interface in swing
has comment: http://stackoverflow.com/comment/41064921
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26171042
downvote count: 0
tagged with: swing
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/26171042
tagged with: abstract-action
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41064956
tagged with: action-interface
upvote count: 1

http://stackoverflow.com/a/26174213
downvote count: 0
has body: The "Automatic Mixed Mode" is what you are looking for: http://www.h2database.com/html/features.html#auto_mixed_mode Quote from the manual: Multiple processes can access the same database without having to start the server manually. To do that, append ;AUTO_SERVER=TRUE to the database URL [...] Use the same URL for all connections to this database. [...] The application that opens the first connection to the database uses the embedded mode, which is faster than the server mode
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26173181
score: 1

http://stackoverflow.com/comment/40852746
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26072170
has text: @StephenCarlson no i don't have control over schema. it is response from a web service

http://stackoverflow.com/comment/40989093
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26148016
has text: Somehow developing an appetite for pasta...
score: 0

http://stackoverflow.com/q/26092768
favorite count: 0
has answer: http://stackoverflow.com/a/26092860
has comment: http://stackoverflow.com/comment/40887897
has answer: http://stackoverflow.com/a/26092964
answer count: 5
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26092790
has title: Can't compare HashMap key value to Scanner input
score: 1
tagged with: java
type: Question
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/26092823
has answer: http://stackoverflow.com/a/26092823
downvote count: 0
has body: I'm trying to compare a key value from a HashMap to an index of an array generated from user input. The overall goal is to turn 12/25/2000 into December 25, 2000, and everything else works except for this. import java.util.*; class Dates { private static final Set&lt;Integer&gt; THIRTY_DAY_MONTHS = new HashSet&lt;&gt;(Arrays.asList(4, 6, 8, 11)); private static Map&lt;Integer, String&gt; MONTHS = new HashMap&lt;&gt;(12); private static String monthString; public static void main(String[] args) { try { System.out.println("Enter month/day/year to be converted to normal format: "); Scanner s = new Scanner(System.in); String[] input = s.nextLine().split("/"); int[] inputNumbers = new int[input.length]; for (int i = 0; i &lt; input.length; i++) { inputNumbers[i] = Integer.parseInt(input[i]); } int month = inputNumbers[0]; int day = inputNumbers[1]; int year = inputNumbers[2]; MONTHS.put(1, "January"); MONTHS.put(2, "February"); MONTHS.put(3, "March"); MONTHS.put(4, "April"); MONTHS.put(5, "May"); MONTHS.put(6, "June"); MONTHS.put(7, "July"); MONTHS.put(8, "August"); MONTHS.put(9, "September"); MONTHS.put(10, "October"); MONTHS.put(11, "November"); MONTHS.put(12, "December"); for(Integer currentKey : MONTHS.keySet()) { if (currentKey == month) monthString = MONTHS.get(currentKey); else throw new MonthException(); } if (THIRTY_DAY_MONTHS.contains(month) &amp;&amp; day &gt; 30) { //Logic for valid day ranges for months that only contain 30 days throw new DayException(); } else if (day &gt; 31 || day &lt;= 0) { //Logic for max and min # of possible days per any month throw new DayException(); } else if (month == 2 &amp;&amp; day &gt; 29 &amp;&amp; year % 4 == 0 &amp;&amp; (year % 100 != 0 || year % 400 == 0)) { //Logic for # of days in February for a leap year throw new DayException(); } else if (year &lt; 1000 || year &gt; 3000) { //Logic for valid range of years throw new YearException(); } System.out.println(monthString + ' ' + day + ", " + year); } catch (MonthException …
has answer: http://stackoverflow.com/a/26092830
has answer: http://stackoverflow.com/a/26092790
has comment: http://stackoverflow.com/comment/40887896

http://stackoverflow.com/a/26179938
type: AcceptedAnswer
type: Answer
has body: Adding the generic &lt;Parent&gt; to the Parent class declaration got things running again: public class Parent extends GrandParent &lt;Parent&gt; { ... }
accepted answer of: http://stackoverflow.com/q/26068095
answers question: http://stackoverflow.com/q/26068095
score: 0

http://stackoverflow.com/comment/40843506
has text: @Ashalynd thanks a lot. I am using remove for that but since my program stops picking elements I thought maybe the reason is behind Arraybuffer. It is reading a line in a binary image it is a continuous line but it stops in some point!
comment on: http://stackoverflow.com/a/26068495
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40808463
comment on: http://stackoverflow.com/a/26049480
score: 0
type: AnswerComment
has text: The part that talks about running the program. Is this not a duplicate, @panini?
type: Comment

http://stackoverflow.com/comment/80320764
type: Comment
comment on: http://stackoverflow.com/a/26148743
has text: @AyadiAkrem it would be better have a case scenario to evaluate xml, pojo, etc
score: 0
type: AnswerComment

http://stackoverflow.com/q/26101303
has body: I'm trying to run a report with a multi-value parameter. It's a really simple case, the query basically looks like this: SELECT COLNAME FROM TABLE WHERE (COLNAME IN (@PARAM)) From within Visual Studio, I can run the report no questions asked. However, once it's uploaded to the report server and called from our web app, I get the following error: Cannot read the next data row for the dataset. System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value '104274,104264' to data type int. Ok, so it's pretty obvious what the issue is. The parameters are not being recognized by SSRS as a CSV list of parameters, but rather as one string. I noticed if I pass the values into the param manually with a linebreak inbetween them instead of a comma, it works. But the request URL in both cases is exactly the same: broken case: POST /ReportServer/Pages/ReportViewer.aspx?%2feval_multi&amp;rs%3aCommand=Render&amp;evalID=104274%2c104264&amp;userID=472 HTTP/1.1\\r\\n working case:POST /ReportServer/Pages/ReportViewer.aspx?%2feval_multi&amp;rs%3aCommand=Render&amp;evalID=104274%2c104264&amp;userID=472 HTTP/1.1\\r\\n This is being called from our Java web app which returns an HttpServletResponse object using a GET request to SSRS. How do I get SSRS to understand that these parameters are multivalued and not just one string when coming from Java (yes, the parameter is specified as multi-value in visual studio)?
score: 0
has title: Cannot read the next data row for the dataset SSRS 2008 R2
tagged with: ssrs-2008-r2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26122028
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26122028

http://stackoverflow.com/q/26086358
score: 0
tagged with: groovy
answer count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/26088603
type: UnansweredQuestion
tagged with: java
has title: Command's output does not show up in the gradle test report's Standard output
tagged with: gradle
type: Question
has body: I execute some commands in my JUnit test code written in groovy but the command's output does not show up in the gradle test report. Does anyone know why this happen? Following is my simplified code: package org.myorg.myapp import org.apache.commons.exec.CommandLine import org.apache.commons.exec.DefaultExecutor import org.junit.Test class MyTest { @Test void executelsCommand() { println("Started.") String line = "ls" CommandLine cmdLine = CommandLine.parse(line) DefaultExecutor executor = new DefaultExecutor() int exitValue = executor.execute(cmdLine) println("Finished.") } } build.gradle: apply plugin: 'java' apply plugin: 'groovy' repositories { mavenCentral() } dependencies { compile 'org.codehaus.groovy:groovy-all:2.3.3' testCompile 'org.apache.commons:commons-exec:1.2' testCompile 'junit:junit:4.11' } test { testLogging.showStandardStreams = true } The result of executing the above code is following: If I execute the above code in my eclipse using Run As -> JUnit Test, ls command's output successfully shows up in the Console window.

http://stackoverflow.com/comment/40881097
score: 0
type: AnswerComment
type: Comment
has text: What about if I have a program and not just a particular algorithm that does "something" in specific". Let's say I have a program that operates(executes) different tasks;for example, let's say I have a program that generates random numbers within a matrix (2d array) and then it sorts them in ascending order. The user is asked to enter any number that will make the program to print out a message specifying of whether the number chosen is in the array or not. Do I have to evaluate each statement individually?
comment on: http://stackoverflow.com/a/26088853

http://stackoverflow.com/comment/40781427
score: 0
comment on: http://stackoverflow.com/q/26034599
type: Comment
type: QuestionComment
has text: I don't have log4j.xml file

http://stackoverflow.com/a/26056308
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26055695
answers question: http://stackoverflow.com/q/26055695
type: AcceptedAnswer
downvote count: 0
has body: You just need to ensure that the object you return is an exported remote object, and that it's referred to in the remote interface that returns it by its own remote interface name, not its own name.

http://stackoverflow.com/comment/40919831
has text: Why does it work on the computer that wrote the code, but not on any other computer? both computers run the latest JRE version.
type: Comment
comment on: http://stackoverflow.com/a/26110270
score: 0
type: AnswerComment

http://stackoverflow.com/a/26152015
answers question: http://stackoverflow.com/q/26152000
downvote count: 0
has body: Convert the ArrayList to a HashSet. List&lt;String&gt; listWithDuplicates; // Your list containing duplicates Set&lt;String&gt; setWithUniqueValues = new HashSet&lt;&gt;(listWithDuplicates); If for some reason, you want to convert the set back to a list afterwards, you can, but most likely there will be no need. List&lt;String&gt; listWithUniqueValues = new ArrayList&lt;&gt;(setWithUniqueValues);
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/40996020

http://stackoverflow.com/comment/41034057
comment on: http://stackoverflow.com/a/26170789
type: AnswerComment
score: 0
type: Comment
has text: it's in the JavaDoc comment in the source, and `SceneBuilder` doesn't exist in JavaFX 8. Citations: http://sta.sh/01f8u7ntv30x and http://docs.oracle.com/javase/8/javafx/api/javafx/scene/package-summary.html

http://stackoverflow.com/q/26050406
has body: When I run any app,even the basic one where it has the "Hello world" on the screen doesn't work. can someone help me figure out what this all means >.> thank you kindly. this happens on my computer, on a friends computer it simply won't run, I have freshly re installed android studio (but not the java JDKs) Configuration on demand is an incubating feature. Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0 :app:preBuild :app:compileDebugNdk UP-TO-DATE :app:preDebugBuild :app:checkDebugManifest :app:preReleaseBuild :app:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42000Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources :app:processDebugManifest UP-TO-DATE :app:processDebugResources :app:generateDebugSources :app:compileDebugJava UP-TO-DATE :app:preDexDebug unknown output extension: C:\Users\Rick\Documents\Spellbook\SpellbookD usage: dx --dex [--debug] [--verbose] [--positions=&lt;style&gt;] [--no-locals] [--no-optimize] [--statistics] [--[no-]optimize-list=&lt;file&gt;] [--no-strict] [--keep-classes] [--output=&lt;file&gt;] [--dump-to=&lt;file&gt;] [--dump-width=&lt;n&gt;] unknown output extension: C:\Users\Rick\Documents\Spellbook\SpellbookD usage: dx --dex [--debug] [--verbose] [--positions=&lt;style&gt;] [--no-locals] [--no-optimize] [--statistics] [--[no-]optimize-list=&lt;file&gt;] [--no-strict] [--dump-method=&lt;name&gt;[*]] [--verbose-dump] [--no-files] [--core-library] [--num-threads=&lt;n&gt;] [--incremental] [--force-jumbo] [--multi-dex [--main-dex-list=&lt;file&gt; [--minimal-main-dex]] [&lt;file&gt;.class | &lt;file&gt;.{zip,jar,apk} | &lt;directo…
score: 0
has comment: http://stackoverflow.com/comment/40810235
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26052558
has comment: http://stackoverflow.com/comment/40810664
tagged with: java
has title: When I run any App the program gives me a error
type: Question
answer count: 1

http://stackoverflow.com/comment/40997233
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26108534
has text: I will get back to you when I have had time to change my level of abstraction about this. Hopefully tomorrow. Thank you.
score: 0

http://stackoverflow.com/q/26050963
has comment: http://stackoverflow.com/comment/40811351
upvote count: 1
type: Question
has body: public class LList2&lt;T&gt; implements ListInterface&lt;T&gt; { private Node firstNode; // head reference to first node private Node lastNode; // tail reference to last node private int numberOfEntries; public LList2() { clear(); } // end default constructor public final void clear() // NOTICE clear is not final in interface and that is OK { firstNode = null; lastNode = null; numberOfEntries = 0; } // end clear public void add(T newEntry) // OutOfMemoryError possible { Node newNode = new Node(newEntry); // create new node if (isEmpty()) firstNode = newNode; else lastNode.setNextNode(newNode); lastNode = newNode; numberOfEntries++; } // end add public boolean add(int newPosition, T newEntry) // OutOfMemoryError possible { boolean isSuccessful = true; if ((newPosition &gt;= 1) &amp;&amp; (newPosition &lt;= numberOfEntries + 1)) { Node newNode = new Node(newEntry); if (isEmpty()) { firstNode = newNode; lastNode = newNode; } else if (newPosition == 1) { newNode.setNextNode(firstNode); firstNode = newNode; } else if (newPosition == numberOfEntries + 1) { lastNode.setNextNode(newNode); lastNode = newNode; } else { Node nodeBefore = getNodeAt(newPosition - 1); Node nodeAfter = nodeBefore.getNextNode(); newNode.setNextNode(nodeAfter); nodeBefore.setNextNode(newNode); } // end if numberOfEntries++; } else isSuccessful = false; return isSuccessful; } // end add public T remove(int givenPosition) { T result = null; // return value if ((givenPosition &gt;= 1) &amp;&amp; (givenPosition &lt;= numberOfEntries)) { assert !isEmpty(); if (givenPosition == 1) // case 1: remove first entry { result = firstNode.getData(); // save entry to be removed firstNode = firstNode.getNextNode(); if (numberOfEntries == 1) lastNode = null; // solitary entry was removed } else // case 2: givenPosition &gt; 1 { Node nodeBefore = getNodeAt(givenPosition - 1); Node nodeToRemove = nodeBefore.getNextNode(); Node nodeAfter = nodeToRemove.getNextNode(); nodeBefore.setNextNode(nodeAfter); // disconnect the…
tagged with: java
has title: linkedlist when It reach end of list
has answer: http://stackoverflow.com/a/26052204
has comment: http://stackoverflow.com/comment/40811225
accepted answer: http://stackoverflow.com/a/26052204
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40811161
tagged with: singly-linked-list
has comment: http://stackoverflow.com/comment/40811374
type: AnsweredQuestion

http://stackoverflow.com/a/26194373
answers question: http://stackoverflow.com/q/26194144
has comment: http://stackoverflow.com/comment/41079194
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41074280
downvote count: 0
score: 1
has body: I tried your code as written and it ran just fine... Are you trying to run it from the command line or from within an IDE? I tried running it from within Eclipse and received an IO error. It wasn't registering where Memory.class was. I exited to the file system and navigated to where Memory.class and Processor.class were. Executing from within that directory worked fine.

python
tags question: http://stackoverflow.com/q/26116519
tags question: http://stackoverflow.com/q/26122971
tags question: http://stackoverflow.com/q/26168493
tag name: python
tags question: http://stackoverflow.com/q/26087726
tags question: http://stackoverflow.com/q/26084212
tags question: http://stackoverflow.com/q/26136844
tags question: http://stackoverflow.com/q/26171862
type: Tag
tags question: http://stackoverflow.com/q/26166185
tags question: http://stackoverflow.com/q/26117714
tags question: http://stackoverflow.com/q/26041769
tags question: http://stackoverflow.com/q/26142907

http://stackoverflow.com/comment/40965437
score: 2
comment on: http://stackoverflow.com/q/26135541
has text: How about chain of resposibility pattern?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26181523
has body: Storm returns every field that was processed during the execution chain in a Json array. The order of the values are the same as they were processed, so if you are interested in the result of only the last function then you should read only the last value from the array. If for any reason you are not interested in the intermediate results then you can limit it with the projection method. For example if you have a stream : stream.each(new Fields("args"), new AddExclamation(), new Fields(EX_1)) .each(new Fields(EX_1), new AddPlus(), new Fields(P1, P2)); that returns [["hello","hello!1","hello!1+1","hello!1+2"],["hello","hello!2","hello!2+1","hello!2+2"]] then by setting projection, you can limit to P2 stream.each(new Fields("args"), new AddExclamation(), new Fields(EX_1)) .each(new Fields(EX_1), new AddPlus(), new Fields(P1, P2)) .project(new Fields(P2)); so the output will be only this [["hello!1+2"],["hello!2+2"]] You can see this in action here : https://github.com/ExampleDriven/storm-example/blob/master/src/test/java/org/exampledriven/ExclamationPlusTridentTopologyTest.java
has comment: http://stackoverflow.com/comment/41116746
answers question: http://stackoverflow.com/q/26163667
has comment: http://stackoverflow.com/comment/41051364
has comment: http://stackoverflow.com/comment/41152717
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41052212
has comment: http://stackoverflow.com/comment/41057665
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41182388
has comment: http://stackoverflow.com/comment/41143067
has comment: http://stackoverflow.com/comment/41189803
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41051006
accepted answer of: http://stackoverflow.com/q/26163667

http://stackoverflow.com/comment/40847059
score: 0
type: Comment
type: QuestionComment
has text: The internal implementation of the stack is your list `values`, so why not define equality of two stacks on equality of their `values`?
comment on: http://stackoverflow.com/q/26070488

http://stackoverflow.com/comment/40811513
comment on: http://stackoverflow.com/q/26051175
score: 0
type: Comment
type: QuestionComment
has text: Pretty poor for `sun.net.www.protocol.http.HttpURLConnection` to make up its own error message instead of using the one that came with the original `IOException,` but you may have exceeded an upload limit at the server.

http://stackoverflow.com/a/26124693
has comment: http://stackoverflow.com/comment/40969980
has body: Use the below given class as a Facebook helper that might deal with you error. import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.text.TextUtils; import com.facebook.FacebookException; import com.facebook.FacebookOperationCanceledException; import com.facebook.FacebookServiceException; import com.facebook.HttpMethod; import com.facebook.LoggingBehavior; import com.facebook.Request; import com.facebook.RequestAsyncTask; import com.facebook.Session; import com.facebook.SessionState; import com.facebook.Settings; import com.facebook.widget.WebDialog; import com.quickblox.q_municate.R; import java.util.Arrays; import java.util.Collection; import java.util.List; public class FacebookHelper { public static final List&lt;String&gt; PERMISSIONS = Arrays.asList("publish_actions", "publish_stream"); private Activity activity; private Session.StatusCallback facebookStatusCallback; private Resources resources; public FacebookHelper(Activity activity, Bundle savedInstanceState, Session.StatusCallback facebookStatusCallback) { this.activity = activity; this.facebookStatusCallback = facebookStatusCallback; resources = activity.getResources(); initFacebook(savedInstanceState); } public static void logout() { if (Session.getActiveSession() != null) { Session.getActiveSession().closeAndClearTokenInformation(); } } private void initFacebook(Bundle savedInstanceState) { Session session = Session.getActiveSession(); if (session != null) { return; } if (savedInstanceState != null) { session = Session.restoreSession(activity, null, facebookStatusCallback, savedInstanceState); } if (session == null) { session = new Session(activity); } Session.setActiveSession(session); if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) { session.openForRead(new Session.OpenRequest(activity).setCallback(facebookStatusCallback)); } } public void onSaveInstanceState(Bundle outState) { Session session = Sess…
answers question: http://stackoverflow.com/q/26124304
has comment: http://stackoverflow.com/comment/40966915
has comment: http://stackoverflow.com/comment/40969684
has comment: http://stackoverflow.com/comment/40968477
score: 0
has comment: http://stackoverflow.com/comment/40970097
type: Answer

http://stackoverflow.com/comment/41006023
type: QuestionComment
comment on: http://stackoverflow.com/q/26156760
score: 0
type: Comment
has text: Of course it compiles. The compiler doesn't need to prevent you from adding a `Set<Integer>` to an `ArrayList<Set<?>>`.

http://stackoverflow.com/a/26072722
has body: Cat [] list = new Cat[10]; So once you have a list and objects of a type inside the list then you can call them like you would any other object. list[0].methodName(); Notice list[0] behaves like a Cat object, because that is what it holds.
type: Answer
answers question: http://stackoverflow.com/q/26072665
score: 0

http://stackoverflow.com/comment/40990565
type: QuestionComment
score: 1
has text: http://en.wikipedia.org/wiki/Leap_year#Algorithm
comment on: http://stackoverflow.com/q/26149028
type: Comment

http://stackoverflow.com/a/26112107
accepted answer of: http://stackoverflow.com/q/26111860
type: AcceptedAnswer
downvote count: 0
has body: No. The Java File object basically wraps a filename, but it doesn't hold an open file handle until you use it to open a stream or reader.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26111860

http://stackoverflow.com/comment/40862995
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26079312
has text: Nice solution, I didn't know about these classes. Though, what I would do in `full` would be positionning a boolean flag to true, meaning the timer has reached the end, so that the main loop can exit. +1 anyway :)
score: 0

http://stackoverflow.com/q/26114227
accepted answer: http://stackoverflow.com/a/26114520
possible better answer: http://stackoverflow.com/a/26114800
tagged with: java
has answer: http://stackoverflow.com/a/26114800
type: Question
has title: If a user is required to provide an input to an array, if he leaves out an input, how does one set that element to 0?
has comment: http://stackoverflow.com/comment/40926437
tagged with: arrays
has comment: http://stackoverflow.com/comment/40926268
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40926692
has answer: http://stackoverflow.com/a/26114520
has comment: http://stackoverflow.com/comment/40926315
has comment: http://stackoverflow.com/comment/40926474
has body: I have a 2 dimensional array that is filled using input from the user. I have most of the code done, but one of the requirements, even though its not what the assignment is actually about, is that if an element is left out of the user's input (they enter input separated by spaces), it is automatically set to 0. How can I set that up?
type: AnsweredQuestion

http://stackoverflow.com/comment/40875976
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26084988
type: Comment
has text: @YvesDaoust yes, there is: The function has n parameters, and the array is n-dimensional. No way to vary n (as the question is formulated - of course we could generalize as several answers are saying, including mine). For fixed n it also makes sense to assume the table is available at no cost as you say - it can be considered part of the algorithm. But as soon as n varies, of course you have to take that into consideration of your amortized analysis. I don't think the two of us should be arguing like this though - I guess we both understand this well enough and it won't help the OP a lot :-)

http://stackoverflow.com/q/26137469
has body: I'm new to java and my class has a homework assignment that I need a little help on. I finished everything except for the output, I can't seem to get the program to produce the answer. import java.util.Scanner; public class HomeworkScanner { public static void main(String args[]) { int x, y, z, a, result; Scanner Keyboard; Keyboard = new Scanner(System.in); System.out.println("a = ( x + y ) * z"); System.out.println("Enter first number for x:"); x = Keyboard.nextInt(); // System.out.println("Enter second number for y:"); y = Keyboard.nextInt(); // System.out.println("Enter third number for z:"); z = Keyboard.nextInt(); // result=a=( x + y ) * z; } }
has answer: http://stackoverflow.com/a/26137494
has answer: http://stackoverflow.com/a/26137509
has comment: http://stackoverflow.com/comment/40968553
possible better answer: http://stackoverflow.com/a/26137494
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40968650
accepted answer: http://stackoverflow.com/a/26137509
type: Question
has answer: http://stackoverflow.com/a/26137504
score: 0
has title: How do I get my java program to output the answer?
answer count: 3

http://stackoverflow.com/q/26148251
has comment: http://stackoverflow.com/comment/41012424
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41010631
upvote count: 1
has comment: http://stackoverflow.com/comment/41015426
linked to: http://stackoverflow.com/q/25132274
has comment: http://stackoverflow.com/comment/41011610
tagged with: java
tagged with: itext
tagged with: export-to-pdf
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/41002828
downvote count: 0
has title: Merging files into single pdf generate different view
has body: I´m trying to merge into one file with one or more PDF files stored files and a JasperReports file using iText. I did this method. Map&lt;String, Object&gt; parameters = new HashMap&lt;String, Object&gt;(); List&lt;String&gt; arquivos = new LinkedList&lt;String&gt;(); arquivos.add("/Formulario/teste.jrxml"); arquivos.add("/Formulario/teste.pdf"); try { Document document = new Document(PageSize.A4); document.setMargins(0F, 0F, 0F, 0F); PdfCopy pdfCopy = new PdfCopy(document, new FileOutputStream("c:\\labels\\teste.pdf")); pdfCopy.setMargins(0, 0, 0, 0); document.open(); PdfReader pdfReader = null; InputStream inputStream = null; for (String arquivo : arquivos) { inputStream = ReportService.class.getResourceAsStream(arquivo); if (FilenameUtils.getExtension(arquivo).equals("jrxml")) { JasperReport report = JasperCompileManager.compileReport(inputStream); JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource()); inputStream = new ByteArrayInputStream(JasperExportManager.exportReportToPdf(jasperPrint)); } pdfReader = new PdfReader(inputStream); for (int i = 1; i &lt;= pdfReader.getNumberOfPages(); i++) { pdfCopy.addPage(pdfCopy.getImportedPage(pdfReader, i)); } pdfCopy.freeReader(pdfReader); pdfReader.close(); } document.close(); } catch (DocumentException | IOException | JRException e) { e.printStackTrace(); } I looked at google, but didn't found any answer. So whats wrong? It's possible to generate these pages in the same margins?
has comment: http://stackoverflow.com/comment/41012508
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41010978
answer count: 0

http://stackoverflow.com/q/26072653
upvote count: 1
tagged with: swing
tagged with: jbutton
accepted answer: http://stackoverflow.com/a/26073140
type: AnsweredQuestion
score: 1
tagged with: java
has title: Opening a new JFrame using a JButton
type: Question
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/40850817
has comment: http://stackoverflow.com/comment/40851121
has comment: http://stackoverflow.com/comment/40850784
has comment: http://stackoverflow.com/comment/40851545
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26073140
has body: I have two classes (Sampling and Stacker). The Sampling class (my Main class) is extends JFrame and has a JButton with an ActionListener to open the Stacker class. The problem is when the button is clicked, the Stacker class will open but only a frame without any components. When I switch the main method into the Stacker class, the program works fine. What is the problem? Here is the code: The Sampling class: public class Sampling extends JFrame implements ActionListener { private JButton openStacker; Stacker st; public Sampling() { setSize(300,300); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); setLocationRelativeTo(null); openStacker = new JButton("Start Stacker!"); add(openStacker); openStacker.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { dispose(); st = new Stacker(); } public static void main (String args[]) { new Sampling(); } } The Stacker game class: public class Stacker extends JFrame implements KeyListener { int iteration = 1; double time = 200; int last = 0; int m = 10; int n = 20; JButton b[][]; int length[] = {5,5}; int layer = 19; int deltax[] = {0,0}; boolean press = false; boolean forward = true; boolean start = true; public Stacker() { this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setSize(400,580); this.setUndecorated(false); this.setLocationRelativeTo(null); b = new JButton [m][n]; setLayout(new GridLayout(n,m)); for (int y = 0;y&lt;n;y++) { for (int x = 0;x&lt;m;x++) { b[x][y] = new JButton(" "); b[x][y].setBackground(Color.DARK_GRAY); add(b[x][y]); b[x][y].setEnabled(false); }//end inner for } this.setFocusable(true); this.pack(); this.addKeyListener(this); this.setVisible(true); go(); } public void go() { int tmp = 0; Component temporaryLostComponent = null; do{ if (forward == true) { forward(); } else { back(); } if (deltax[1] == 10-length[1]) { forward = false; } else if (deltax[1] == 0) { forward = true; } draw(); try { Thread.sleep((long) time); } catch (InterruptedExc…
has comment: http://stackoverflow.com/comment/40851046
has comment: http://stackoverflow.com/comment/40850814
answer count: 1
has comment: http://stackoverflow.com/comment/40850811
has comment: http://stackoverflow.com/comment/40851458
tagged with: jframe

http://stackoverflow.com/a/26154856
answers question: http://stackoverflow.com/q/26154837
has comment: http://stackoverflow.com/comment/41001049
has comment: http://stackoverflow.com/comment/41001020
type: Answer
has comment: http://stackoverflow.com/comment/41001085
has comment: http://stackoverflow.com/comment/41001014
downvote count: 0
has comment: http://stackoverflow.com/comment/41001078
has comment: http://stackoverflow.com/comment/41000970
score: 3
has body: Unless you specify otherwise, the source code is not included in the JAR file. The JAR file normally only contain class files (compiled JVM instructions), not source code.
upvote count: 3
has comment: http://stackoverflow.com/comment/41000966
has comment: http://stackoverflow.com/comment/41001039

http://stackoverflow.com/a/26099713
answers question: http://stackoverflow.com/q/26099642
score: 0
has body: The first you are creating a new String object and assigning it "" or empty String. Your variable is pointing to this string object. The second you are not creating a new String object. You are creating a pointer that is not pointing to anything it is null. When you print using "" + yourstring it will print null because of the base Class objects toString() method.
type: Answer

performance
tags question: http://stackoverflow.com/q/26054968
tags question: http://stackoverflow.com/q/26172607
tags question: http://stackoverflow.com/q/26067155
tags question: http://stackoverflow.com/q/26065982
tags question: http://stackoverflow.com/q/26034320
tags question: http://stackoverflow.com/q/26077682
tags question: http://stackoverflow.com/q/26084436
tags question: http://stackoverflow.com/q/26037098
tags question: http://stackoverflow.com/q/26122103
tags question: http://stackoverflow.com/q/26137539
tags question: http://stackoverflow.com/q/26091133
tags question: http://stackoverflow.com/q/26168410
tags question: http://stackoverflow.com/q/26168064
tags question: http://stackoverflow.com/q/26063607
tags question: http://stackoverflow.com/q/26077025
tags question: http://stackoverflow.com/q/26132379
tags question: http://stackoverflow.com/q/26041475
tags question: http://stackoverflow.com/q/26122029
tags question: http://stackoverflow.com/q/26176139
tags question: http://stackoverflow.com/q/26188412
tags question: http://stackoverflow.com/q/26108035
tags question: http://stackoverflow.com/q/26078617
tags question: http://stackoverflow.com/q/26039028
tags question: http://stackoverflow.com/q/26193336
tags question: http://stackoverflow.com/q/26110763
tags question: http://stackoverflow.com/q/26052096
tags question: http://stackoverflow.com/q/26087738
tags question: http://stackoverflow.com/q/26186258
tags question: http://stackoverflow.com/q/26052075
tags question: http://stackoverflow.com/q/26115338
tags question: http://stackoverflow.com/q/26158430
tags question: http://stackoverflow.com/q/26053556
tags question: http://stackoverflow.com/q/26151113
tag name: performance
tags question: http://stackoverflow.com/q/26044177
type: Tag
tags question: http://stackoverflow.com/q/26116181
tags question: http://stackoverflow.com/q/26088567
tags question: http://stackoverflow.com/q/26146873
tags question: http://stackoverflow.com/q/26055745
tags question: http://stackoverflow.com/q/26050410
tags question: http://stackoverflow.com/q/26142063
tags question: http://stackoverflow.com/q/26069651

http://stackoverflow.com/comment/40857796
type: QuestionComment
comment on: http://stackoverflow.com/q/26076523
has text: Back to the documentation. All this is explained there... and more.
score: 1
type: Comment

http://stackoverflow.com/q/26192322
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41072017
answer count: 1
accepted answer: http://stackoverflow.com/a/26195038
tagged with: error-logging
has comment: http://stackoverflow.com/comment/41072479
has comment: http://stackoverflow.com/comment/41074677
has title: Java concurrent logging to file
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41071829
has comment: http://stackoverflow.com/comment/41070627
favorite count: 0
has answer: http://stackoverflow.com/a/26195038
has body: I'm currently writting a logger (e.g. using the java logger) with which I can log activities (info, errors) to a file. This (static) logger class is used by several threads and processes. If I have just one log file then the threads get blocked, is this right? So only one thread can write to the file? Another solution would be to have for each thread a own log file, but this would be a bit messy. Therefore, I tought about first keeping the log in a stream (perhaps for each thread one) and only at the end of the program write everything to a file. Is this the best way? How can I achieve this?
type: Question
tagged with: logging
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26077783
accepted answer: http://stackoverflow.com/a/26077817
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
answer count: 1
has body: The gradle build script defined as follows: 4.times { counter -&gt; task "task$counter" &lt;&lt; { println "I'm task number $counter" } } define 4 different tasks with the names task1, task2, task3, task4. So what 4.times actually is? Is it just a closure which in that case applies 1 argument and called 4 times? So is it just a syntax sugar?
has title: The 4.times closure understanding
score: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/26077817

http://stackoverflow.com/comment/40844229
has text: Yes, you can programmatically create views
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26068837

http://stackoverflow.com/a/26191416
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26190980
downvote count: 0
score: 1
has body: For those who don't know, an Armstrong number (or narcissistic number) is a number with n digits that is equal to the sum of each of its digits to the nth power. (x1*10(n-1))+(x1*10(n-2))...+(x1*10(n-n)) = (x1)n+(x2)n...+(xn)n This means that if the number is 1 digit, the power will be 1. Therefore there are 10 1 digit numbers that are Armstrong numbers: 0 = 01 1 = 11 2 = 21 3 = 31 4 = 41 5 = 51 6 = 61 7 = 71 8 = 81 9 = 91 Your code, as written, will not identify any of those numbers as Armstrong numbers. Your code will also incorrectly identify some numbers as 4 digit Armstrong numbers because you only look for the the cubes (3rd power) of your numbers not the 4th power. (You don't have to worry about twos because there are no two digit Armstrong numbers) In order to correctly determine all the possible Armstrong numbers between 1 and 10000, you need to write a "power" loop that finds the nth power of a number by multiplying the number n times. This would look something like: //... beginning of your original function //added a string to hold all the values before printing string holder = ""; for(int n=0;n&lt;10000;n++){ int sum=0; //n=original you had duplicate variables (just use n as original) int number = n; //while there are still digits left while(number&gt;0){ //get the smallest digit int r=number%10; //----------"Power" loop----------- int foo = n; //once smaller than 10, it's only a power of 1 (which is itself) while(foo&gt;=10){ //this means foo = foo/10 foo /= 10; //this means r = r*r r*=r; } //this means sum = sum+r sum += r; //you should have the hang of it by now number/=10; } //if the sum equals the original number if(sum==n){ //put that number into the end of a string (separated by newlines `\n`) holder+=n+"\n"; } } //All done, so set the text box value tf1.setText(holder); //... whatever code you want to finish up This should also take care of your problem with the textBox getting overwritten each time. By saving the numbers into a string and then p…

http://stackoverflow.com/a/42097211
answers question: http://stackoverflow.com/q/26089026
has body: The reason why this servlet does not works is because of the out.close() instruction that is at the begining of the processRequest() method. System.out.println("Hello"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String userString = request.getParameter("userString"); **out.close();** it prematurely closes the PrintWriter that is used to send a response to the client. So the client get only a reponse with a HTTP header content-type: "text/html;charset=UTF-8" but with a empty body.
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/26051572
type: Question
tagged with: google-maps
has title: Get information GPS when screen turn off
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26051618
tagged with: gps
tagged with: java
has body: I writting a application about GPS, to track itinerary of car. This information will send to server, update every 5 seconds. My problem is when screen turn on, i get information gps normal, but when device turn off screen, i can't get information device location's current. My code: public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude double speed = 0; boolean flag = false; // 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 GPSTracker(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { 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) { latitude = location.getLatitude(); longitude = location.getLongitude(); speed = location.getSpeed(); } } } } // if GPS …

http://stackoverflow.com/comment/40970217
score: 0
has text: Okay it's fine.If Search string comes from another textField entered by user.How can I give for that situation.For example searchStr=textField.getText();
type: AnswerComment
comment on: http://stackoverflow.com/a/26118871
type: Comment

http://stackoverflow.com/a/26090622
has body: If objectA is truly public, then either is acceptable. It would be more common for objectA to be protected, and there not available to C
answers question: http://stackoverflow.com/q/26090567
score: 0
type: Answer

m2e
type: Tag
tags question: http://stackoverflow.com/q/26128770
tag name: m2e
tags question: http://stackoverflow.com/q/26057442

http://stackoverflow.com/a/26148081
score: 0
has comment: http://stackoverflow.com/comment/40989444
has comment: http://stackoverflow.com/comment/41017609
type: Answer
answers question: http://stackoverflow.com/q/26146057
has comment: http://stackoverflow.com/comment/40989196
has comment: http://stackoverflow.com/comment/40995652
has body: Your JFrame won't automagically resize itself unless you tell it to. Something like this: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { startPanel.setSize(new Dimension(1335, 675)); startPanel.setMaximumSize(new Dimension(1335, 675)); startPanel.setMinimumSize(new Dimension(1335, 675)); frame.setSize(1335, 675); jButton1.setVisible(false); } You could also use the pack() function of the JFrame class, depending on what you wanted to do.

http://stackoverflow.com/comment/40818066
has text: `*Scanner sc = new.Scanner(System.in);` should be `Scanner sc = new Scanner(System.in);`
comment on: http://stackoverflow.com/q/26055052
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40919184
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26110125
has text: We did not learn the DecimalFormat class, thus we cannot use it.

http://stackoverflow.com/a/26152810
type: Answer
answers question: http://stackoverflow.com/q/26151425
has comment: http://stackoverflow.com/comment/41025739
has body: First off, this problem will go away soon in that the Couchbase "2.0 SDKs" implement common flags between each other so this kind of problem doesn't come up. Michael's blogs are a good read if you want to see what's happening here. The reason for the problem in the first place is that in the 1.x series, Couchbase was trying to stay compatible with existing application code and memcached. In the memcached world, the clients were all written by different people at different times. Based on the exception, I believe you're probably trying to read an item stored by .NET. I have a sample transcoder you can use for this from a few weeks ago.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41024781
has comment: http://stackoverflow.com/comment/41024816
upvote count: 3
has comment: http://stackoverflow.com/comment/41030231

http://stackoverflow.com/q/26065805
has answer: http://stackoverflow.com/a/26066080
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26065821
has answer: http://stackoverflow.com/a/26066517
tagged with: java
has title: Java max digit (java.lang.NumberFormatException)
type: Question
score: 0
has body: I'm trying to write a block of code where I take in a number and find the greatest number within that number. (e.g. 12345 would be 5 and 791 would be 9). However, when I go to put in my scanner method in the main() I get an error java.lang.NumberFormatException and have no clue what to do. import java.util.Scanner; public class Step2 { private static int greatestnum = 0; private static int length = 0; private static int step = 0; public static void main(String[] args){ Scanner r = new Scanner(args[0]); String s = r.next(); int t = Integer.parseInt(s); System.out.println(maxDigit(t)); } public static int maxDigit(int num){ num = Math.abs(num); String stringint = String.valueOf(num); length = stringint.length(); String[] ary = stringint.split(""); while ( step &lt; length){ int currentnum = Integer.parseInt(ary[step]); if(currentnum &gt;= greatestnum){ greatestnum = currentnum; } step++; } return greatestnum; } } I really could use some help, I have to do the same thing recursively and don't know what I'm doing wrong.
answer count: 3

http://stackoverflow.com/comment/40869741
comment on: http://stackoverflow.com/q/26082968
has text: you must escape the $ \\$
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26036024
has comment: http://stackoverflow.com/comment/40785888
tagged with: image
possible better answer: http://stackoverflow.com/a/26040774
has title: Z ordering and superposition (JLabel and JEditorPane)
has answer: http://stackoverflow.com/a/26040774
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26055701
type: Question
answer count: 2
has body: I'm currently trying to display an image (with a Jlabel) onto a JEditorPane. I'm working with Swixml and a Form Layout, I have placed JLabel and JEditorPane at the same place. So I simply set "setVisible" to true or false to make the image appear. So far, everythings good. But when someone try to select the text in the JEditorPane, here the ugly thing : I try some things: Disable JEditorPane : No effect, even if the selection is'nt visible, the text appear on the JLabel. Repaint : When i repaint the JLabel, it's push to front again, but i have to do it repeateadly (like once every 50ms) to make it not visible; I also tried to repaint on selection, but it dont work well, some case are just ignored, or to slow and it still ugly Last idea was to prevent mouse to enter in JEditorPane when JLabel is displayer, but the MouseEnter event do not alow me to get the point out of EditorPane, so it became hard to put the cursor at a good place, out of JEditorPane... I tried setComponentZOrder, but i was not able to make it work well (I certainly misused it), but i dont think it can solve my problem, because it only change the painting order (the last to be paint is on the top with Java), but it's obviously a repainting problem. It should be usefull to point out that I'm forced to use Java 1.6 (conflict between to identicaly named class I have to use in Java 1.7 and 1.8, Sun's change log talks about a fix in 1.9 ...) The context is an Applet, and in case I would not be understandable (English is not my mother tongue), don't hesitate to correct me and ask me. Thanks for helping !
accepted answer: http://stackoverflow.com/a/26055701
tagged with: swixml
tagged with: jeditorpane
score: 0
tagged with: java
tagged with: swing

http://stackoverflow.com/q/26154117
type: Question
type: AnsweredQuestion
tagged with: reflection
has comment: http://stackoverflow.com/comment/40999751
has comment: http://stackoverflow.com/comment/40999757
has title: Java: Grabbing a class that isn't a part of your program
tagged with: java
accepted answer: http://stackoverflow.com/a/26154434
has body: So say I have two applications. The first application contains one file and displays the following code: public class Ball{ public static void main(String[] args){ System.out.println("You have found the ball"); } } The second application also contains one file: import java.lang.reflect.Method; public class Human{ private static Method[] methods = null; public static void main(String[] args){ try{ Class ball = Class.forName("sports.soccer.Ball"); // Error occurs here methods = ball.getDeclaredMethods(); for (int i = 0; i &lt; methods.length; i++) { methods[i].setAccessible(true); } //ball.main(); //This also doesn't work but I will read more on how to do this. } catch(Exception e){ e.printStackTrace(); } } } In the location where the Human.class is, there is a folder called sports, which contains a folder called soccer, which contains a copy of the Ball.class from the first application. Compiling the program works fine enough, however when i go to run it produced the following error: Exception in thread "main" java.lang.NoClassDefFoundError: sports/soccer/ball (w rong name: Ball) //The rest of the error at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 2) at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:367) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at Human.main(Human.java:8) Press any key to continue . . . F…
tagged with: class
answer count: 1
has comment: http://stackoverflow.com/comment/40999721
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40999815
has comment: http://stackoverflow.com/comment/40999714
has comment: http://stackoverflow.com/comment/40999632
has answer: http://stackoverflow.com/a/26154434
has comment: http://stackoverflow.com/comment/41000107
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26192304
accepted answer of: http://stackoverflow.com/q/26192263
answers question: http://stackoverflow.com/q/26192263
has comment: http://stackoverflow.com/comment/41070838
has comment: http://stackoverflow.com/comment/41070958
has comment: http://stackoverflow.com/comment/41070860
has body: You could use a boolean that starts with false like: private static boolean hasPressed = false; And then when calling the SaveOrder method you check for the boolean to be false and change it: if(!hasPressed) { SaveOrder(); hasPressed = true; } Then, after the execution of the method, you could change the boolean again so the user can call the method again. Be aware that the animation of click will still happen, so consider showing something like a Toast to the user to inform what's going on.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41071039
score: 0
type: Answer

http://stackoverflow.com/q/26045422
has body: I know this shouldn't be too difficult but my searching hasn't led to anything useful yet. All I want to do is make sure the user inputs a positive integer into a textField. I've tried: public class myInputVerifier extends InputVerifier { @Override public boolean verify(JComponent jc) { String text = ((jTextFieldMTU) jc).getText(); //Validate input here, like check int by try to parse it using Integer.parseInt(text), and return true or false throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } So in my main code I want to use this to display "OK" if successful and "Enter a positive number" if not successful. Can someone point me in the right direction please? Thanks!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40801258
has comment: http://stackoverflow.com/comment/40805311
upvote count: 1
has comment: http://stackoverflow.com/comment/40801321
type: Question
score: 1
tagged with: java
tagged with: verify
has comment: http://stackoverflow.com/comment/40801251
has title: How to verify textField input?
has comment: http://stackoverflow.com/comment/40801057
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26045568
favorite count: 0
has comment: http://stackoverflow.com/comment/40801435
has answer: http://stackoverflow.com/a/26045520
has comment: http://stackoverflow.com/comment/40801347
has comment: http://stackoverflow.com/comment/40800945
has answer: http://stackoverflow.com/a/26045565

http://stackoverflow.com/comment/40950933
has text: I'm running it with by right-clicking the project and hitting "run". Literally nothing happens. If I change the main method to include something like `System.out.print("Hello");` then it prints "Hello" and does nothing else.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26127403

http://stackoverflow.com/q/26088634
has body: If I have an if statement that includes a string like this: double GUInumber1 = ((GUInumber1 &gt;= 0 || &lt;= 0)? Double.parseDouble(GUIfirstNumber) : 0); ('GUIfirstNumber' is the string) Why does it come up as a error? Do I need brackets somewhere, do I need to use 'If/else' instead? Supposedly my compiler says it does not recognize or (||), is this supposed to be something else or does this work in a completely different way. Any help on this situation would be appreciated, also, if you need to know or are just wondering why I want to make a if statement for a string its because whenever I try to put in a letter instead of a number Java crashes, I'm hoping I could get this to alternatively solve the situation instead. EDIT: Solved, had to remove 'or' statements and alternatively make more else statements instead.
answer count: 1
score: -6
has comment: http://stackoverflow.com/comment/40880078
favorite count: 0
tagged with: parsing
tagged with: double
accepted answer: http://stackoverflow.com/a/26088655
type: AnsweredQuestion
upvote count: 0
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/26088655
type: Question
has title: Strings in ternary operators interacting with numbers
downvote count: 6
tagged with: string

http://stackoverflow.com/comment/41007089
type: AnswerComment
comment on: http://stackoverflow.com/a/26158193
type: Comment
has text: maybe, this line it the problem int width=c.getWidth();
score: 0

http://stackoverflow.com/q/26170054
has answer: http://stackoverflow.com/a/26170123
has comment: http://stackoverflow.com/comment/41029531
accepted answer: http://stackoverflow.com/a/26170123
answer count: 1
tagged with: swingutilities
tagged with: invokelater
has body: So I have seen countless different GUI tutorials, and all of them have said to use this code: public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } And although I may not quite understand what this exactly does, since I'm somewhat new to GUI, I do understand the basics of what it does... or so I thought. But then I, as an experiment, cut it all out, and just left: public static void main(String[] args) { createAndShowGUI(); } And it appeared to work. So now I have a question: what is the purpose of keeping the first piece of code I had, rather than just using the second, when it seemed like the second worked just as fine? If it is necessary, what will happen if I don't use it?
has comment: http://stackoverflow.com/comment/41031837
favorite count: 0
score: 2
tagged with: event-dispatch-thread
downvote count: 0
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41030735
has title: Is javax.swing.SwingUtilities.invokeLater nesessary?
has comment: http://stackoverflow.com/comment/41029540
type: Question
upvote count: 2

http://stackoverflow.com/comment/40913564
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26106899
type: Comment
has text: I know I don't want to read that wall of code. Provide public methods to call and you'll be able to do this easily.

excel
tags question: http://stackoverflow.com/q/26045663
tags question: http://stackoverflow.com/q/26137086
tag name: excel
tags question: http://stackoverflow.com/q/26036950
tags question: http://stackoverflow.com/q/26102247
tags question: http://stackoverflow.com/q/26040021
tags question: http://stackoverflow.com/q/26051856
tags question: http://stackoverflow.com/q/26148732
tags question: http://stackoverflow.com/q/26034994
tags question: http://stackoverflow.com/q/26035706
tags question: http://stackoverflow.com/q/26056485
type: Tag
tags question: http://stackoverflow.com/q/26133637
tags question: http://stackoverflow.com/q/26068627
tags question: http://stackoverflow.com/q/26137040

http://stackoverflow.com/q/26154172
tagged with: java
tagged with: servlets
type: Question
tagged with: jasper-reports
answer count: 2
has answer: http://stackoverflow.com/a/26167499
has title: JasperReports generated in a Servlet (GWT) does not appear
score: 0
has answer: http://stackoverflow.com/a/26174100
type: UnansweredQuestion
has body: I am developing an application in GWT, I am using the api to generate JasperReports reports, initially tried to make the generation via RPC, which returned to the client a string with the path of the pdf created, but that did not work, now I'm trying to generate report by a normal servlet, but the report is generated, nothing appears on the screen, and no error is found in the browser console. Details: dev mode works perfectly. on localhost: 8080 works perfectly. The error is when the application is published in an external Tomcat Here are my code Servlet: public class RelatorioPacienteServiceImpl extends HttpServlet { private static final long serialVersionUID = 1L; private ServletContext sc; public void init(ServletConfig config) throws ServletException { super.init(config); sc = config.getServletContext(); } @SuppressWarnings({ "unused", "unchecked", "rawtypes" }) @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String id = req.getParameter("id"); Map m = req.getParameterMap(); Paciente paciente = new Paciente(); File reportFile = null; String dir = sc.getRealPath(sc.getContextPath().replaceAll("\\\\", "/")); Map parameters = new LinkedHashMap(); String path = dir + "/../reports/";// tomcat path = path.replaceAll("\\\\", "/"); try { paciente = PacienteDAO.getPacientePorId(Integer.parseInt(id)); List<Paciente> list = new ArrayList<>(); list.add(paciente); HashMap parametros = new HashMap<String, Boolean>(); parametros.put("cpf", NumberMask.formatCpf(paciente.getCpf())); parametros.put("telefone1",NumberMask.formatPhone(paciente.getTelefone1())); parametros.put("telefone2",NumberMask.formatPhone(paciente.getTelefone2())); parametros.put("telefoneResponsavel",NumberMask.formatPhone(paciente.getTelefoneResponsavel())); parametros.put("dataNascimento",StringUtil.formatDate(paciente.getDataNascimento())); switch (paciente.getEtnia()) { case EtniaProps.BRANCA: parametros.put("etnia","Branco"); break;…
tagged with: gwt

http://stackoverflow.com/a/26168279
score: 1
has comment: http://stackoverflow.com/comment/41027592
has comment: http://stackoverflow.com/comment/41026840
has body: JSONArray is ordered and can contain collections as values, in other words other jsonArrays. Make the questions part a jsonArray and then put it inside the jsonObject like this: JSONArray questionsArray = new JSONArray(); JSONArray one = new JSONArray(); one.put("ELSYS") one.put("ELSYS2") one.put("ELSYS3") one.put("ELSYS4") JSONObject firstObject = new JSONObject() firstObject.put("question", "6*2")//(key, value) firstObject.put("answers", one) questionsArray.put(firstObject ) JSONArray two = new JSONArray(); two.put("1024") two.put("2048") two.put("512") two.put("64") JSONObject secondObject = new JSONObject() secondObject.put("question", "hello world?") secondObject.put("answers", two) questionsArray.put(secondObject) //do this for all your items then add the questions array to your jsonObject JSONObject mainJsonObj = new JSONObject() mainJsonObj.put("questions", questionsArray); //then when you need the data you will go like this: questionsArray = mainJsonObj.optJSONArray("questions") //then you have your ordered array containing your question/answer objects, the answers of which will be ordered. To get them you will have to get by index like: objOne = questionsArray.get(0) //etc String question = objOne.optString("question") JSONArray answers = objOne.optString("answers") Something along those lines, you could try making it a bit more elegant, this is only to demonstrate the basic idea. Alternatively you will have to look at a different data structure like linkedHashMap/arrayList EDIT Seeing that you need the keys as you require the string values you will have to use a combination of json objects and array. The important thing to remember is this JSONArray will maintain its order and JSONObject will not maintain its order (and there isnt much you can do about it). I will edit the above code for ease of readability. The way initially envisaged it in your question wont be possible to maintain its order, so this solution might not be exactly like you want it, but i…
accepted answer of: http://stackoverflow.com/q/26167301
answers question: http://stackoverflow.com/q/26167301
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41026560
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40992654
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26150035
score: 1
has text: Step through you code in a debugger, and watch the value of `temp`. Notice how as you loop through `sChar`, each time you find a `#` you reset `temp`? Notice how the last character in `sChar` is `#`, so `temp` is *always* `#` when the loop ends?

http://stackoverflow.com/comment/40824487
has text: Try an @XmlRootElement(namespace="test.com/doorway") annotation in your class PingRequest. But I don't really know if this will help. You should open a new question next time, it gives your problem more attention by the other users.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26037489
type: Comment

http://stackoverflow.com/a/26174244
answers question: http://stackoverflow.com/q/26166992
has comment: http://stackoverflow.com/comment/41117563
downvote count: 0
type: Answer
has body: There is another interface you can use: JobExplorer From its javadoc: Entry point for browsing executions of running or historical jobs and steps. Since the data may be re-hydrated from persistent storage, it may not contain volatile fields that would have been present when the execution was active
score: 2
upvote count: 2

opengl
tags question: http://stackoverflow.com/q/26066806
tags question: http://stackoverflow.com/q/26074992
tags question: http://stackoverflow.com/q/26086402
tags question: http://stackoverflow.com/q/26061705
tags question: http://stackoverflow.com/q/26134716
tags question: http://stackoverflow.com/q/26078582
type: Tag
tags question: http://stackoverflow.com/q/26182823
tags question: http://stackoverflow.com/q/26080726
tags question: http://stackoverflow.com/q/26148105
tag name: opengl

http://stackoverflow.com/a/26173881
type: Answer
has body: To count the number of words that starts with "cons", you can just discard all other words while emitting from mapper. public void map(Object key, Text value, Context context) throws IOException, InterruptedException { IntWritable one = new IntWritable(1); String[] words = value.toString().split(" "); for (String word : words) { if (word.startsWith("cons")) context.write(new Text("cons_count"), one); } } The reducer will now receive only one key = cons_count and you can sum up the values to get the count. To sort the words starting with "cons" in based on the frequency, the words starting with cons should go to same reducer and reducer should sum it up and sort it. To do that, public class MyMapper extends Mapper&lt;Object, Text, Text, Text&gt; { @Override public void map(Object key, Text value, Context output) throws IOException, InterruptedException { String[] words = value.toString().split(" "); for (String word : words) { if (word.startsWith("cons")) context.write(new Text("cons"), new Text(word)); } } } Reducer : public class MyReducer extends Reducer&lt;Text, Text, Text, IntWritable&gt; { @Override public void reduce(Text key, Iterable&lt;Text&gt; values, Context output) throws IOException, InterruptedException { Map&lt;String,Integer&gt; wordCountMap = new HashMap&lt;String,Integer&gt;(); for(Text value: values){ word = value.get(); if (wordCountMap.contains(word) { Integer count = wordCountMap.get(key); count++; wordCountMap.put(word,count) }else { wordCountMap.put(word,new Integer(1)); } } //use some sorting mechanism to sort the map based on values. // ... for (Map.Entry&lt;String, Integer&gt; entry : wordCountMap.entrySet()) { context.write(new Word(entry.getKey(),new IntWritable(entry.getValue()); } } }
has comment: http://stackoverflow.com/comment/41061555
answers question: http://stackoverflow.com/q/26170827
score: 0
has comment: http://stackoverflow.com/comment/41086817

http://stackoverflow.com/q/26097794
downvote count: 1
type: Question
tagged with: java
score: -1
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40897109
has comment: http://stackoverflow.com/comment/40896773
tagged with: tabview
favorite count: 0
has title: when i select the contacts tab the tab bar is vanished
tagged with: android
has answer: http://stackoverflow.com/a/26098073
tagged with: tabs
has body: i have four tabs in the tab bar when i select the contact tab from the tab bar the tab bar is disappeared.i want to show the tab bar when i select the contact tab. Here is code TabActivity.java public class Tab_Activity extends TabActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Resources obj_res = getResources(); TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost); TabSpec m_tab1 = tabHost.newTabSpec("First Tab"); TabSpec m_tab2 = tabHost.newTabSpec("Second Tab"); Intent intent1 = new Intent().setClass(this, Phone.class); Intent intent3 = new Intent().setClass(this, Settings.class); Intent intent4 = new Intent().setClass(this, Contact.class); m_tab4.setIndicator("Tab4"); m_tab4=tabHost.newTabSpec("tab4").setIndicator("", obj_res.getDrawable(R.drawable.pic1)).setContent(intent3); m_tab5.setIndicator("Tab4"); m_tab5=tabHost.newTabSpec("tab4").setIndicator("", obj_res.getDrawable(R.drawable.pic3)).setContent(intent4); tabHost.addTab(m_tab2); tabHost.addTab(m_tab4); tabHost.addTab(m_tab5); }} Contact.java public class Contact extends Activity { protected void onCreate(Bundle savedInstanceState) { //this.requestWindowFeature(Window.FEATURE_NO_TITLE); //this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); //setContentView(R.layout.contact); Intent Contacts = new Intent(Intent.ACTION_GET_CONTENT); Contacts.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Contacts.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); startActivityForResult(Contacts, 1); }}
type: UnansweredQuestion
tagged with: android-intent

http://stackoverflow.com/q/26061866
has title: HTTPClient doesn't send HttpPost request
downvote count: 1
type: Question
upvote count: 0
tagged with: httpclient
has answer: http://stackoverflow.com/a/26065889
has comment: http://stackoverflow.com/comment/40836347
answer count: 1
has body: I have acutally a problem with my Android HTTPClient. I want to send POST data to a website and parse the content after this. My problem is, that the POST data wasn't sent to the webserver. I don't know why. Here is my HTTP Util Class import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import android.os.AsyncTask; public class HTTPHelperUtil { private static HTTPHelperUtil instance; private String url; private List&lt;NameValuePair&gt; nameValuePairs; private String result; private HTTPHelperUtil() { // nothing to do } public synchronized static HTTPHelperUtil getInstance() { if (HTTPHelperUtil.instance == null) { HTTPHelperUtil.instance = new HTTPHelperUtil(); } return HTTPHelperUtil.instance; } public HTTPHelperUtil init(String url, List&lt;NameValuePair&gt; nameValuePairs) { this.url = url; this.nameValuePairs = nameValuePairs; return HTTPHelperUtil.instance; } public HTTPHelperUtil start() throws ClientProtocolException, IOException { SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask(); AsyncTask&lt;List&lt;NameValuePair&gt;, Void, String&gt; execute = sendPostReqAsyncTask.execute(nameValuePairs); return HTTPHelperUtil.instance; } class SendPostReqAsyncTask extends AsyncTask&lt;List&lt;NameValuePair&gt;, Void, String&gt; { @Override protected String doInBackground(List&lt;NameValuePair&gt;... params) { String res = ""; List&lt;NameValuePair&gt; postPairs = params[0]; System.out.println(postPairs.get(0)); System.out.println(postPairs.get(1)); if (postPairs != null &amp;&amp; !postPairs.isEmpty()) { // Create a new HttpClient an…
has comment: http://stackoverflow.com/comment/40832435
score: -1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40830940
has comment: http://stackoverflow.com/comment/40836393
tagged with: java

http://stackoverflow.com/q/26121105
has body: I'm writing software for the JVM (in Clojure) that performs a cryptographic operation. Specifically, given a secret input, secret key, non-secret salt, non-secret personalization, it uses BLAKE2 to derive 512 bits of key material. It then chops up that array into two 256 bit chunks, using tools from the Arrays class. (source) The actual implementation of that operation lives in libsodium so it's implemented in C. I'm using caesium to access it, which is a wrapper over kalium, a library that uses jnr-ffi to call the underlying C implementation. Since all of the buffers above have sensitive key material, I'd like to make sure it's purged from memory. I'm not sure how to do that safely on the JVM (heck, I'm not even sure I know how to do that safely in C). Given that the material is translated from C const char * to JVM byte[], and then some of my operations make new JVM byte arrays, key material is going to live in JVM byte arrays. That raises two concerns: If I zerofill a byte[], which is not touched by any code afterwards, how can I be sure the byte[] was actually zeroed out? I'd assume the JVM is free to optimize that away. Even if I was able to guarantee a byte[] gets zeroed out, how do I know the JVM hasn't decided to copy that array (e.g. in the context of a garbage collector) plenty of times without zeroing out the original location, hence leaving the keying material all over virtual memory anyway? I'm guessing the answer will end up being "do it in C &amp; ASM" or maybe even "do it in a HSM", but I'd love to hear if there are JVM-land ways of fixing this problem.
favorite count: 0
has comment: http://stackoverflow.com/comment/40938567
type: UnansweredQuestion
has title: How do I securely handle and zero key material buffers on the JVM?
upvote count: 7
has comment: http://stackoverflow.com/comment/40992835
linked to: http://stackoverflow.com/q/6473352
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/40992687
has answer: http://stackoverflow.com/a/27636188
has comment: http://stackoverflow.com/comment/41603778
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41358179
tagged with: security
has comment: http://stackoverflow.com/comment/41004099
has comment: http://stackoverflow.com/comment/40938461
has comment: http://stackoverflow.com/comment/41004158
tagged with: cryptography
tagged with: clojure
tagged with: jvm

http://stackoverflow.com/comment/41044903
type: AnswerComment
comment on: http://stackoverflow.com/a/26178226
type: Comment
has text: @ CocoNess it didnot made any changes..still the first rs loop is getting executed
score: 0

http://stackoverflow.com/q/26094885
tagged with: jdbc
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Issue with getBinaryStream(index)
has answer: http://stackoverflow.com/a/26095947
tagged with: java
has answer: http://stackoverflow.com/a/26095019
has answer: http://stackoverflow.com/a/26095687
type: Question
answer count: 3
has body: I am getting null value when I am reading the blob data from database. What might be the issue? Can some one help me on this? Connection con = null; PreparedStatement psStmt = null; ResultSet rs = null; try { try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } con = DriverManager.getConnection("jdbc:oracle:thin:@MyDatabase:1535:XE","password","password"); System.out.println("connection established"+con); psStmt = con .prepareStatement("Select Photo from Person where Firstname=?"); int i = 1; psStmt.setLong(1, "Nani"); rs = null; rs = psStmt.executeQuery(); InputStream inputStream = null; while (rs.next()) { inputStream = rs.getBinaryStream(1); //Blob blob = rs.getBlob(1); //Blob blob1 = (Blob)rs.getObject(1); //System.out.println("blob length "+blob1);//rs.getString(1); } System.out.println("bytessssssss "+inputStream);//here i am getting null value. } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
downvote count: 0
favorite count: 0
tagged with: oracle-database

http://stackoverflow.com/q/26145693
type: Question
has body: I wrote a utility program to do encryption and decryption using AES algorithm. Regular program works fine but when I run test with same method I am getting Cipher initialization error on doFinal method. I did some research and some suggest to put init and doFinal in a synchronized block. I did that and still getting same exception. I also updated US_export_policy.jar and local_policy.jar in jre7/lib/security folder as suggested by some forum. Still getting same issue. What could be wrong in the code? import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; import org.apache.log4j.Logger; public class CipherUtil { private static Logger log = Logger.getLogger(CipherUtil.class); private static final String SECRET_KEY = "000102030405060708090A0B0C0D0E0F"; private Cipher cipher; private SecretKeySpec secretKeySpec; private static CipherUtil cipherUtil; private CipherUtil() { try { cipher = Cipher.getInstance("AES"); } catch (NoSuchAlgorithmException | NoSuchPaddingException ex) { log.error(ex); } byte[] key = null; try { key = Hex.decodeHex(SECRET_KEY.toCharArray()); } catch (DecoderException ex) { log.error(ex); } secretKeySpec = new SecretKeySpec(key, "AES"); } public static synchronized CipherUtil getCipherUtilObject() { if (cipherUtil == null) { cipherUtil = new CipherUtil(); } return cipherUtil; } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public String encrypt(String plainText) { if (plainText == null) return null; String encryptedText = null; byte[] encrypted = null; synchronized (cipher) { try { c…
has comment: http://stackoverflow.com/comment/40985988
has title: Cipher initialization error when running test
answer count: 1
has comment: http://stackoverflow.com/comment/40985585
downvote count: 0
has comment: http://stackoverflow.com/comment/41048062
has answer: http://stackoverflow.com/a/26148563
favorite count: 0
upvote count: 2
tagged with: encryption
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26148563
linked to: http://stackoverflow.com/q/43523840

http://stackoverflow.com/a/26048031
upvote count: 1
answers question: http://stackoverflow.com/q/26047929
score: 1
downvote count: 0
has body: You are doing switch over String but the case TestEnumClass.TEST1.getEnumConstant() is not compile time constant according to JLS. A case statement requires compile time constant value. In order to correct the error you can do like this String str = args[0]; TestEnumClass e = TestEnumClass.valueOf(str); switch(e){ case TEST1: System.out.println("test1"); break; case TEST2 : System.out.println("test2"); break; }
type: Answer

http://stackoverflow.com/comment/40809465
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26049723
has text: @Heather Oh that's strange... Is there anything else missing then?

naming
tags question: http://stackoverflow.com/q/26081527
tags question: http://stackoverflow.com/q/26101814
tag name: naming
type: Tag

http://stackoverflow.com/q/26137527
has title: Eclipse 4.4 apparently using stuff from 3.8
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has body: when I start eclipse 4.4 (Ubuntu 14.04) I get an error that is stored in a dir: org.eclipse.platform_3.8_155965261_linux_gtk_x86_64 which indicates that it is still running stuff from version 3.8. What am I doing wrong? the log file contains: !SESSION 2014-10-01 09:48:11.227 ----------------------------------------------- eclipse.buildId=4.4.0.I20140606-1215 java.version=1.7.0_65 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86_64 !ENTRY org.eclipse.osgi 2 0 2014-10-01 09:48:12.176 !MESSAGE One or more bundles are not resolved because the following root constraints are not resolved: !SUBENTRY 1 org.eclipse.osgi 2 0 2014-10-01 09:48:12.176 !MESSAGE Bundle reference:file:plugins/org.eclipse.pde.ua.core_1.0.100.v20110516.jar was not resolved. !SUBENTRY 2 org.eclipse.pde.ua.core 2 0 2014-10-01 09:48:12.176 !MESSAGE Missing required bundle org.eclipse.pde.core_[3.3.0,4.0.0). !ENTRY org.eclipse.osgi 2 0 2014-10-01 09:48:12.177 !MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists: !SUBENTRY 1 org.eclipse.osgi 2 0 2014-10-01 09:48:12.177 !MESSAGE Bundle org.eclipse.pde.ua.core_1.0.100.v20110516 [804] was not resolved. !SUBENTRY 2 org.eclipse.pde.ua.core 2 0 2014-10-01 09:48:12.177 !MESSAGE Missing required bundle org.eclipse.pde.core_[3.3.0,4.0.0). !ENTRY org.eclipse.osgi 4 0 2014-10-01 09:48:12.178 !MESSAGE Application error !STACK 1 java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.ui.internal.WorkbenchPlugin.getSplashShell(WorkbenchPlugin.java:1326) at org.eclipse.ui.internal.ide.application.IDEApplication.sta…
has answer: http://stackoverflow.com/a/26137798
type: Question

http://stackoverflow.com/comment/40950682
has text: Even checking the edit history on this, I don't see any background threads being used. `wait()` and `notify()` are for threading. How are the threads started and synchronized?
comment on: http://stackoverflow.com/q/26125155
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26154374
answers question: http://stackoverflow.com/q/26154316
upvote count: 2
has comment: http://stackoverflow.com/comment/99025312
type: Answer
has body: You are trying to find the JRE in a wrong Library directory as Library directory maybe present in more than one place. Just copy paste the jre path in 'jre home' input as /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents/Home/jre/ EDIT: To find where is your java installed on Mac, run the following command: echo $(/usr/libexec/java_home) it should return something like this: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home append jre to the end of this path to build JRE home path: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre
score: 2
has comment: http://stackoverflow.com/comment/41000303
downvote count: 0

http://stackoverflow.com/comment/40991828
has text: Where is this code? If it's inside a method, then you have a nested method which is invalid. If it's not inside a method then it needs to be because you cannot execute code outside of a block. I see no situation under which this code would be valid. There is also no `catch`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26149824

http://stackoverflow.com/a/26148034
has comment: http://stackoverflow.com/comment/40990317
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40988678
answers question: http://stackoverflow.com/q/26148003
score: 2
has comment: http://stackoverflow.com/comment/40990216
has comment: http://stackoverflow.com/comment/40990097
has body: If I have class like this, which is essentially just a package object, is it breaking standards to have it follow the package naming conventions? Yes. It's not a package, it's a class, so it should follow class naming conventions... or better yet, just make it a package instead, given that it sounds like you want it to act like a package. That's if you really and truly think it's a good idea to have a clustering like this for exceptions, rather than putting them in the package where they're most relevant - the latter is what I'd do, personally.
downvote count: 0
has comment: http://stackoverflow.com/comment/40988453

http://stackoverflow.com/q/26108931
score: 0
answer count: 3
tagged with: maven
has answer: http://stackoverflow.com/a/26170503
tagged with: jndi
tagged with: java
tagged with: jboss
has body: I am trying to lookup an EJB 3 under Jboss EAP6. I have a maven EJB project witch named service-All where i have tow packages (interface and Impl) and i have a other java project witch named ClientEJB. This is an example of an interface and it's implementation: @Remote public IClient{ void showClient(String name); } The Implementation: @Statless @Remote(IClient.Class) public ClientImpl(){ public void showClient(String name){ System.out.println("I'am Mr or Mme"+name); } About the java prject, this is the main class: public MyClass{ private IClient client; public static void main(String args[]){ InvockClient().showClient("ClientTest"); } public static IClient InvockClient(){ final Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); jndiProperties.put("jboss.naming.client.ejb.context", true); Context context; IClient client= null; try { context = new InitialContext(jndiProperties); client=(IUpdateCleRepartition) context.lookup("ejb:service-All/service-All /"+Client.class.getSimpleName()+"!" + IClient.class.getName()); context.close(); } catch (NamingException e) { System.out.println(e.getMessage()); } return client; } } This is jboss-ejb-client.properties the witch i have it in the src\main\resources # JBoss, Home of Professional Open Source # Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual # contributors by the @authors tag. See the copyright.txt in the # distribution for a full listing of individual contributors. # 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 languag…
has title: Can't lookup an EJB remote via JNDI under JBoss EAP6
accepted answer: http://stackoverflow.com/a/26170503
has answer: http://stackoverflow.com/a/28489897
has answer: http://stackoverflow.com/a/26170635
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26170635
tagged with: ejb-3.0
type: Question

http://stackoverflow.com/comment/41000808
type: AnswerComment
score: 0
type: Comment
has text: If a method is `static`, it is not "inherited" and you *can* invoke specific implementations using `ClassName.someStaticMethod()` without having an instance.
comment on: http://stackoverflow.com/a/26154748

socketserver
tags question: http://stackoverflow.com/q/26190959
tag name: socketserver
type: Tag

http://stackoverflow.com/comment/67199862
comment on: http://stackoverflow.com/a/26119193
type: AnswerComment
type: Comment
has text: This first one here is quite common: http://www.fileformat.info/tip/java/simpledateformat.htm I would go with that :)
score: 1

http://stackoverflow.com/a/26070765
accepted answer of: http://stackoverflow.com/q/26070503
has comment: http://stackoverflow.com/comment/40847853
answers question: http://stackoverflow.com/q/26070503
upvote count: 5
downvote count: 1
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/40847777
has comment: http://stackoverflow.com/comment/40848001
type: Answer
has body: You can use TimeUnit class defined in java.util.concurrent package. for eg you want to calculate hours: long hours=TimeUnit.SECONDS.toHours(seconds); similar methods are available for calulating days, hours, minutes. but mind you this will give you direct conversion to hours, so you will end up having more than 24 hours. For a proper implementation you need to first calculate the days, the do the necessary maths and the give the remaining value for calculating hours. Lastly write a string as per your required format.

http://stackoverflow.com/comment/41047170
type: Comment
has text: Definitely worth looking at this: http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value
comment on: http://stackoverflow.com/a/26179090
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40863623
comment on: http://stackoverflow.com/q/26079473
score: 0
type: Comment
type: QuestionComment
has text: No. I know how to determine the OS. What I need to know is how to specify which JAR to load.

http://stackoverflow.com/comment/40783558
has text: @MadProgrammer, you are correct with respect to checking before its renderered. it also fixed the divider not painting problem. i have to ask, is there anything you dont know?
comment on: http://stackoverflow.com/q/26035204
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40887926
comment on: http://stackoverflow.com/q/26081186
has text: Do you want to find the row only (rowkey), or all data in that row, or particular column in a row that has that particular information?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40877923
comment on: http://stackoverflow.com/a/26086934
type: Comment
type: AnswerComment
has text: I was use that. see my seconds format code. but when I remove the System.out.print() I meet those problem.
score: 0

http://stackoverflow.com/comment/41414325
score: 0
has text: how do I delete a view from my viewpager if an arraylist of items?
type: Comment
comment on: http://stackoverflow.com/a/26324353
type: AnswerComment

http://stackoverflow.com/a/26134457
answers question: http://stackoverflow.com/q/26134420
has comment: http://stackoverflow.com/comment/40963343
has comment: http://stackoverflow.com/comment/40963993
has comment: http://stackoverflow.com/comment/40963858
has comment: http://stackoverflow.com/comment/40963916
has comment: http://stackoverflow.com/comment/40963880
has body: final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); Decodes input using default encoding potentially corrupting data. out.write(packet); Encodes characters using default encoding potentially corrupting data. Read documentation on API you use. Only perform conversion with default or unknown encoding when you absolutely need it. Read/convert an InputStream to a String
has comment: http://stackoverflow.com/comment/40963942
score: 0
type: Answer

http://stackoverflow.com/a/26069474
answers question: http://stackoverflow.com/q/26069465
upvote count: 7
type: Answer
downvote count: 0
has body: Your length variable is declared and initialized in each case of if and else and then immediately discarded as out of scope when the block ends. Declare it before the if and initialize it in each case, so it remains in scope for the for loop further down. int length; if(first.length()&gt;second.length()){ length = first.length(); }else{ length = second.length(); }
score: 7

http://stackoverflow.com/a/26142918
upvote count: 4
has comment: http://stackoverflow.com/comment/50673791
type: Answer
downvote count: 3
has body: I actually took this approach after carefully looking at the suggested answers: doAnswer(new Answer&lt;String&gt;() { public String answer(InvocationOnMock invocation) throws Throwable { String originalParam = (String) invocation.getArguments()[0]; return StringUtils.equalsIgnoreCase(originalParam, "a") ? "Something" : "Something Else"; } }).when(classA).getString(anyString()); This allows me to handle more than just two cases by adjusting the return base on the params.
score: 1
answers question: http://stackoverflow.com/q/26067096

http://stackoverflow.com/comment/123412802
type: Comment
has text: Yep, that directly answers the question, and of course JLS is the most authoritative source of all. Apologies for missing your answer when it was posted.
type: AnswerComment
comment on: http://stackoverflow.com/a/67656111
score: 0

http://stackoverflow.com/comment/41005984
comment on: http://stackoverflow.com/a/26157305
type: Comment
score: 0
type: AnswerComment
has text: Since when can you execute code snippets on stackoverflow? That's a nice feature. Thank you for that. +1 therefore

http://stackoverflow.com/comment/41037547
type: AnswerComment
type: Comment
has text: It was the syntax error meaning it was not registering the primary key. Now I have corrected it and made a new version of the table, if I try to duplicate the primary key it gives the error [SQLITE_CONSTRAINT] Abort due to constraint violation (UNIQUE constraint failed: CARS4.REGISTRATION)
score: 1
comment on: http://stackoverflow.com/a/26174322

http://stackoverflow.com/comment/40803192
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26046557
has text: It doesn't cut it. Its like one table shared with two entities in parts. For ex, Customer and Address fields are in same table, but with different entities, if I got it right. Can you show an example if this is the solution?
type: AnswerComment

http://stackoverflow.com/a/28000846
has comment: http://stackoverflow.com/comment/73165869
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/73114437
upvote count: 2
has comment: http://stackoverflow.com/comment/73165986
answers question: http://stackoverflow.com/q/26143047
has body: i show the informations in a listview below the calendar. like this. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_layout_location_site_calendar); this.ctx = this; this.extendedCalendarView = (ExtendedCalendarView) findViewById(R.id.extendedCalendarView_addLocationSiteCalendar_CALENDAR); this.listViewCalendar = (ListView) findViewById(R.id.listView_addLocationSiteCalendar_CALENDARLIST); //Disable Scrolling this.listViewCalendar.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); this.extendedCalendarView.setGesture(ExtendedCalendarView.LEFT_RIGHT_GESTURE); addEvent();//test addEvent2();//test initExtras(savedInstanceState); initListener(); } private void initListener() { extendedCalendarView.setOnDayClickListener(new ExtendedCalendarView.OnDayClickListener() { @Override public void onDayClicked(AdapterView&lt;?&gt; adapter, View view, int position, long id, Day day) { ArrayList&lt;HashMap&lt;Integer, String&gt;&gt; eventList = new ArrayList&lt;HashMap&lt;Integer, String&gt;&gt;(); for (Event e : day.getEvents()) { HashMap&lt;Integer, String&gt; event = new HashMap&lt;Integer, String&gt;(); event.put(NumericValues.LISTROW_ID_IMG_T_ST_IDC_KEY_TITLE, e.getTitle()); event.put(NumericValues.LISTROW_ID_IMG_T_ST_IDC_KEY_SUBTITLE, e.getDescription()); event.put(NumericValues.LISTROW_ID_IMG_T_ST_IDC_KEY_INDICATOR, e.getStartDate("hh:mm") + " - " + e.getEndDate("hh:mm")); eventList.add(event); } CalendarListViewAdapter listAdapter = new CalendarListViewAdapter(_this, eventList); listViewCalendar.setAdapter(listAdapter); ListViewUtil.setListViewHeightBasedOnChildren(listViewCalendar); } }); } &lt;ScrollView android:layout_width="fill_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;com.tyczj.extendedcale…

http://stackoverflow.com/comment/40787235
comment on: http://stackoverflow.com/a/26037958
score: 0
type: Comment
has text: Please show your code. Are you sure you are passing correct value, and not a null variable? @zanzoken
type: AnswerComment

http://stackoverflow.com/q/26102789
tagged with: resteasy
tagged with: utf-8
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40926614
upvote count: 1
has body: I'm working with Jboss EAP 6.2 with RestEasy library (resteasy-jaxrs 2.2.1.GA) in Linux enviroment The body of each client service's response does not use the UTF-8 encoding. The following a client's code example: ClientRequest request = new ClientRequest(properties.getProperty("sgprof.service.url")); request.accept("application/json;charset=UTF-8"); request.queryParameter("key", "value"); ClientResponse&lt;String&gt; response = request.post(String.class); String jsonResponse = response.getEntity(); I have setted the UTF-8 encoding in `standalone.sh' of JBoss passing them to JVM. Below the arguments passed to JVM, can you help me please. Thanks. awt.toolkit = sun.awt.X11.XToolkit file.encoding = UTF-8 file.encoding.pkg = sun.io file.io.encoding = UTF-8 file.separator = / http.nonProxyHosts = 10.*|*.local|localhost|127.*|idpc* http.proxyPort = 8080 java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment java.awt.headless = true java.class.path = /home/jboss/jboss-eap-6.2/jboss-modules.jar java.class.version = 51.0 java.endorsed.dirs = /usr/java/jdk1.7.0_51/jre/lib/endorsed java.ext.dirs = /usr/java/jdk1.7.0_51/jre/lib/ext:/usr/java/packages/lib/ext java.home = /usr/java/jdk1.7.0_51/jre java.io.tmpdir = /tmp java.library.path = /usr/java/default:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib java.net.preferIPv4Stack = true java.runtime.name = Java(TM) SE Runtime Environment java.runtime.version = 1.7.0_51-b13 java.specification.name = Java Platform API Specification java.specification.vendor = Oracle Corporation java.specification.version = 1.7 java.util.logging.manager = org.jboss.logmanager.LogManager java.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ java.version = 1.7.0_51 java.vm.info = mixed mode java.vm.name = Java HotSpot(TM) 64-Bit Server VM java.vm.specification.name = Java Virtual Machine Specification java.vm.specification.vendor = Oracle Corporation java.vm.speci…
score: 1
tagged with: java
has title: Jboss RestEasy doesn't use the UTF-8 encoding
has answer: http://stackoverflow.com/a/26104201
has answer: http://stackoverflow.com/a/32889005
tagged with: character-encoding
tagged with: jboss
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/26073976
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26074866
downvote count: 0
has title: Create a text file in FTP server (Commons-net)
favorite count: 0
type: Question
tagged with: text-files
has answer: http://stackoverflow.com/a/64515532
tagged with: ftp
upvote count: 2
has body: I need help with Java Networking programming. I trying to create a new text file to FTP server. I found this code example in internet, but it's only creates a directory. How to change it to text file format? Here's the code: public class FTPCreateDirDemo { private static void showServerReply(FTPClient ftpClient) { String[] replies = ftpClient.getReplyStrings(); if (replies != null &amp;&amp; replies.length &gt; 0) { for (String aReply : replies) { System.out.println("SERVER: " + aReply); } } } public static void main(String[] args) { String server = "www.yourserver.com"; int port = 21; String user = "username"; String pass = "password"; FTPClient ftpClient = new FTPClient(); try { ftpClient.connect(server, port); showServerReply(ftpClient); int replyCode = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(replyCode)) { System.out.println("Operation failed. Server reply code: " + replyCode); return; } boolean success = ftpClient.login(user, pass); showServerReply(ftpClient); if (!success) { System.out.println("Could not login to the server"); return; } // Creates a directory String dirToCreate = "/upload123"; success = ftpClient.makeDirectory(dirToCreate); showServerReply(ftpClient); if (success) { System.out.println("Successfully created directory: " + dirToCreate); } else { System.out.println("Failed to create directory. See server's reply."); } // logs out ftpClient.logout(); ftpClient.disconnect(); } catch (IOException ex) { System.out.println("Oops! Something wrong happened"); ex.printStackTrace(); } } Sorry for my bad English.
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26074866
possible better answer: http://stackoverflow.com/a/64515532

http://stackoverflow.com/comment/40868181
score: 0
type: Comment
type: QuestionComment
has text: I'll ask google this is going nowhere. I've tried the break statement and it failed miserably. Thanks I suppose
comment on: http://stackoverflow.com/q/26081995

http://stackoverflow.com/comment/41023660
comment on: http://stackoverflow.com/q/26166761
score: 2
type: Comment
type: QuestionComment
has text: Why would you do that in the first place?

http://stackoverflow.com/a/26163913
upvote count: 1
answers question: http://stackoverflow.com/q/26163183
score: 1
downvote count: 0
type: Answer
has body: Thankyou for all the help. I was using JCreator IDE and it was causing the problem. Running the program directly on cmd caused no problem. The program caused no errors while running on other IDEs as well. Thankyou.

http://stackoverflow.com/comment/40842336
has text: @user3174553 Updated my answer, but it's a bit guessing as the xpath is correct, only a selenium issue now as getElement would only accept an element (the span), but not the text. "Guessing" as I don't know yet if "getText" works in combination with "By.xpath" or e.g. if you should first get the element and then get the text.
comment on: http://stackoverflow.com/a/26067688
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40938786
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26121246
has text: Are you sure about `newArray[i] = a[delValPos+=1];`?

http://stackoverflow.com/comment/40882847
type: AnswerComment
comment on: http://stackoverflow.com/a/26088853
type: Comment
has text: @Plrr Do you mean that a program consists of multiple independent algorithms with differing worst case complexities? If that's the case, then the worst one is the one you pick. E.g. for `O(n^2), O(1), O(n)`, the overall worst case is `O(n^2)` because in the worst case, there is a quadratic growth.
score: 0

http://stackoverflow.com/q/26101839
upvote count: 4
has comment: http://stackoverflow.com/comment/40909740
has comment: http://stackoverflow.com/comment/40906326
favorite count: 0
has comment: http://stackoverflow.com/comment/40906983
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40906466
has body: I have this method in my DAO class: public List&lt;Protocolo&gt; buscarProtocolos(int situacao){ List&lt;Protocolo&gt; protocolos = null; protocolosPorSitucao = null; String sql = "select * from hibernatedb.protocolo where situacao_id = ?"; em = HibernateManager.getEntityManager(); protocolosPorSitucao = em.createNativeQuery(sql, Protocolo.class); protocolosPorSitucao.setParameter(1, situacao); em.getTransaction().begin(); logger.info("Buscando protocolos por situacao : "+ situacao); protocolos = (List&lt;Protocolo&gt;) protocolosPorSitucao.getResultList(); logger.info("Protocolos encontrados: "+protocolos.size()); em.getTransaction().commit(); em.close(); return protocolos; } This query select * from hibernatedb.protocolo where situacao_id = 1 returns one row when executed in pgAdmin3, but hibernate returns 0 rows. Here's the log generated from hibernate: Hibernate: select * from hibernatedb.protocolo where situacao_id = ? 0 It means that hibernate returned 0 results, cause my list is empty. Where's the error in this code? P.S.: when creating NativeQueries i need to set the database too. That's because a NativeQuery ignores the configs established on the persistence.xml?
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/40906591
downvote count: 0
has title: Hibernate native query creation returns empty result
score: 4

http://stackoverflow.com/comment/41017579
comment on: http://stackoverflow.com/a/26163538
type: AnswerComment
has text: And, if it doesn't exist?
type: Comment
score: 0

http://stackoverflow.com/comment/40993149
type: QuestionComment
has text: In the package com.program.my in a class file called Main? I'm not sure what you're asking.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26149934

http://stackoverflow.com/q/26034506
tagged with: java
has comment: http://stackoverflow.com/comment/40783803
type: Question
tagged with: dom
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40781311
has body: Using this method to save dom as xml, you apparently can't modify the file again in any editor (Notepad++ etc) because it keeps telling you that "This file is opened by another process" TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); DOMSource source = new DOMSource(_doc); StreamResult result = new StreamResult(_docPath); transformer.transform(source, result); Is there any solution or work around? (I'm developing in Netbeans on Windows 8) !SOLUTION! Changing file location helps, if your Win account doesn't have sufficient permisions to write/edit file at current location. Sadly editor only responded as "File is being used by another process", rather then "Insuffiecient permisions" or w/e
has title: Java saving dom to file -> file is opened by another process after program ends
has answer: http://stackoverflow.com/a/26034927
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/41002072
comment on: http://stackoverflow.com/q/26148152
type: QuestionComment
has text: @DavidWallace business validation can be anything like calling third party web-service to check if that records need to be handled. So that can not be done in join. This is just example. So I generalized it is "business validation"
score: 0
type: Comment

http://stackoverflow.com/a/26119886
upvote count: 1
type: Answer
downvote count: 0
has body: Below regex would ensures that there is a newline character present in between the A's. (?:(A)(?:(?=.*?\n)(?=.*?.).){6}){1,}(?=(A)) DEMO
answers question: http://stackoverflow.com/q/26118838
score: 1
has comment: http://stackoverflow.com/comment/40941184

http://stackoverflow.com/q/26186767
has body: Running Java 1.8 JavaSE-1.8 (jdk1.8.0_20) This class: public class SimpleQuestion { public static void main(String[] args) { DoNothing(); DoNothing2(); DoNothing3(); DoNothing4(); } public interface Interface1 { public void go(); } public interface Interface2&lt;X&gt; { public X go2(); } private static &lt;X, T extends Interface2&lt;X&gt; &amp; Interface1&gt; void DoNothing() { return; } private static &lt;X, T extends Interface2 &amp; Interface1&gt; void DoNothing2() { return; } private static &lt;X, T extends Interface2&lt;X&gt;&gt; void DoNothing3() { return; } private static &lt;T extends Interface2&lt;T&gt; &amp; Interface1&gt; void DoNothing4() { return; } } gives the compile error: The method DoNothing() in the type SimpleQuestion is not applicable for the arguments () Why that one and not DoNothing2,3, and 4?
score: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41060804
has comment: http://stackoverflow.com/comment/41061151
downvote count: 1
tagged with: java-8
has title: Generics function call not compiling in java 8 extending multiple interfaces
has answer: http://stackoverflow.com/a/26219523
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/41060814
has comment: http://stackoverflow.com/comment/41061036
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41105774
has comment: http://stackoverflow.com/comment/41169124
answer count: 1
tagged with: multiple-inheritance
tagged with: generics
has comment: http://stackoverflow.com/comment/41060843
favorite count: 0

http://stackoverflow.com/a/26150120
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/40993879
type: AcceptedAnswer
has body: Try this, ps aux | grep [s]ome.jar | wc -l i just tested it myself and should do the trick :-)
accepted answer of: http://stackoverflow.com/q/26149989
answers question: http://stackoverflow.com/q/26149989
type: Answer
score: 2

http://stackoverflow.com/q/26104666
has title: how to debug java web application in eclips with weblogic server
type: UnansweredQuestion
tagged with: java
upvote count: 7
tagged with: weblogic
score: 7
has answer: http://stackoverflow.com/a/26105141
linked to: http://stackoverflow.com/q/18875252
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/3882203
answer count: 2
downvote count: 0
favorite count: 0
has body: I have java application with Eclipse IDE and WebLogic 11g server. Is it possible to debug application remotely? if yes how?
has answer: http://stackoverflow.com/a/26104879

http://stackoverflow.com/comment/40955017
type: AnswerComment
score: 0
type: Comment
has text: @Rick exactly, although it could be if(dice == 6)
comment on: http://stackoverflow.com/a/26128854

http://stackoverflow.com/q/26085234
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26119010
has comment: http://stackoverflow.com/comment/40873884
score: 0
has comment: http://stackoverflow.com/comment/40874325
answer count: 1
has title: Java: run a method periodcally using timer
tagged with: timer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40877605
has body: I've a Java project which is main create an instance of a class (ThreadClient) that extends Thread. I would need that ThreadClient.run starts 2 timers to run periodically 2 methods of the ThreadClient class. The examples I found in internet just show that the timer can start the run method of an instance of a classe that exteds the Thread class. I woundln't need to create a new class, just to run 2 methods of the same class that creates the timers. Something like C# does: public class ThreadClient { private Timer _timer; public ThreadClient() { Start(); } private void Start() { _timer = new Timer(3000); // Set up the timer for 3 seconds _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed); _timer.Enabled = true; // Enable it } private void _timer_Elapsed(object sender, ElapsedEventArgs e) { // do something } } Method _timer_Elapsed belongs to the class that creates the timer. Thanks in advance, Samuel
has comment: http://stackoverflow.com/comment/40874222

http://stackoverflow.com/a/26155998
type: Answer
answers question: http://stackoverflow.com/q/26122332
accepted answer of: http://stackoverflow.com/q/26122332
has body: I found solution. For this purpose I used ObjectMapper. And I want to skip when my objet contains unknown properties as _id. Here is code snippet: @SuppressWarnings("unchecked") public MODEL read(ID id) { Field keyField2 = getKeyField(model); BasicDBObject query = createQuery(keyField2.getName(), id.toString()); DBCursor cursor = dbCollection.find(query); if (!cursor.hasNext()) { throw new RuntimeException(String.format("This id %s isn't presented at collection %s", id.toString(), dbCollection.getFullName())); } String json = cursor.next().toString(); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); MODEL value = null; try { value = mapper.readValue(json, model); } catch (IOException e) { e.printStackTrace(); } return value; }
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40866322
type: Comment
type: QuestionComment
score: 2
has text: See [Is it ok to compare immutable objects in Java using == instead of equals](http://stackoverflow.com/questions/10970823/is-it-ok-to-compare-immutable-objects-in-java-using-instead-of-equals)
comment on: http://stackoverflow.com/q/26081037

notifications
tags question: http://stackoverflow.com/q/26140829
tags question: http://stackoverflow.com/q/26153475
tags question: http://stackoverflow.com/q/26038326
tags question: http://stackoverflow.com/q/26087679
tags question: http://stackoverflow.com/q/26166103
tags question: http://stackoverflow.com/q/26133736
tag name: notifications
tags question: http://stackoverflow.com/q/26143218
type: Tag
tags question: http://stackoverflow.com/q/26157594
tags question: http://stackoverflow.com/q/26139380

http://stackoverflow.com/q/26114452
has comment: http://stackoverflow.com/comment/40927015
has body: How to view Heap and non-heap memory usage telemetry of java? I need to view the graphical chart. Kindly guide me
type: AnsweredQuestion
has title: How to view Heap and non-heap memory usage telemetry of java
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26216233
downvote count: 1
type: Question
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26216233
tagged with: heap-memory
upvote count: 2

http://stackoverflow.com/q/26178442
linked to: http://stackoverflow.com/q/7104364
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26204055
tagged with: nexus
type: UnansweredQuestion
tagged with: maven
has body: 1.) I have a Project1 with this ivy dependency : default" /> This project brings serializer.jar (just only this jar, OK! ) 2.) In a second one Project (Proyect2) i put the next dependency : default;compile->compile;runtime->runtime" transitive="true"> This "Project 2" brings : Project 1 Serializer.jar xml-apis.jar Despite of putting transite to false in xalan dependency. I haven't this behaviour in my Eclipse + IVEDe environment, just only with Nexus and Maven.... It seems to be wrong because on Project1 i set xalan transitive to false.
has title: Nexus Ivy Maven : Second Level Dependencies Ignores Transitive
tagged with: java
tagged with: ivy

http://stackoverflow.com/q/26064109
answer count: 2
has answer: http://stackoverflow.com/a/26065430
has comment: http://stackoverflow.com/comment/40836432
favorite count: 0
has body: private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { Calendar cal = Calendar.getInstance(); SimpleDateFormat dateOnly = new SimpleDateFormat("dd-MM-YYYY"); label1.setText(dateOnly.format(cal.getTime())); label2.getText(); } questions: how do you remove/parse a date from a JLabel? how do you subtract 2 dates? label1 input value is today date.26-09-2014. label2 input value is 26-10-2014. How can i get the answer: "30 days" in jtextfield.
downvote count: 5
type: UnansweredQuestion
tagged with: swing
upvote count: 0
score: -5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26064829
has title: Subtract two dates (set in JLabels)

http://stackoverflow.com/a/26171452
has body: While this might not be quite what your looking for, It is possible to make the jackson engine serialize objects differently via some tweaking. In my example below I create two types of serializers which will or wont serialize a field marked as transient. import java.io.Serializable; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jackson.map.ObjectMapper; public class Test { public static void main(String[] args) throws Exception { ISerializer d = new Doesnt(); ISerializer o = new Observes(); SomeObject obj = new SomeObject(); System.out.println("Doesnt: " + d.serialize(obj)); System.out.println("Observes: " + o.serialize(obj)); } public static class Doesnt implements ISerializer&lt;SomeObject&gt; { @Override public String serialize(SomeObject o) throws Exception { ObjectMapper om = new ObjectMapper(); om.setVisibilityChecker( om.getSerializationConfig(). getDefaultVisibilityChecker(). withFieldVisibility(JsonAutoDetect.Visibility.ANY). withGetterVisibility(JsonAutoDetect.Visibility.ANY)); return om.writeValueAsString(o); } } public static class Observes implements ISerializer&lt;SomeObject&gt; { @Override public String serialize(SomeObject o) throws Exception { ObjectMapper om = new ObjectMapper(); om.setVisibilityChecker( om.getSerializationConfig(). getDefaultVisibilityChecker(). withFieldVisibility(JsonAutoDetect.Visibility.ANY). withGetterVisibility(JsonAutoDetect.Visibility.NONE)); return om.writeValueAsString(o); } } public interface ISerializer&lt;T&gt; { public String serialize(T o) throws Exception; } public static class SomeObject implements Serializable { private static final long serialVersionUID = 745063791749142843L; private transient String myVar = "Transient"; private String myOther = "Not Transient"; public String getMyVar() { return myVar; } public void setMyVar(String myVar) { this.myVar = myVar; } public String getMyOther() { return myOther; } public void setMyOther(String myOther) { this.myOther = myOther; } } } output…
has comment: http://stackoverflow.com/comment/41044742
score: 0
answers question: http://stackoverflow.com/q/26170872
type: Answer

http://stackoverflow.com/comment/41037803
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26174493
type: QuestionComment
has text: Define "I can not". What do you expect the code to do, and what does it do instead?

http://stackoverflow.com/comment/40833609
has text: Where i placed my "script.py program" ? When running the services I have a java.security.AccessControlException: access denied ("java.io.FilePermission" "<<ALL FILES>>" "execute")
type: Comment
comment on: http://stackoverflow.com/a/26046105
score: 0
type: AnswerComment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/26156760
tags question: http://stackoverflow.com/q/26146371
tags question: http://stackoverflow.com/q/26085027
tags question: http://stackoverflow.com/q/26134656
tags question: http://stackoverflow.com/q/26163466
tag name: instantiation

http://stackoverflow.com/comment/40963369
has text: You want to change in the code ?
comment on: http://stackoverflow.com/q/26134499
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26115969
answers question: http://stackoverflow.com/q/26115667
type: Answer
has body: function clickDisableFunction() { if (clickedOnce == true) { return false; }; clickedOnce = true; $("#clientListTable").css( "opacity":"0.6" ); document.getElementById('clientListTable').setAttribute("disabled","true") };
score: 0

http://stackoverflow.com/a/26619869
has comment: http://stackoverflow.com/comment/41859184
type: Answer
has body: It sounds like the deletes weren't committed and only the inserts/updates were committed. Check your workspace for uncommitted changes and then confirm that those changes made it to git (Github and Bitbucket will let you view the commit history for a repo or you can use the git log command if you're sharing a repo internally).
answers question: http://stackoverflow.com/q/26057442
score: 0

http://stackoverflow.com/comment/40899595
type: Comment
type: QuestionComment
has text: wondering why 4 upvotes for this simple to answer question!
score: 0
comment on: http://stackoverflow.com/q/26098867

http://stackoverflow.com/a/26069047
has body: Yes: My suggestion is you'd better read the HTML code produced by your servlet. You'll find that all three radios have THE SAME VALUE.
answers question: http://stackoverflow.com/q/26068987
downvote count: 0
has comment: http://stackoverflow.com/comment/40846666
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26141219
answers question: http://stackoverflow.com/q/26141007
has body: Perhaps a CountDownLatch? Behind that link there are mentions of other possibilities such as CyclicBarrier.
score: 0
type: Answer

http://stackoverflow.com/comment/41067982
has text: @prakash But I have set the content for CurrentActivity to a different layout called start_up.xml and then I want to move to the main layout which is called activity_my
comment on: http://stackoverflow.com/q/26190774
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26061368
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26061396
has answer: http://stackoverflow.com/a/26061528
has body: When we are in a for loop, for(int i =0; i&lt; 10 ; i++) { System.out.println(i + 1); } will execute 1-10 However, if I change System.out.println to lets say a function passed such as for(int i=0;i&lt;10;i++) { passed( "Row" + (i+1)); } Where passed is public static void passed(String check) { System.out.println(check + "Passed"); } It executes 01 Passed 11 Passed 21 Passed 31 Passed.... 41 51 61 and so forth Can anyone explain why does it pass the value first and skip the math?
tagged with: java
upvote count: 1
downvote count: 1
has title: Integer executing as a string and not an integer?
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/26061396
answer count: 3
has comment: http://stackoverflow.com/comment/40830627
has answer: http://stackoverflow.com/a/26061518
accepted answer: http://stackoverflow.com/a/26061518

http://stackoverflow.com/comment/41011598
type: QuestionComment
has text: Firstly throw Illegal argument exception and not NPE in OneName#setName. Secondly why are you sorting it ? Just display it as you want to see first 10 that you entered.
comment on: http://stackoverflow.com/q/26160725
score: 0
type: Comment

http://stackoverflow.com/comment/40952038
comment on: http://stackoverflow.com/a/26128200
type: AnswerComment
score: 0
type: Comment
has text: @Sbodd Ok!, It´s changed

http://stackoverflow.com/comment/40916272
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26108360
type: QuestionComment
has text: Using the gradle build command on the jenkins server.

http://stackoverflow.com/comment/40813433
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26052282
type: AnswerComment
has text: , and - should also take.

http://stackoverflow.com/a/26108611
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26108427
upvote count: 1
type: Answer
has body: Misread the question - so here's a better answer: What you are looking for is the typical use case of an 1:n relation in relational databases - you have 1 star having n planets and each of the planets belong to 1 star. In the database you'd model this with a foreign key in each table. In Java, you could map it the same way (which you actually do when trying to model this relation via JPA): The star contains a list of all planets and the planet has a field containing the star.

http://stackoverflow.com/comment/41071366
score: 0
comment on: http://stackoverflow.com/q/26192829
has text: Post `SCILogBaseConfig` source code and mark 35th line
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26065204
accepted answer of: http://stackoverflow.com/q/26064853
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has body: As mentioned in my comments, try declaring the enum class in mapping file as: com.fileManagement.dataDesign.User$UserType Generally if we want to access any inner classes in Hibernate then we need to use the $ symbol.
answers question: http://stackoverflow.com/q/26064853

http://stackoverflow.com/q/26157551
downvote count: 0
possible better answer: http://stackoverflow.com/a/26158369
has body: Please do not mark it as duplicate, I went through many of those related posts, but in vain. I am new to Android/ Java programming and need help in knowing how to convert json map to a java hashmap. Please refer the code below: HttpPost httpPost1 = new HttpPost( "http://www.mywebsite.com/something.json" ); Log.i("MAP", "Hash call"); List&lt;NameValuePair&gt; nameValuePair1 = new ArrayList&lt;NameValuePair&gt;(1); nameValuePair1.add(new BasicNameValuePair("id_token", token )); try { httpPost1.setEntity(new UrlEncodedFormEntity(nameValuePair1)); } catch (UnsupportedEncodingException e) { // writing error to Log e.printStackTrace(); } // Making HTTP Request try { HttpResponse response1 = httpClient.execute(httpPost1); BufferedReader reader = new BufferedReader(new InputStreamReader(response1.getEntity().getContent(), "UTF-8")); StringBuilder builder = new StringBuilder(); for (line = null; (line = reader.readLine()) != null;) { // builder.append(line).append("\n"); System.out.println(line); Log.i("Line1", "line1 "+ line); class Data { private Email email; private String result; // Add/generate getters and setters. class Email { private List&lt;Alert&gt; alerts; private String session; // Add/generate getters and setters. } class Alert { private Long AlertID; private String tim; private String lng; private String lat; } } Gson gson=new Gson(); String json="{\"AlertID\":\"tim\",\"lng\",\"lat\"}"; Map&lt;String,String&gt; map=new HashMap&lt;String,String&gt;(); java.lang.reflect.Type type = new TypeToken&lt;Map&lt;String, String&gt;&gt;(){}.getType(); Map&lt;String, String&gt; myMap = gson.fromJson("{\"AlertID\":\"tim\",\"lng\",\"lat\"}", type); System.out.println(json); Log.i("JAVA Hash", "Java Hash call"); }//Closing for loop//line JSONTokener tokener = new JSONTokener(builder.toString()); JSONArray finalResult = new JSONArray(tokener); // writing response to log Log.i("Http Response:", response1.toString()); Log.i("JSON returns: ", "JSON returns"); } catch (ClientProto…
has answer: http://stackoverflow.com/a/26158369
favorite count: 0
accepted answer: http://stackoverflow.com/a/26157677
tagged with: android
tagged with: dictionary
has title: Getting an exception: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected ':' at line 1 column 24
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6096940
tagged with: hashmap
score: 1
has answer: http://stackoverflow.com/a/26157677
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2

http://stackoverflow.com/a/26064874
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26063607
has body: -XX:+HeapDumpOnOutOfMemoryError flag does not introduce performance or security problems in run time. The flag is checked only after OOME has happened. However the heap dump itself may contain sensitive data. Make sure it is written to a secure place by providing appropriate -XX:HeapDumpPath= option.
answers question: http://stackoverflow.com/q/26063607
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26190907
favorite count: 0
has answer: http://stackoverflow.com/a/26193455
possible better answer: http://stackoverflow.com/a/26191379
has body: I am still very new to Java and have been trying to figure out how to enable a text area for editing if a radio button is selected for a while now. I have been googling and reading posts on various forums, however i don;t understand what they are doing or how to do it within my program what so ever. Here is what I have so far: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package labscheduler; import java.net.URL; import java.util.ResourceBundle; import javafx.application.*; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; /** * * @author S02105032 */ public class FXMLLabSchedulerDocController implements Initializable { @FXML private TextField txtRequestorName; @FXML private TextField txtRequestorEmail; @FXML private TextField txtEventTitle; @FXML private TextField txtNumParticipants; @FXML private TextField txtEventDate; @FXML private TextField txtStartTime; @FXML private TextField txtEndTime; @FXML private ToggleButton togStartTime; @FXML private ToggleButton togEndTime; @FXML private CheckBox chkPrinter; @FXML private RadioButton rbYes; @FXML private RadioButton rbNo; @FXML private TextArea txtareaMessage; private String requestorName; private String requestorEmail; private String eventTitle; private int participants = 0; private Date eventDate; private Date startTime; private Date endTime; private String printer; private String message; @FXML private void handleBtnSubmit(ActionEvent event) { requestorName = txtRequestorName.getText(); requestorEmail = txtRequestorEmail.getText(); eventTitle = txtEventTitle.getText(); participants = Integer.parseInt(txtNumParticipants.getText()); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/YY"); try { eventDate = sdf.parse(txtEv…
has title: radio button to enable text area
type: AnsweredQuestion
tagged with: java
tagged with: javafx
upvote count: 1
has answer: http://stackoverflow.com/a/26193373
accepted answer: http://stackoverflow.com/a/26193455
downvote count: 1
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26191379
tagged with: radio-button
has comment: http://stackoverflow.com/comment/41068266

http://stackoverflow.com/comment/40799615
type: AnswerComment
comment on: http://stackoverflow.com/a/26044768
type: Comment
score: 0
has text: i did accordingly however it returned me a symbol that's it!

http://stackoverflow.com/a/26069331
has comment: http://stackoverflow.com/comment/40846752
has comment: http://stackoverflow.com/comment/40847131
has body: FTPCLient.restart(...) is protected. I think setRestartOffset(...) and retrieveFile(...) is the way to go: "Note: if you have used setRestartOffset(long), the file data will start from the selected offset.". I'd also catch CopyStreamException instead of just IOException: "The CopyStreamException allows you to determine the number of bytes transferred"'. You check for ftp.isConnected() before entering the retry block but you write "FTP server loose network connectivity and may remain disconnected". I guess that if you enter this catch block connectivity has been lost already, which is one of the reasons for entering this block at all. What is ftp.retr(...) doing? Retrying, yes, but does it work as intended? What do you get if you debug your code by: setting a breakpoint at ftp.isConnected() retrieving a file that is large enough to take a while to download pulling out your network cable while the transfer is in progress looking at the value of ftp.isConnected() if it is true (unlikely, but who knows) what does ftp.retr(...) return?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26067835

http://stackoverflow.com/q/26156418
has comment: http://stackoverflow.com/comment/41004020
has comment: http://stackoverflow.com/comment/41004050
favorite count: 0
tagged with: postgresql
type: Question
tagged with: sql
has title: To establish sql-connection from jUnit test
score: -1
accepted answer: http://stackoverflow.com/a/26156481
has comment: http://stackoverflow.com/comment/41003943
has body: I'm using PostgreSQL 9.3. PostgreSQL driver is postgresql-8.3-603.jdbc4.jar. I need to write jUnit test which establishes sql-connection and aggregating data from a database. The following @Test method I've written: @Test public void todayStatisticTest() throws ClassNotFoundException, SQLException { Connection conn = null; Properties connectionProps = new Properties(); connectionProps.put("user", "postgres"); connectionProps.put("password", "password"); Class.forName("org.postgresql.Driver"); //ClassNotFound exception is thrown conn = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/db_name", connectionProps); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM partner.partner"); } Why is ClassNotFoundExpcetion thrown?
answer count: 1
downvote count: 1
tagged with: java
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26156481
tagged with: junit
has comment: http://stackoverflow.com/comment/41023772

http://stackoverflow.com/q/26092419
tagged with: types
has title: How to downcast array of object type into an normal array?
tagged with: downcast
favorite count: 0
has answer: http://stackoverflow.com/a/26092634
has body: I planned to convert an ArrayList into an normal array. After that i tried to downcast that object type into a normal array.But its showing that "Cannot convert from Object to int" at line 17. package coll; import java.util.ArrayList; public class ToArray { public static void main(String[] args) { ArrayList a1=new ArrayList(); a1.add(new Integer(2)); a1.add(new Integer(8)); a1.add(new Integer(7)); a1.add(new Integer(6)); System.out.println("the contents are"+ a1); Object ia[]=a1.toArray(); int[] a=new int[5]; for(Object i:ia) { a[i]=((Integer)ia[i]).intValue(); } } }
type: UnansweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26092652
tagged with: java
type: Question
tagged with: mismatch
has answer: http://stackoverflow.com/a/26093027
upvote count: 2
answer count: 3

http://stackoverflow.com/q/26137086
has answer: http://stackoverflow.com/a/26137305
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2645566
type: Question
score: -2
has comment: http://stackoverflow.com/comment/40968130
tagged with: apache-poi
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26137271
has body: I'm working with apache poi and now I have the following trouble. I'm including apache poi in my project in this way: org.apache.poi poi-ooxml 3.7 Now my problem is that I'm not able to get a correct number of rows, for example I have two files (Source file and UploadFile). The uploadFile is made select all in the Source file and paste all in the uploadFile. In that case the following snippet of code print 65535 XSSFSheet firstSheet = (XSSFSheet) wbUploaded.getSheetAt((short)0); //Foglio Luce System.out.println(firstSheet .getLastRowNum()); //Read the sheet for(Row row : sheetLuce){ //Do something } Also if my file is the following: I understood that the problem depends from the way to make the file, why if I instead to select,copy and paste all, I select (on Source file) only the filled row and I copy them in the upload filethe number of rows is printed correctly. Now I want to ask you like poi manage the number of rows?
tagged with: excel
tagged with: java
type: UnansweredQuestion
has title: Wrong number of row with Poi

http://stackoverflow.com/comment/40805140
type: QuestionComment
score: 0
has text: Great, just make sure you don't add features or syntax to the language while using it.
type: Comment
comment on: http://stackoverflow.com/q/26047585

http://stackoverflow.com/comment/40827991
type: Comment
comment on: http://stackoverflow.com/a/26060424
score: 0
type: AnswerComment
has text: Ahh ! Yeah it doesn't work with partial rating. I am not sure how it went unnoticed for so long :)

http://stackoverflow.com/comment/114114562
type: AnswerComment
has text: Hi @SergeyKalinichenko overriding hashCode as well is to prevent calling Object.equals() ??
type: Comment
comment on: http://stackoverflow.com/a/26070525
score: 0

hibernate
tags question: http://stackoverflow.com/q/26105835
tags question: http://stackoverflow.com/q/26064262
tags question: http://stackoverflow.com/q/26120005
tags question: http://stackoverflow.com/q/26117619
tags question: http://stackoverflow.com/q/26062495
tags question: http://stackoverflow.com/q/26125625
tags question: http://stackoverflow.com/q/26193141
tags question: http://stackoverflow.com/q/26058953
tags question: http://stackoverflow.com/q/26155718
tags question: http://stackoverflow.com/q/26054258
tags question: http://stackoverflow.com/q/26046308
tags question: http://stackoverflow.com/q/26121496
tags question: http://stackoverflow.com/q/26117070
tags question: http://stackoverflow.com/q/26062976
tags question: http://stackoverflow.com/q/26097206
tags question: http://stackoverflow.com/q/26176915
tags question: http://stackoverflow.com/q/26157042
tags question: http://stackoverflow.com/q/26175179
tags question: http://stackoverflow.com/q/26177946
tags question: http://stackoverflow.com/q/26120089
tags question: http://stackoverflow.com/q/26099757
tags question: http://stackoverflow.com/q/26102635
tags question: http://stackoverflow.com/q/26108095
tags question: http://stackoverflow.com/q/26082435
tags question: http://stackoverflow.com/q/26097849
tags question: http://stackoverflow.com/q/26073318
tags question: http://stackoverflow.com/q/26087023
tags question: http://stackoverflow.com/q/26184814
tags question: http://stackoverflow.com/q/26144762
tags question: http://stackoverflow.com/q/26042058
tags question: http://stackoverflow.com/q/26174411
tags question: http://stackoverflow.com/q/26182819
tags question: http://stackoverflow.com/q/26174111
tags question: http://stackoverflow.com/q/26035814
tags question: http://stackoverflow.com/q/26060294
tags question: http://stackoverflow.com/q/26092608
tags question: http://stackoverflow.com/q/26059816
tags question: http://stackoverflow.com/q/26165188
tags question: http://stackoverflow.com/q/26183339
tags question: http://stackoverflow.com/q/26174241
tags question: http://stackoverflow.com/q/26192256
tags question: http://stackoverflow.com/q/26086697
tags question: http://stackoverflow.com/q/26160528
tags question: http://stackoverflow.com/q/26149569
tag name: hibernate
tags question: http://stackoverflow.com/q/26132940
tags question: http://stackoverflow.com/q/26164375
tags question: http://stackoverflow.com/q/26139347
tags question: http://stackoverflow.com/q/26064853
tags question: http://stackoverflow.com/q/26106557
tags question: http://stackoverflow.com/q/26137496
tags question: http://stackoverflow.com/q/26152530
tags question: http://stackoverflow.com/q/26084140
tags question: http://stackoverflow.com/q/26044918
tags question: http://stackoverflow.com/q/26179159
tags question: http://stackoverflow.com/q/26191418
tags question: http://stackoverflow.com/q/26062057
tags question: http://stackoverflow.com/q/26074461
tags question: http://stackoverflow.com/q/26170370
tags question: http://stackoverflow.com/q/26103699
tags question: http://stackoverflow.com/q/26112494
tags question: http://stackoverflow.com/q/26176861
tags question: http://stackoverflow.com/q/26125118
tags question: http://stackoverflow.com/q/26084031
tags question: http://stackoverflow.com/q/26104797
tags question: http://stackoverflow.com/q/26103791
tags question: http://stackoverflow.com/q/26121297
tags question: http://stackoverflow.com/q/26176292
tags question: http://stackoverflow.com/q/26077921
tags question: http://stackoverflow.com/q/26079616
tags question: http://stackoverflow.com/q/26113978
tags question: http://stackoverflow.com/q/26168069
tags question: http://stackoverflow.com/q/26110370
tags question: http://stackoverflow.com/q/26039885
tags question: http://stackoverflow.com/q/26137149
tags question: http://stackoverflow.com/q/26120183
tags question: http://stackoverflow.com/q/26086104
tags question: http://stackoverflow.com/q/26095026
tags question: http://stackoverflow.com/q/26162971
tags question: http://stackoverflow.com/q/26141625

http://stackoverflow.com/comment/40970248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26138045
score: 1
has text: Please adjust the indentation of the code snippets. Also, please post, what you have implemented in the AddConnectionPanel class so far.

http://stackoverflow.com/comment/40849162
type: Comment
comment on: http://stackoverflow.com/a/26071250
has text: oh then you first check that button click event is work or not by putting any Log in side of onclick method
type: AnswerComment
score: 0

http://stackoverflow.com/q/26068370
has comment: http://stackoverflow.com/comment/41153828
has answer: http://stackoverflow.com/a/38728598
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/38728598
has body: I have a Linux box with nearly maxed out CPU utilization. I used top to track down the offending Java process (12462) and underlying threads (12465 and 12466). I was hoping to run jstack and search in the output for 30b1 and 30b2 (the aforementioned threads converted to hex) so I could figure out what Java is doing. When I ran jstack without any flags, it returned the following error: 12462: Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding However, when I ran jstack -F the output didn't contain tid or nid information. Here's an excerpt from the output: Thread 31374: (state = IN_NATIVE) - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise) - java.net.SocketInputStream.read(byte[], int, int, int) @bci=79, line=150 (Compiled frame) - java.net.SocketInputStream.read(byte[], int, int) @bci=11, line=121 (Compiled frame) - org.apache.coyote.http11.InternalInputBuffer.fill(boolean) @bci=59, line=516 (Compiled frame) - org.apache.coyote.http11.InternalInputBuffer.fill() @bci=2, line=501 (Compiled frame) - org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout() @bci=90, line=173 (Compiled frame) - org.apache.coyote.http11.AbstractHttp11Processor.process(org.apache.tomcat.util.net.SocketWrapper) @bci=156, line=925 (Compiled frame) - org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(org.apache.tomcat.util.net.SocketWrapper, org.apache.tomcat.util.net.SocketStatus) @bci=149, line=585 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run() @bci=130, line=312 (Compiled frame) - java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=95, line=1145 (Compiled frame) - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=615 (Interpreted frame) - java.lang.Thread.run() @bci=11, line=7…
tagged with: jstack
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41155385
tagged with: linux
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41149872
has comment: http://stackoverflow.com/comment/41157563
type: Question
has title: Output from jstack missing tid and nid information
tagged with: java

http://stackoverflow.com/comment/40902237
comment on: http://stackoverflow.com/q/26099620
type: QuestionComment
type: Comment
has text: Well then the problem seems to be that you are putting too much data in the `Map`. It has nothing to do with a memory leak. Try to debug step-by-step, and look at the data in the `Map`. Try to figure out what's going wrong. Additionally: You really should use an [**LruCache**](http://developer.android.com/reference/android/util/LruCache.html) instead of a `Map`. A `LruCache` is actually designed to do what you want from it and it is almost certainly the solution to your `OutOfMemoryException`.
score: 0

http://stackoverflow.com/q/26044372
has comment: http://stackoverflow.com/comment/40799061
accepted answer: http://stackoverflow.com/a/26044542
has comment: http://stackoverflow.com/comment/40798816
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26044532
type: Question
has comment: http://stackoverflow.com/comment/40798883
has comment: http://stackoverflow.com/comment/40800059
tagged with: recursion
has title: Using a recursive method instead of a while loop
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26044507
has body: I'm working on a project for a Java 2 class which has to show population growth of organisms for a period of days inputted by the user. I was able to implement the method using a while loop, but am having difficulty converting it to a recursive method. while(day &lt;= totalDays) { if (day == 1){ System.out.println(organs); day++; //day one there is no increase } else{ organs = organs + organs*(increase/100); //add % increase of organisms System.out.println(organs); day++;} } Here is my unsuccessful attempt at a recursive method so far. public static double showPopulation(int dayNum, int days, double organisms, double dailyIncrease) { if(dayNum == totalDays) { return organisms + (organisms*dailyIncrease); } else return showPopulation(dayNum+1, days, organisms, dailyIncrease) + organisms*dailyIncrease;
has answer: http://stackoverflow.com/a/26044542
has answer: http://stackoverflow.com/a/26044507
has answer: http://stackoverflow.com/a/26044558

http://stackoverflow.com/comment/40861433
type: QuestionComment
has text: I apparently pasted the wrong link by accident.
score: 0
comment on: http://stackoverflow.com/q/26077093
type: Comment

http://stackoverflow.com/q/26160561
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26164884
has comment: http://stackoverflow.com/comment/41016069
has comment: http://stackoverflow.com/comment/41014612
has comment: http://stackoverflow.com/comment/41016808
has comment: http://stackoverflow.com/comment/41015785
has comment: http://stackoverflow.com/comment/41013122
score: 0
has comment: http://stackoverflow.com/comment/41015004
answer count: 1
has comment: http://stackoverflow.com/comment/41015512
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: encryption
has body: I am new to password storage and to Bouncy Castle. Encryption : Is there a reason to prefer Pkcs5S2ParametersGenerator over AES to encrypt(salt+hash(password+salt)) ? An example : How to encrypt and salt the password using BouncyCastle API in Java? My Java code : is there a better way to get back the salt from the cipher than byte array extraction ? Here is my java code : // salt java.security.SecureRandom rgen = new SecureRandom(); byte[] salt = rgen.generateSeed(20); // add Bouncy Castle java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); // aes secret key javax.crypto.KeyGenerator kgen = KeyGenerator.getInstance("AES", "BC"); Key cleSecrete = kgen.generateKey(); // aes javax.crypto.Cipher cipher = Cipher.getInstance("AES", "BC"); // sha-256 java.security.MessageDigest sha256 = MessageDigest.getInstance("SHA-256","BC"); // hash the clear password with the salt to avoid collisions byte[] motDePasseHash = hasherSaler(motDePasseClair.getBytes("UTF-8"),salt); // Encrypt the hash with the salt to get the salt back byte[] chiffreBDD = chiffrerSalerHash(salt,motDePasseHash,cleSecrete ); // Store the cipher in DB ... // Get back the hash and the salt from DB byte[] deChiffreBDD = deChiffrer(chiffreBDD,cleSecrete ); byte[] saltBDD = extraireOctets(deChiffreBDD,0,19); byte[] hashBDD = extraireOctets(deChiffreBDD,20,deChiffreBDD.length-1); // hash the user intput byte[] motDePasseHashCandidat = hasherSaler(motDePasseClairCandidat.getBytes("UTF-8"),saltBDD); // Compare hased user input with DB hash boolean isMotDePasseOK = Arrays.equals(hashBDD,motDePasseHashCandidat); private final byte[] hasherSaler(byte[] clair,byte[] salt) { byte[] concat = concatenerOctets(clair,salt); return sha256.digest(concat); } private final byte[] chiffrerSalerHash(byte[] salt,byte[] hash, Key cle) { cipher.init(true,cle); return cipher.doFinal(concatenerOctets(salt,hash)); } private final byte[] deChiffrer(byte[] chiffre, Key cle) { cipher.init(false,cle)…
has title: Password storage with SHA-256 hash and AES using Bouncy Castle in Java

http://stackoverflow.com/q/26152101
tagged with: quicksort
has comment: http://stackoverflow.com/comment/40996431
type: AnsweredQuestion
tagged with: java
has title: Quick sort of chars in String
has answer: http://stackoverflow.com/a/26152364
type: Question
has comment: http://stackoverflow.com/comment/40996139
tagged with: sorting
score: 0
has comment: http://stackoverflow.com/comment/40996227
tagged with: char
accepted answer: http://stackoverflow.com/a/26152364
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40996174
has body: I am trying to sort characters from string in alphabetic order. For example : program = agmoprr This is my code and I don't see how can I fix it. Any hint or tip? :) public static String quicksort(String y){ String x = ""; char[] a = new char[y.length()]; int i = 0; int j = a.length; if(j-i &lt; 0) return y; int m = i+(j-i)/2; char b = a[m]; a[m] = a[i]; a[i] = b; int r = i+1; for(int s = r; s!=j; s=s+1){ if(a[s] &lt; b) { char tmp = a[s]; a[s] = a[r]; a[r] = tmp; r=r+1; } } r=r-1; a[i] = a[r]; a[r] = b; return x = quicksort(y); }
has comment: http://stackoverflow.com/comment/40996076
has comment: http://stackoverflow.com/comment/40996131

http://stackoverflow.com/comment/40789379
type: AnswerComment
comment on: http://stackoverflow.com/a/26039325
score: 0
type: Comment
has text: @DebasishDash I have also added the code in my edited answer. You just need to call sendRedirect() method by passing the parameter as of what next servlet or JSP you want to reach and you can call this method with the response object you have in your doGet or in doPost.

http://stackoverflow.com/comment/53411875
has text: Got it, thanks Ricardo.
comment on: http://stackoverflow.com/q/26139942
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41013868
type: QuestionComment
comment on: http://stackoverflow.com/q/26161705
score: 0
type: Comment
has text: @skiwi Definitely I haven't seen in in the API, I don't know if such project exists in the community. If not found, create it and open source it! Or put a bounty and someone will!

http://stackoverflow.com/q/26129304
answer count: 2
has answer: http://stackoverflow.com/a/26130524
favorite count: 0
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/40954438
has body: If you want to use sort() method from Arrays class you MUST implement Comparable interface. This is a really good idea - you can't sort objects if they're not compatible. So you can't sort if you can't compare it's references. In this case interface is used like compatibility checker. The question is - how can I make: a class with a method (may do something with 2 objects) interface that checks if this 2 objects are comatible (have compatible references) add to my class "must use this interface" rule, so you can't use this class method without implementing specific interface, just like Comparable class does ? Example: public class Employee implements Comparable&lt;Employee&gt; { //fields //setters, getters // this method must be implemented to use Arrays.sort() public int compareTo(Employee other) { return Double.compare(salary, other.salary); } }
has answer: http://stackoverflow.com/a/26129449
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40954476
type: Question
has title: Java class which requires using interface if you want to use it's method
tagged with: sorting
has comment: http://stackoverflow.com/comment/40954420
has comment: http://stackoverflow.com/comment/40954496
has comment: http://stackoverflow.com/comment/40954556
score: 0

http://stackoverflow.com/comment/40944506
has text: Are these `if`s really intended to be `if`s or should they be `else if`s?
comment on: http://stackoverflow.com/q/26124007
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41074331
score: 0
has text: I think you must debug your code using a debugger for such exceptions and check where your code is having a logical errors.
comment on: http://stackoverflow.com/q/26151667
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40898978
type: QuestionComment
has text: I can't find any "official" documentation or mentioning for the other files on the download page either.
comment on: http://stackoverflow.com/q/26097166
score: 0
type: Comment

izpack
tag name: izpack
type: Tag
tags question: http://stackoverflow.com/q/26175381

http://stackoverflow.com/a/26096794
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26096376
score: 1
answers question: http://stackoverflow.com/q/26096376
type: Answer
has body: private static void sortInDescending(int[] arrayObj) { int n = arrayObj.length; int temp = 0; for(int i=0; i &lt; n; i++) { for(int j=1; j &lt; (n-i); j++) { if(arrayObj[j-1] &lt; arrayObj[j]) { temp = arrayObj[j-1]; arrayObj[j-1] = arrayObj[j]; arrayObj[j] = temp; } } } } Call method sortInDescending(arrayinput);

http://stackoverflow.com/q/26093661
downvote count: 0
tagged with: jquery
favorite count: 0
has answer: http://stackoverflow.com/a/26099248
tagged with: rest
has title: 400 Bad Request sending JSON POST to REST
accepted answer: http://stackoverflow.com/a/26099248
upvote count: 1
has body: I am sending POST from JQuery using some data, but thru my Javascript I get: 400 Bad Request error and REST not firing Trying it from Poster I get the following: HTTP Status 415 - Unsupported Media Type.The server refused this request because the request entity is in a format not supported by the requested resource for the requested method. Here is my JQuery: function doUpdate(path, rdf) { var encodedRdf = base64_encode(rdf); var data = {"path": path, "rdf": encodedRdf}; var sUrl = "http://localhost:8080/browsing/services/RDF/update"; $.ajax({ type: "POST", url: sUrl, contentType: "application/json", data: data, dataType: "json", async: false, success: function parse(resp, status, xhr) { $("#message").html("STATUS: " + xhr.status + " " + xhr.statusText + "\n" + resp); $("#message").hide(); $("#login_message").html("Record succesfully updatedd"); }, error: function(resp, status, xhr){ $("#message").html("ERROR: " + resp.status + " " + resp.statusText + "\n" + xhr); $("#message").show(); } }); } Here is my REST Resource: @POST @XmlElement(name = "data") @Path("/update") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces(MediaType.APPLICATION_JSON) public void update(Data data) { ... } Here is my Data Object: @XmlRootElement public class Data implements Serializable { private String path; private String rdf; /** * @return the path */ public String getPath() { return path; } /** * @param path the path to set */ public void setPath(String path) { this.path = path; } /** * @return the rdf */ public String getRdf() { return rdf; } /** * @param rdf the rdf to set */ public void setRdf(String rdf) { this.rdf = rdf; } Any one can tell me where is the problem please? Thanks,
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/26097306
has answer: http://stackoverflow.com/a/26097306
type: Question
answer count: 2
tagged with: jersey

controlsfx
tags question: http://stackoverflow.com/q/26059490
tag name: controlsfx
tags question: http://stackoverflow.com/q/26176498
type: Tag

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/26142930

http://stackoverflow.com/q/26080860
has answer: http://stackoverflow.com/a/26092470
type: Question
tagged with: jstl
has body: i am new Spring learner. i'm really confused about model.addAttribute how can i get all attributes(include parent) in below there are my code,see this code,please: Controller: @RequestMapping("/nav/addOrEdit") public String navAdd(Nav nav,ModelMap model){ if(nav.getId()!=null&amp;&amp;nav.getId()!=0) { nav=siteService.getNav(nav.getId()); model.addAttribute(nav); System.out.println("nav.id:"+nav.getId()); } return "CJ/nav/addOrEdit"; } Nav: public class Nav extends PO{ private static final long serialVersionUID = -13569672251584L; protected String code; @NotEmpty protected String name; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } } PO: public class PO implements Serializable { private static final long serialVersionUID = 4572077184754045588L; protected Long Id; public Long getId() {return Id;} public void setId(Long id) {Id = id;} } jsp: console.log("${nav}"); --&gt;Nav{code=1, name=test}, no id，how can i get the parent class’s attributes?
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: spring mvc use model.addAttribute(nav) can not get the parent class’s attributes in jsp with ${nav.id}
tagged with: spring
tagged with: spring-mvc
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/26040684
downvote count: 0
has comment: http://stackoverflow.com/comment/40792906
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40829824
score: 1
has body: Use this: text = text.replaceAll("\\s{2,}", " ");
answers question: http://stackoverflow.com/q/26040577

http://stackoverflow.com/q/26156163
has comment: http://stackoverflow.com/comment/41005818
tagged with: security
score: 0
has comment: http://stackoverflow.com/comment/41004519
has comment: http://stackoverflow.com/comment/41004709
linked to: http://stackoverflow.com/q/26097214
answer count: 0
type: UnansweredQuestion
has body: I am trying to validate certification path with domain cert and intermediate cert. The cert do not contain root cert. Is there a way to verify cert path with no root cert provided? Thanks ---Update---- Method that I have tried on InputStream trustStoreInput = new FileInputStream(cacertPath); String password = password; KeyStore anchors = KeyStore.getInstance(KeyStore.getDefaultType()); anchors.load(trustStoreInput, password.toCharArray()); X509CertSelector target = new X509CertSelector(); target.setCertificate(certList.get(1)); &lt;---I have domain cert and intermediate cert PKIXBuilderParameters params = new PKIXBuilderParameters(anchors, target); CertStoreParameters intermediates = new CollectionCertStoreParameters(certList); params.addCertStore(CertStore.getInstance("Collection", intermediates)); CertPathBuilderResult result = CertPathBuilder.getInstance("PKIX").build(params); But I got this error unable to find valid certification path to requested target
has comment: http://stackoverflow.com/comment/41004650
has title: Validate certification path with intermediate cert
tagged with: java
has comment: http://stackoverflow.com/comment/41004579
has comment: http://stackoverflow.com/comment/41004791
has comment: http://stackoverflow.com/comment/41003817
type: Question

http://stackoverflow.com/q/26124694
tagged with: sql
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26124829
favorite count: 0
has body: I am writing unit test to test failed update in DB by using stored procedure. I have a stored procedure which update one of the table. From test I am sending incorrect data(i.e. data that violate integrity constraint in table) in stored procedure. So I was expecting SQLException but it is throwing Spring's DataIntegrityViolationException. So my question is: Shouldn't catching SQLException be the correct way as it is more generic? @Test(expected = SQLException.class) public void testFailedSaveOp() { myService.savePerson(garbagePersonData); }
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26124829
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40945641
tagged with: unit-testing
type: Question
has title: Catching SQLException instead of Spring DataIntegrityViolationException in unit testing

http://stackoverflow.com/comment/40921184
comment on: http://stackoverflow.com/q/26111136
has text: Get input from keyboard by "String keyIn = keyboard.nextLine();" and check first character of keyIn if "E" or not. If not "E", convert string to integer for using letterGrade.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26129231
score: 0
tagged with: jakarta-mail
answer count: 2
possible better answer: http://stackoverflow.com/a/26135430
has answer: http://stackoverflow.com/a/26135430
has answer: http://stackoverflow.com/a/26129374
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40955079
tagged with: java
tagged with: java1.4
tagged with: inputstream
type: Question
has comment: http://stackoverflow.com/comment/40954901
tagged with: email-attachments
accepted answer: http://stackoverflow.com/a/26129374
has body: I am trying to send email this way but i could not figure out few things How do i use Input Stream object and add as a attachment. How to send multiple attachments How to send Multiple Attachments with HTML body I tried below code and i could only send one attachment or HTML body MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc)); Address address[] = {new InternetAddress(replyTo)}; message.setReplyTo(address); // Set Subject: header field message.setSubject(subject); // Now set the actual message MimeBodyPart messageBodyPart = new MimeBodyPart(); Multipart multipart = new MimeMultipart(); messageBodyPart = new MimeBodyPart(); String file = "/file.pdf"; String fileName = "attachmentName"; DataSource source = new FileDataSource(file); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(fileName); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); message.setContent(body, "text/html"); // Send message Transport.send(message);
has title: Sending Emails in java

http://stackoverflow.com/a/26083988
has body: I did something similar when I needed to poll external web services at a regular time interval. For the time interval you could proceed with a timer ; upon each tick with a granularity of 1s the observable chain will poll and maybe pick one layer, if that layer is null then nothing is emitted Observable.timer(0, 1, TimeUnit.SECOND) .flatMap(tick -&gt; Observable.just(queue.poll()).filter(layer -&gt; layer != null)) .subscribe(layer -&gt; System.out.format("The layer is : %s", layer)); Now if you want to abort the whole the chain you may add takeUntil. So when your external system want to stop it will submit something in stopObservable which will stop subsequent subscription : // somewhere before PublishSubject stopNotifier = PublishSubject.create(); // somewhere process the queue Observable.timer(0, 1, TimeUnit.SECOND) .takeUntil(stopNotifier) .flatMap(tick -&gt; Observable.just(queue.poll())) .subscribe(layer -&gt; System.out.format("The layer is : %s", layer)); // when not anymore interested (calling onComplete works too) stopNotifier.onNext("cancel everything about the queue"); I'm writing this response from a tablet so you may assume I may have misspell some words or made naive programming errors ;)
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26080646
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26080646

http://stackoverflow.com/comment/40826895
has text: Just open FileInputStream and write what you want. At midnight close it and open another one.
comment on: http://stackoverflow.com/q/26059606
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40992299
type: QuestionComment
has text: by regexChar you mean the spliter?
type: Comment
comment on: http://stackoverflow.com/q/26150035
score: 0

http://stackoverflow.com/q/26126071
has body: INFO: validateJarFile(E:\JavaProjectPractic.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\KKWebSite\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
has title: jar not loaded, i am using eclipse IDE
answer count: 1
tagged with: jsp
linked to: http://stackoverflow.com/q/1993493
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26126138
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/45319795
score: -2
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/40948055
has comment: http://stackoverflow.com/comment/40947935

http://stackoverflow.com/comment/40938326
score: 0
has text: Please, show us the result of `ls -l /usr/bin/java`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26121087

http://stackoverflow.com/a/53632550
type: Answer
has body: Improvements to Sander's answer! You can set a count value to the getFriendsList method as in Jonathan's Answer. The maximum value allowed for count is 200. The loop construct will help to collect more than 200 friends now. 200 friends per page or per iteration! Yet, there are rate limits for any request you make. The getFriendsList method will use this api endpoint: GET friends/list which has a rate limit of 15 hits per 15 minutes. Each hit can fetch a maximum of 200 friends which equates to a total of 3000 friends (15 x 200 = 3000) per 15 minutes. So, there will be no problem if you have only 3000 friends. If you have more than 3000 friends, an exception will be thrown. You can use the RateLimitStatus class to avoid that exception. The following code is an example implementation to achieve this. Method 1: fetchFriends(long userId) public List&lt;User&gt; fetchFriends(long userId) { List&lt;User&gt; friends = new ArrayList&lt;User&gt;(); PagableResponseList&lt;User&gt; page; long cursor = -1; try { while (cursor != 0) { page = twitter.getFriendsList(userId, cursor, 200); friends.addAll(page); System.out.println("Total number of friends fetched so far: " + friends.size()); cursor = page.getNextCursor(); this.handleRateLimit(page.getRateLimitStatus()); } } catch (TwitterException e) { e.printStackTrace(); } return friends; } Method 2: handleRateLimit(RateLimitStatus rls) private void handleRateLimit(RateLimitStatus rls) { int remaining = rls.getRemaining(); System.out.println("Rate Limit Remaining: " + remaining); if (remaining == 0) { int resetTime = rls.getSecondsUntilReset() + 5; int sleep = (resetTime * 1000); try { if(sleep &gt; 0) { System.out.println("Rate Limit Exceeded. Sleep for " + (sleep / 1000) + " seconds.."); Thread.sleep(sleep); } } catch (InterruptedException e) { e.printStackTrace(); } } } By doing so, your program will sleep for some time period based on the rate limiting threshold. It will continue to run from where it left after the sleep. This w…
score: 0
answers question: http://stackoverflow.com/q/26055767

http://stackoverflow.com/a/26137468
answers question: http://stackoverflow.com/q/26122805
downvote count: 0
has body: I'd rather use a different explanation than Marco: A plugin project is what you add to the IDE - This is where your actual plugins live. Eclipse organizes around projects, and the projects are what makes up a plugin for Liferay. As the IDE interprets different kinds of projects in a different way (e.g. standalone Java Applications vs. "Dynamic Web projects" etc), a "Portlet Project" or "Theme Project" just adds to this list. Once you have a plugin project (of type "Portlet") you can add as many portlets to it as you like. Thus, if you're developing portlets, you'll always have a minimum of one portlet plugin. This portlet plugin can hold any number of portlets. You'll always deploy the whole plugin to Liferay - this fact might influence which portlets you want to group into a single plugin.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41037130
comment on: http://stackoverflow.com/q/26173691
type: QuestionComment
type: Comment
has text: Recursion: noun, see "Recursion".
score: 0

http://stackoverflow.com/comment/41102746
type: QuestionComment
has text: @GrzesiekD. what would be a better name? ClientsDAO?
score: 0
comment on: http://stackoverflow.com/q/26175870
type: Comment

http://stackoverflow.com/q/26084654
has comment: http://stackoverflow.com/comment/40872761
upvote count: 1
has answer: http://stackoverflow.com/a/26087032
has body: My task is to "design a class called employee that includes three instance variables, first name (string), last name (string), and monthly salary (double). Provide a constructor that initializes the threee instance variables. Provide set and get methods for each instance variable. [...] to get full credit, your programs should have no compilation errors and give correct outputs; they should also be well commented and appropriately formated." Now, for all intents and purposes, this site helped me finish the shell of that homework yesterday, where I created the class, got the main to stop being annoying, initialized a constructor with 3 variables, and had set and get methods for them. However, I also feel like I need to have some kind of actual instance variables that should be set'ed, get'ed, adn printf'ed out or something. Right now, the Command Prompt just self terminates on the first button press, because there's nothing for the program to actually DO. In that way, I'm messing with my program as it will be displayed below. I can't quite get it to work, and would appreciate some insight into at least what I am doing wrong with the code below: import java.util.Scanner; public class Employee { public String FirstName, LastName; // String instance variables public double Salary; //double floating-point instance variable // main method begins program execution public static void main( String[] args ) { // create Scanner to enable user input in Dos Scanner input = new Scanner(System.in ); } // should introduce and initialize the constructor Employee public Employee( String fName, String lName, double empSalary ) { FirstName = fName; LastName = lName; Salary = empSalary; } // set First Name public void setFirstName( String Steven ) // set the First Name { FirstName = Steven; } public void setLastName( String Dorsey ) // set the Last Name { LastName = Dorsey; } public void setSalary( double empSalary ) // set the Employee Salary { Salary = empSalary; } public String displ…
favorite count: 0
has answer: http://stackoverflow.com/a/26084772
tagged with: instance-variables
tagged with: user-input
type: AnsweredQuestion
tagged with: java
score: -4
tagged with: output
has answer: http://stackoverflow.com/a/26084746
accepted answer: http://stackoverflow.com/a/26084746
possible better answer: http://stackoverflow.com/a/26084772
has comment: http://stackoverflow.com/comment/40872802
type: Question
downvote count: 5
answer count: 3
has title: Homework - Providing Output F and other things

http://stackoverflow.com/q/26119716
has body: I'm facing an issue as to redirecting my website to a certain specific URL... to better explain, I'm adding an auto refresh meta to the top of my jsp that refreshes the web page every 15 minutes, the only problem here is that when the 15 minutes are over, instead of refreshing the same page (thus calling the same servlet to recalculate what needs to be recalculated) it redirects to the home page!(defined in xml as login.jsp) Now I've tried to debug the code to see which part is redirecting to the home page but it seems that it's no power of my own! it's probably something Tomcat is doing that I'm not aware of. It already happened to me before and the solution was to add an attribute to the session scope session.setAttribute("User",user); but not this time... To support my point(It's not a session problem), here's a portion of the code directly extracted from the page source code after redirection WelcomeTV Username Password Reset your password Change your password You can see that the value is filled, and in my jsp the value is taking ${sessionScope.username} so this proves that the session is still valid Please help me? if it's not clear please let me know, I'll try to make myself clearer.
has answer: http://stackoverflow.com/a/26119819
tagged with: java
has title: Issue redirecting to the home page using JAVA and Tomcat
type: Question
has comment: http://stackoverflow.com/comment/40935943
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26119819
has comment: http://stackoverflow.com/comment/40935699
tagged with: jsp
has answer: http://stackoverflow.com/a/26120907
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26120907
has comment: http://stackoverflow.com/comment/40935664
has comment: http://stackoverflow.com/comment/40935862
tagged with: http-redirect
type: AnsweredQuestion

http://stackoverflow.com/comment/40887591
has text: Fro XML parsing i am using JAVAX classes . i dont need special jars to do
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26074166
type: Comment

http://stackoverflow.com/a/33559777
has body: Have you added the struts2-core-.jar to the libraries of the project? Clean the project. The error will go away.
type: Answer
answers question: http://stackoverflow.com/q/26091407
score: 0

http://stackoverflow.com/a/26105078
downvote count: 0
score: 1
has body: I added -vm C:\Java\jdk1.6.0_29\bin\javaw.exe main problem is "-vm" option should be given above "-vmargs" It worked for me.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26104984

http://stackoverflow.com/comment/41013684
comment on: http://stackoverflow.com/q/26159931
has text: Try to use `p.getTex()` so you get the text of the paragraph.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26157632
has comment: http://stackoverflow.com/comment/45135684
tagged with: search
score: 0
has body: I tried to construct a method that gives me the results from the search of a text in twitter, but only gives me the 6 most recent results, and I need more, 50~100~200... really... Some more.. I tried a lot of for ordo while bucles tryin' only to get more results. Failed. Is there some method to do it? I tried with getMentions(), but for a error and bad results and another uses, I need to do it with twitter.query(Search). Is there someone that knows about it? I'm playin' with TWITTER4J - 4.0.2 Version. Here's my code : List&lt;Status&gt; estados = new ArrayList&lt;Status&gt;(); BufferedReader br = null; FileWriter fichero = null; PrintWriter pw = null; File file = new File("dbmenciones.txt"); try { Query query = new Query(); query.setQuery("#tits"); query.setResultType(Query.MIXED); query.setCount(100); QueryResult qr = null; long lastid = Long.MAX_VALUE; int vv = 0; do { vv++; if (512 - estados.size() &gt; 100){ query.setCount(100); } else { query.setCount(512 - estados.size()); } qr = twitter.search(query); estados.addAll(qr.getTweets()); System.out.println("Obtenidos "+estados.size()+" tweets."); for (Status stt : estados){ if (stt.getId()&lt;lastid) lastid = stt.getId(); } query.setMaxId(lastid-1); } while (vv &lt; 14); for (Status status : estados){ System.out.println(status.getId()+" : "+status.getText()); System.out.printf("Publicado : %s, @%-20s ,dijo: %s\n", status.getCreatedAt().toString(), status.getUser().getScreenName(), cleanText(status.getText())); listaUsuarios.add("\""+status.getUser().getId()+"\";\""+status.getUser().getScreenName()+"\";\""+status.getUser().getFollowersCount()+"\""); fichero = new FileWriter("C:\\Documents and Settings\\a671\\Escritorio\\"+file, true); pw = new PrintWriter(fichero); System.out.println("Added : "+listaUsuarios.get(listaUsuarios.size()-1)); pw.println(listaUsuarios.get(listaUsuarios.size()-1)); if (null != fichero){ fichero.close(); } } } catch (Exception e) { e.printStackTrace(); } finally { try { if (null != fichero…
answer count: 1
type: UnansweredQuestion
has title: Twitter4j on java - query search only gives me the 6 most recent results
has answer: http://stackoverflow.com/a/26157821
tagged with: limit
type: Question
tagged with: twitter4j
tagged with: java
tagged with: twitter
linked to: http://stackoverflow.com/q/18800610

http://stackoverflow.com/q/26177977
has comment: http://stackoverflow.com/comment/41043980
has comment: http://stackoverflow.com/comment/41043664
tagged with: java
has comment: http://stackoverflow.com/comment/41043865
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41043746
has comment: http://stackoverflow.com/comment/41043686
has answer: http://stackoverflow.com/a/26178226
score: 0
has comment: http://stackoverflow.com/comment/41043816
has comment: http://stackoverflow.com/comment/41043756
answer count: 1
has comment: http://stackoverflow.com/comment/41043657
has comment: http://stackoverflow.com/comment/41043728
has title: i am trying to use two while loop in a single program to iterate two queries but first while loop is not executed
has body: public class JustTest { public static void main(String[] args) { //Blank workbook XSSFWorkbook workbook = new XSSFWorkbook(); String url =""; String username =""; String password =""; try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection c = DriverManager.getConnection(url,username,password); c.setAutoCommit(false); System.out.println("Opened database successfully"); //Create a blank sheet XSSFSheet sheet = workbook.createSheet("total"); Row headerRow = sheet.createRow(0); Cell date = headerRow.createCell(0); date.setCellValue("date"); Cell byDate = headerRow.createCell(1); byDate.setCellValue("total au"); Cell byDate1 = headerRow.createCell(1); byDate1.setCellValue("total au_dt"); Statement stmt = c.createStatement(); //passing two queries rs and rs1 ResultSet rs = stmt.executeQuery("select empname,empno from emp"); ResultSet rs1=stmt.executeQuery("select deptno,deptname from dept"); int row = 1; //first query iterate while(rs.next()) { String empname= rs.getString("empname"); int empno = rs.getInt("empno "); Row dataRow = sheet.createRow(row); Cell dataNameCell = dataRow.createCell(0); dataNameCell.setCellValue(dateValue); Cell dataAddressCell = dataRow.createCell(1); dataAddressCell.setCellValue(empno ); row = row + 1; } //second query iterate while(rs1.next()) { String deptno=rs1.getString("deptno"); String deptname =rs1.getString("deptname "); Row dataRow = sheet.createRow(row1); Cell dataNameCell1 = dataRow.createCell(2); dataNameCell1.setCellValue(deptno); Cell dataNameCell2 = dataRow.createCell(3); dataNameCell2.setCellValue(deptname ); row1 = row1 + 1; } } catch ( NullPointerException e ) { System.out.println( " is not updated because cells cannot be left null/empty "); } catch ( Exception e ) { System.err.println( e.getClass().getName()+": "+ e.getMessage() ); System.exit(0); } try { //Write the workbook in file system FileOutputStream out = new FileOutputStream(new File("C:\\Users\\jit\\Desktop\\allSheets\\justtest.xlsx")); workbook.write(out…
has comment: http://stackoverflow.com/comment/41043851
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41044016
has comment: http://stackoverflow.com/comment/41043752

http://stackoverflow.com/comment/40903831
comment on: http://stackoverflow.com/q/26101159
type: Comment
type: QuestionComment
score: 0
has text: in which line your app crashes

http://stackoverflow.com/comment/40986929
type: QuestionComment
comment on: http://stackoverflow.com/q/26147205
has text: Yeah, thus it wasn't an answer but just a comment, a poor comment :/
score: 0
type: Comment

http://stackoverflow.com/a/26162419
has comment: http://stackoverflow.com/comment/41015414
has comment: http://stackoverflow.com/comment/41015075
has comment: http://stackoverflow.com/comment/41015940
has comment: http://stackoverflow.com/comment/41015045
has comment: http://stackoverflow.com/comment/41015599
has body: You might want to consider using the Neo4J JDBC driver to expose the neo4j database as a JDBC connection, and then use other existing tools to query/backup from that JDBC connection. It seems that as you've found, dump is good for creating cypher that you can use to re-create another neo4j database. If that isn't what you want, maybe you want to dump the information as tabular data? Setting up neo4j as a JDBC connection point has the advantage that you can reuse any tool that knows how to talk to a JDBC database, and use all of those to query/format/dump your data.
has comment: http://stackoverflow.com/comment/41015858
has comment: http://stackoverflow.com/comment/41016045
downvote count: 0
has comment: http://stackoverflow.com/comment/41016284
type: Answer
has comment: http://stackoverflow.com/comment/41015286
score: 1
answers question: http://stackoverflow.com/q/26162196
upvote count: 1

http://stackoverflow.com/q/26073572
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/35196207
tagged with: android
tagged with: macos
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40852353
has title: Eclipse error while building workspace
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26073666
has answer: http://stackoverflow.com/a/26073659
tagged with: java
tagged with: eclipse
type: Question
has body: I am facing this issue everytime i start eclipse. This is messing up the xml layouts. How do i reslove this ?

http://stackoverflow.com/q/26099301
has title: Hibernate: Join table to a join table annotation
has comment: http://stackoverflow.com/comment/40899489
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
score: 0
tagged with: sql
has body: How do you create an annotation for the following case: Table A id name Table B id name Table C id name Table AB a_id b_id Table ABC id a_id b_id c_id name How can you represent table ABC on hibernate using annotations? Table AB is not an object it is used as a table join between tables A and B. The annotation for A and B would look something like this: For A: @OneToMany(cascade=CascadeType.ALL) @JoinTable(name="AB", joinColumns={@JoinColumn(name="a_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn(name="b_id", referencedColumnName="id")}) private Set bs; For B: @OneToMany(cascade=CascadeType.ALL) @JoinTable(name="AB", joinColumns={@JoinColumn(name="b_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn(name="a_id", referencedColumnName="id")}) private Set as; Thanks in Advance.
answer count: 1
has answer: http://stackoverflow.com/a/26099607
accepted answer: http://stackoverflow.com/a/26099607

http://stackoverflow.com/a/26938939
has body: Hi I used a custom array adapter like the one below, it's just a sample. But I hope it helps. It displays data that was sent to it using an ArrayList from an fragment where it is displayed. public class MovieAdapter extends ArrayAdapter&lt;Movie&gt; { private Context context; private List&lt;Movie&gt; movies; public MovieAdapter(Context context, List&lt;Movie&gt; movies) { super(context, R.layout.movie_layout, movies); this.context = context; this.movies = movies; } @Override public View getView(int position, View convertView, ViewGroup parent) { View movieView = convertView; if (movieView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); movieView = inflater.inflate(R.layout.movie_layout, parent, false); } movieView.setTag(movies.get(position)); TextView txtTitle = (TextView) movieView.findViewById(R.id.txtTitle); TextView txtDate = (TextView) movieView.findViewById(R.id.txtDate); RatingBar ratingBar = (RatingBar) movieView .findViewById(R.id.ratingBar); txtTitle.setText(movies.get(position).MovieTitle); txtDate.setText("Date Viewed: " + movies.get(position).dateViewed); ratingBar.setIsIndicator(true); ratingBar.setNumStars(movies.get(position).rating); ratingBar.setRating(movies.get(position).rating); return movieView; } } The fragment public class MyListFragment extends Fragment { Movie movie; MovieAdapter adapter; MovieSelectedListener callBack; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.list_fragment, container, false); ListView movieList = (ListView) view.findViewById(R.id.movieList); movieList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub TextView movie = (TextView) view.findViewById(R.id.txtTitle); String title = movie.getText().toString(); callBack.onMovi…
type: Answer
answers question: http://stackoverflow.com/q/26057895
score: 0

http://stackoverflow.com/a/26147649
answers question: http://stackoverflow.com/q/26147311
upvote count: 1
type: Answer
downvote count: 0
has body: Most system dependencies are not made available to plugins. Also, including the tools.jar in your uberjar isn't terribly portable across newer versions of JVMs. Its fine if you have a super controlled and limited deployment environment, but generally its better to discover the tools.jar and use it. Here's an example from the maven-javadoc-plugin itself (it looks up the tools.jar and then validates that the active classloader has classes from the tools.jar) In your case, instead of looking for com.sun.tools.doclets.Taglet, you'd look for com.sun.tools.javac.api.JavacScope to verify a valid environment. From there it would be trivial to build up a new ClassLoader with your uberjar + tools.jar and then execute what you need from a valid Thread.currentThread().setContextClassLoader() scope
score: 1

http://stackoverflow.com/q/26040082
downvote count: 0
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/40791909
possible better answer: http://stackoverflow.com/a/26047432
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40795902
has comment: http://stackoverflow.com/comment/40791124
has answer: http://stackoverflow.com/a/26047432
has title: $Proxy0 (Unknown Source) jboss
has comment: http://stackoverflow.com/comment/40791254
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26100615
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40795221
upvote count: 1
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/40796102
tagged with: jboss
has comment: http://stackoverflow.com/comment/40790991
accepted answer: http://stackoverflow.com/a/26100615
answer count: 2
has body: I'm facing some problem using JBoss 7 here, i don't know why, but after i do the lookup i try to send a collection to my server and then turn the xml files into DB data. But, as soon as the lookup is made and i try to send the collections i receive this error msg: Exception in thread "main" java.io.StreamCorruptedException: Unexpected byte found when reading an object: 0 at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:755) at org.jboss.marshalling.river.BlockUnmarshaller.readToEndBlockData(BlockUnmarshaller.java:124) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1613) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:437) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:202) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144) at $Proxy0.importXml(Unknown Source) at principal.FeedClientDB.processArq(FeedClientDB.java:116) at principal.FeedClientDB.processArq(FeedClientDB.java:101) at principal.FeedClientDB.main(FeedClientDB.java:58) Caused by: an exception which occurred: in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in object of type xml.XmlDoc in element at index [0] of size [49] The element which i'm trying to send is an object that contains an attribute transient inputStream. I don't know if it should act this way or not.

http://stackoverflow.com/q/26108045
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26108600
accepted answer: http://stackoverflow.com/a/26137102
has answer: http://stackoverflow.com/a/71954899
tagged with: log4j2
tagged with: logging
has body: I'm using log4j2 in my application. What I want is everything up to 'debug' to go to console, everything up to 'info' to go to myapp.log, and ONLY 'info' to go to 'myapp-audit.log'. The reason is, INFO mostly consists of successful modifications to data (ex. 'user created', 'user updated', 'user deleted', and so on). If is effectively an audit log of data modifications. But I can't get figure out how to do it. How do I get ONLY 'info' to get logged to 'myapp-audit.log'? Here's my current configuration ... <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="%d{yyyy-mm-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="%d{yyyy-mm-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <appender-ref ref="Console" level="debug" /> <appender-ref ref="LogFile" level="info" /> <appender-ref ref="AuditFile" level="info" />
type: Question
tagged with: configuration
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/26137102
has title: how to log only one level with log4j2?
possible better answer: http://stackoverflow.com/a/26108600
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/54630638
tagged with: log4j
favorite count: 0
answer count: 4

http://stackoverflow.com/a/26089767
score: 1
answers question: http://stackoverflow.com/q/26089734
has body: Yes you must first convert it into an Integer, Double, Float, etc in order to do a multiplication on such. So just do int v = Integer.parseInt(value.trim()); Then System.out.println("The square of the number"+v+"is"+ (v * v)); Also using operators has nothing to do with Math library. Math library is used like so: double d = Double.parseDouble(value.trim()); Math.pow(d,2.0); //which does the same thing above
downvote count: 0
has comment: http://stackoverflow.com/comment/40882379
type: Answer
has comment: http://stackoverflow.com/comment/40882266
has comment: http://stackoverflow.com/comment/40882259
upvote count: 1
has comment: http://stackoverflow.com/comment/40882518
has comment: http://stackoverflow.com/comment/40882521
has comment: http://stackoverflow.com/comment/40898544

http://stackoverflow.com/q/26087018
has comment: http://stackoverflow.com/comment/40887245
tagged with: java
type: Question
score: 2
tagged with: api
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/26092701
has body: I'm currently working on a project that involves the creation of a .jar file. The following is to be achieved, I'm supposed to export/read the path of a friend's registry, once this is done I'm supposed to get the result back via email. The whole concept is in creating the jar file and once it's clicked I get the results through my email since I actually sent it through email. (I hope this makes sense) So first, I've combined the following code to actually read the registry and display the keys ( i got it from the popular post on stack overflow for read/write registries) so the reading process is working fine, now my problem is with the email code, (I'm not quite sure who the original owner to this code is but full credit goes it him) I'm trying to get the basic concept of this email code to work so that I can continue working on sending my jar file as an attachment and link it to my code in a way when a user clicks on the jar file, the registry results will be emailed back to me. import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class MailCode { public static void main(String[] args) throws Exception { final String smtp_host = "smtp.gmail.com"; final String smtp_username = "user@gmail.com"; final String smtp_password = "password"; final String smtp_connection = "TLS"; // Use 'TLS' or 'SSL' connection final String toEmail="tomail@hotmail.com"; final String fromEmail="**@gmail.com"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); if (smtp_connection.equals("TLS")) { props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.port", "587"); } else{ props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSoc…
has answer: http://stackoverflow.com/a/36726355
answer count: 3
has answer: http://stackoverflow.com/a/26092675
tagged with: email
has title: Sending emails through Java - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 587;
favorite count: 0
linked to: http://stackoverflow.com/q/51871429
possible better answer: http://stackoverflow.com/a/26092675
has comment: http://stackoverflow.com/comment/40877558
upvote count: 2
tagged with: sockets
accepted answer: http://stackoverflow.com/a/26092701
has comment: http://stackoverflow.com/comment/40887076
has comment: http://stackoverflow.com/comment/40886691
type: AnsweredQuestion

http://stackoverflow.com/a/35317687
upvote count: 41
downvote count: 1
has comment: http://stackoverflow.com/comment/122732973
has comment: http://stackoverflow.com/comment/117602156
has comment: http://stackoverflow.com/comment/106891594
score: 40
has comment: http://stackoverflow.com/comment/133794207
has body: If you are using Eclipse, try closing and opening it again. The error goes away.
has comment: http://stackoverflow.com/comment/138137584
has comment: http://stackoverflow.com/comment/133329390
answers question: http://stackoverflow.com/q/26110425
has comment: http://stackoverflow.com/comment/106892156
has comment: http://stackoverflow.com/comment/117625001
type: Answer
has comment: http://stackoverflow.com/comment/140265914
has comment: http://stackoverflow.com/comment/72565564

http://stackoverflow.com/q/26102362
has title: Round up BigDecimal to Integer value
type: AnsweredQuestion
upvote count: 38
has answer: http://stackoverflow.com/a/26102453
has answer: http://stackoverflow.com/a/26102447
has body: I have a BigDecimal which value is 450.90, I want to round up to next hole integer value, and then print the Integer value without any decimal points, like this; Val: 450.90 -> Rounded: 451.00 -> Output: 451 Val: 100.00001 -> Rounded: 101.00000 Output: 101 Checked some solutions but I'm not getting the expected result, heres my code; BigDecimal value = new BigDecimal(450.90); value.setScale(0, RoundingMode.HALF_UP); //Also tried with RoundingMode.UP return value.intValue(); Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/26102742
has answer: http://stackoverflow.com/a/26102446
type: Question
possible better answer: http://stackoverflow.com/a/26102447
accepted answer: http://stackoverflow.com/a/26102434
linked to: http://stackoverflow.com/q/5681868
tagged with: rounding
score: 38
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/40905565
linked to: http://stackoverflow.com/q/15643280
has comment: http://stackoverflow.com/comment/40905119
downvote count: 0
tagged with: bigdecimal
answer count: 5
has answer: http://stackoverflow.com/a/26102434

http://stackoverflow.com/comment/40811788
type: Comment
type: QuestionComment
has text: first check whether you really wanna use for loops if you want a recursion
score: 0
comment on: http://stackoverflow.com/q/26051331

jaxb
tags question: http://stackoverflow.com/q/26063268
tags question: http://stackoverflow.com/q/26122192
tags question: http://stackoverflow.com/q/26107727
tags question: http://stackoverflow.com/q/26051082
tags question: http://stackoverflow.com/q/26137226
tags question: http://stackoverflow.com/q/26131143
tags question: http://stackoverflow.com/q/26158956
tags question: http://stackoverflow.com/q/26056598
tags question: http://stackoverflow.com/q/26072170
tags question: http://stackoverflow.com/q/26147085
tags question: http://stackoverflow.com/q/26139999
tags question: http://stackoverflow.com/q/26144104
tags question: http://stackoverflow.com/q/26147646
tags question: http://stackoverflow.com/q/26137510
tags question: http://stackoverflow.com/q/26183053
tags question: http://stackoverflow.com/q/26097760
tags question: http://stackoverflow.com/q/26138753
tags question: http://stackoverflow.com/q/26182517
tags question: http://stackoverflow.com/q/26134348
tags question: http://stackoverflow.com/q/26141586
tags question: http://stackoverflow.com/q/26156293
tags question: http://stackoverflow.com/q/26167688
tags question: http://stackoverflow.com/q/26192967
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/26042188
tags question: http://stackoverflow.com/q/26124260
tags question: http://stackoverflow.com/q/26067552
tags question: http://stackoverflow.com/q/26160203
tags question: http://stackoverflow.com/q/26126814
tags question: http://stackoverflow.com/q/26180501
tags question: http://stackoverflow.com/q/26177858
tags question: http://stackoverflow.com/q/26128665
tags question: http://stackoverflow.com/q/26075614
tags question: http://stackoverflow.com/q/26166751
tags question: http://stackoverflow.com/q/26107483
tags question: http://stackoverflow.com/q/26113314
tags question: http://stackoverflow.com/q/26186689
tags question: http://stackoverflow.com/q/26179622

http://stackoverflow.com/a/26175777
answers question: http://stackoverflow.com/q/26175371
has body: Check that even if it is installed in a subfolder of your home directory, the owner of idea-IC-135.1289 is you (recursively).
downvote count: 0
type: Answer
score: 2
upvote count: 2

regex
tags question: http://stackoverflow.com/q/26052758
tags question: http://stackoverflow.com/q/26150035
tags question: http://stackoverflow.com/q/26034892
tags question: http://stackoverflow.com/q/26124167
tags question: http://stackoverflow.com/q/26051911
tags question: http://stackoverflow.com/q/26075748
tag name: regex
tags question: http://stackoverflow.com/q/26183269
tags question: http://stackoverflow.com/q/26180049
tags question: http://stackoverflow.com/q/26050551
tags question: http://stackoverflow.com/q/26139527
tags question: http://stackoverflow.com/q/26034785
tags question: http://stackoverflow.com/q/26077641
tags question: http://stackoverflow.com/q/26067844
tags question: http://stackoverflow.com/q/26038692
tags question: http://stackoverflow.com/q/26085720
tags question: http://stackoverflow.com/q/26054876
tags question: http://stackoverflow.com/q/26146391
tags question: http://stackoverflow.com/q/26176992
tags question: http://stackoverflow.com/q/26159402
tags question: http://stackoverflow.com/q/26193377
tags question: http://stackoverflow.com/q/26184453
tags question: http://stackoverflow.com/q/26129384
tags question: http://stackoverflow.com/q/26035631
tags question: http://stackoverflow.com/q/26034263
tags question: http://stackoverflow.com/q/26116898
tags question: http://stackoverflow.com/q/26175877
tags question: http://stackoverflow.com/q/26076654
tags question: http://stackoverflow.com/q/26162191
tags question: http://stackoverflow.com/q/26146018
tags question: http://stackoverflow.com/q/26118754
tags question: http://stackoverflow.com/q/26046819
tags question: http://stackoverflow.com/q/26179049
tags question: http://stackoverflow.com/q/26123271
tags question: http://stackoverflow.com/q/26045068
tags question: http://stackoverflow.com/q/26042753
tags question: http://stackoverflow.com/q/26138228
tags question: http://stackoverflow.com/q/26180094
tags question: http://stackoverflow.com/q/26184281
tags question: http://stackoverflow.com/q/26109688
tags question: http://stackoverflow.com/q/26103731
tags question: http://stackoverflow.com/q/26071082
tags question: http://stackoverflow.com/q/26122728
tags question: http://stackoverflow.com/q/26118190
tags question: http://stackoverflow.com/q/26118838
tags question: http://stackoverflow.com/q/26169792
tags question: http://stackoverflow.com/q/26040518
tags question: http://stackoverflow.com/q/26150143
tags question: http://stackoverflow.com/q/26162771
tags question: http://stackoverflow.com/q/26075462
tags question: http://stackoverflow.com/q/26167320
tags question: http://stackoverflow.com/q/26157252
tags question: http://stackoverflow.com/q/26080896
tags question: http://stackoverflow.com/q/26087492
tags question: http://stackoverflow.com/q/26048524
tags question: http://stackoverflow.com/q/26185375
tags question: http://stackoverflow.com/q/26044048
tags question: http://stackoverflow.com/q/26186267
tags question: http://stackoverflow.com/q/26081725
tags question: http://stackoverflow.com/q/26151922
tags question: http://stackoverflow.com/q/26035869
tags question: http://stackoverflow.com/q/26086433
type: Tag

http://stackoverflow.com/comment/40902758
score: 0
type: Comment
has text: ok solved it was because i used "getRessource()" too soon i guess. Now i get the well known OutOfMemoryException ^^"
comment on: http://stackoverflow.com/a/26062245
type: AnswerComment

http://stackoverflow.com/comment/41047840
type: AnswerComment
comment on: http://stackoverflow.com/a/26179580
score: 0
type: Comment
has text: %c2%bb%3d also outputs �=

http://stackoverflow.com/q/26034263
has title: RegEx/Java - Retrieve values from String
possible better answer: http://stackoverflow.com/a/26034353
has answer: http://stackoverflow.com/a/26034353
downvote count: 2
upvote count: 1
type: AnsweredQuestion
has body: From the below string, I need to retrieve groupA, groupB &amp; groupC String str = "(&amp;(objectCategory=group)(|(cn=groupA) (cn=groupB) (cn=groupC) ))" How can this be achieved using Java?
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26034313
type: Question
accepted answer: http://stackoverflow.com/a/26034313
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26034359
tagged with: regex

http://stackoverflow.com/comment/41024066
type: AnswerComment
comment on: http://stackoverflow.com/a/26167081
score: 0
type: Comment
has text: On a single line isn't the stuff you entered in the console appended with print, so if you want to enter `1 2 3 -1` you'd get `1 Entered Numbers: 12 23 3-1 -1`?

http://stackoverflow.com/comment/40992690
type: Comment
comment on: http://stackoverflow.com/a/26150317
has text: Unfortunately, this is for a school assignment where I am not allowed to use any such libraries! :-(
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40840150
has text: From my understanding a conversion from bytes to floats results in 1) grouping the bytes into groups of four and then 2) calculating the float value based on such a group. Typically you will find two ways for the calculation: using shift operators or bytebuffers.
comment on: http://stackoverflow.com/q/26066371
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26143047
type: Question
has title: Show event information with ExtendedCalendarView
has body: I'm trying to create a custom calendar for show events and relative informations in my app. But I don't know how to show this informations. That's the code of the calendar: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ExtendedCalendarView calendar = (ExtendedCalendarView)findViewById(R.id.calendar); ContentValues values = new ContentValues(); values.put(CalendarProvider.COLOR, Event.COLOR_BLUE); values.put(CalendarProvider.DESCRIPTION, "Some Description"); values.put(CalendarProvider.LOCATION, "Some location"); values.put(CalendarProvider.EVENT, "Event name"); Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getDefault(); cal.set(startDayYear, startDayMonth, startDayDay, startTimeHour, startTimeMin); int StartDayJulian = Time.getJulianDay(cal.getTimeInMillis(), TimeUnit.MILLISECONDS.toSeconds(tz.getOffset(cal.getTimeInMillis()))); values.put(CalendarProvider.START, cal.getTimeInMillis()); values.put(CalendarProvider.START_DAY, StartDayJulian); cal.set(endDayYear, endDayMonth, endDayDay, endTimeHour, endTimeMin); int endDayJulian = Time.getJulianDay(cal.getTimeInMillis(), TimeUnit.MILLISECONDS.toSeconds(tz.getOffset(cal.getTimeInMillis()))); values.put(CalendarProvider.END, cal.getTimeInMillis()); values.put(CalendarProvider.END_DAY, endDayJulian); // Uri uri = getContentResolver().insert(CalendarProvider.CONTENT_URI, values); } I can see the calendar and the Event , but probably i've to implement some "Onclick" method for display the infomations. Anyone that are using this library that can help me? Beacuse i can't find any information about. Thank you.
has answer: http://stackoverflow.com/a/28000846
answer count: 2
accepted answer: http://stackoverflow.com/a/26144616
downvote count: 0
possible better answer: http://stackoverflow.com/a/28000846
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: java
score: 7
tagged with: calendar
upvote count: 7
has answer: http://stackoverflow.com/a/26144616

versions-maven-plugin
type: Tag
tags question: http://stackoverflow.com/q/26120704
tag name: versions-maven-plugin

network-programming
tags question: http://stackoverflow.com/q/26085225
tags question: http://stackoverflow.com/q/26150503
tags question: http://stackoverflow.com/q/26090873
tags question: http://stackoverflow.com/q/26050583
tags question: http://stackoverflow.com/q/26044060
tags question: http://stackoverflow.com/q/26185826
tags question: http://stackoverflow.com/q/26086188
tags question: http://stackoverflow.com/q/26073730
tags question: http://stackoverflow.com/q/26072926
type: Tag
tags question: http://stackoverflow.com/q/26060753
tags question: http://stackoverflow.com/q/26151174
tag name: network-programming
tags question: http://stackoverflow.com/q/26090806
tags question: http://stackoverflow.com/q/26069282
tags question: http://stackoverflow.com/q/26082535
tags question: http://stackoverflow.com/q/26094288
tags question: http://stackoverflow.com/q/26191250
tags question: http://stackoverflow.com/q/26048755

http://stackoverflow.com/comment/41032691
has text: Interesting for the data structure of "rope" but I guess that that would make append() operation (the most frequently used operation for StringBuffer) to cost more than O(1), because you might need to keep balancing the tree structure while appending.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26170216

http://stackoverflow.com/q/26187930
has title: Keeping java sockets open - how to check if new data available?
tagged with: sockets
has answer: http://stackoverflow.com/a/26188127
accepted answer: http://stackoverflow.com/a/26188127
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a simple client-server application using sockets for the communication. One possibility is to close the socket every time the client has sent something to the server. But my idea is to keep the connection always open, i.e. if a client contacts the server the connection should be put into a queue (e.g. LinkedBlockingQueue) and kept open, this would increase the performance. How can I check in the server if there is new data available in a socket in the queue? The only thing I can imagine is to constantly iterate over the whole queue and check every socket if it has new data. But this would be very inefficient because if I have several threads working on the queue, the queue gets blocked when one thread is scanning over it. Or is there a possibility to register a callback function on the socket, so that the socket informs the threads that data is ready?
has answer: http://stackoverflow.com/a/26188143
score: 0
possible better answer: http://stackoverflow.com/a/26188143
answer count: 2
has comment: http://stackoverflow.com/comment/41063121

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/26158898
type: Tag

http://stackoverflow.com/comment/40846411
score: 1
comment on: http://stackoverflow.com/q/26069315
type: Comment
type: QuestionComment
has text: [This](http://stackoverflow.com/a/11915509/230513) works for me on 10.9, Java 8. For more specific help, please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that exhibits the problem you describe.

http://stackoverflow.com/a/26076797
downvote count: 0
has body: It sounds like you are optimizing prematurely. Do you know you have a performance issue? Unless you're talking about hundreds of K, don't worry about the size of your Person object in advance. There is no practical value in hiding a few extra fields unless the size is severe - and in that case, you should extract the big fields into some sort of meaningful entity (PersonPicture or whatnot).
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26075127
score: 3

http://stackoverflow.com/a/26078066
has comment: http://stackoverflow.com/comment/40870761
score: 0
has body: You will have to use some trick to get your job done. Following are the few options: Check JBOSS_HOME/standalone/deployments folder for files with the name app.war.deployed or app.war.failed. In the server.log file in JBOSS_HOME/standalone/log folder, check for string Deployed "app.war". If the string is there, then your application is deployed else not.
type: Answer
answers question: http://stackoverflow.com/q/26075266

akka
type: Tag
tags question: http://stackoverflow.com/q/26156094
tags question: http://stackoverflow.com/q/26049110
tags question: http://stackoverflow.com/q/26054755
tag name: akka
tags question: http://stackoverflow.com/q/26107906
tags question: http://stackoverflow.com/q/26060170
tags question: http://stackoverflow.com/q/26191161
tags question: http://stackoverflow.com/q/26105784
tags question: http://stackoverflow.com/q/26149945

http://stackoverflow.com/comment/40956018
has text: `toDo` is a reference object. But `temp` (which is the sorting result) only exists within the scope of `mergeSortFreq`.
comment on: http://stackoverflow.com/a/26129992
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41056043
comment on: http://stackoverflow.com/a/26184064
score: 0
type: AnswerComment
type: Comment
has text: you need to use the fully qualified class name if you have the package defination in your class

http://stackoverflow.com/comment/40865892
has text: @Yeen: see edit. You still haven't posted the actual instructions
type: AnswerComment
comment on: http://stackoverflow.com/a/26080691
score: 0
type: Comment

http://stackoverflow.com/q/26065884
has title: Can't get any results from this SPARQL query
has comment: http://stackoverflow.com/comment/40844507
has answer: http://stackoverflow.com/a/26079958
has comment: http://stackoverflow.com/comment/40846167
has body: I've asked a question before here Generate an incremental SPARQL query and thank god I manage to solve it. Here is my solution: private String completeQuery(String coreQuery){ String completeQuery = ""; completeQuery += "SELECT * WHERE {"+ "\n"; completeQuery += coreQuery + "\n"; completeQuery =completeQuery + "}" + "\n" +"limit 5" ; return completeQuery; } public String link(String object1, String object2, int distance){ if(distance == 1){ String Quer = "&lt;http://dbpedia.org/resource/"+object1+"&gt;" + " ?pre1 " +"&lt;http://dbpedia.org/resource/"+object2+"&gt;"; return completeQuery(Quer); } else { String query = "&lt;http://dbpedia.org/resource/"+object1+"&gt;" + " ?pre1 ?obj1 " + ".\n"; for(int i = 1; i &lt; distance-1; i++){ query += "?obj" + i + " ?pre" + (i+1) + " ?obj" + (i+1) + ".\n" ; } query += "?obj" + (distance-1) + " ?pre" + distance + " " + "&lt;http://dbpedia.org/resource/"+object2+"&gt;"; return completeQuery(query); } } and from the main I just try to print the query string to figure out if it is right or not: String queryString = ""; int maxDistance =2; PathFinder pf = new PathFinder(); for (int distance = 1; distance&lt;=maxDistance ; distance ++) { System.out.println("\nQueries for distance: "+distance); queryString = pf.link("Lionel_Messi","Spanish_language",distance); System.out.println(queryString);} and the result is good so far Queries for distance1: SELECT * WHERE {&lt;http://dbpedia.org/resource/Lionel_Messi&gt; ?pre1 &lt;http://dbpedia.org/resource/Spanish_language&gt;}limit 5 Queries for distance2: SELECT * WHERE { &lt;http://dbpedia.org/resource/Lionel_Messi&gt; ?pre1 ?obj1 . ?obj1 ?pre2 &lt;http://dbpedia.org/resource/Spanish_language&gt; }limit 5 now, I'm trying to execute these queries but I don't know how to do it if it was a simple query , something like (select ?abstract where ...) the execution will be for example: QueryExecution qe = QueryExecutionFactory.sparqlService(service, query); ResultSet results = qe.execSelect(); for…
linked to: http://stackoverflow.com/q/25692646
tagged with: sparql
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40842252
tagged with: java
has comment: http://stackoverflow.com/comment/40848429
favorite count: 0
type: Question
downvote count: 2
tagged with: jena
answer count: 1
score: -1
accepted answer: http://stackoverflow.com/a/26079958
has comment: http://stackoverflow.com/comment/40842172
tagged with: dbpedia
upvote count: 1
has comment: http://stackoverflow.com/comment/40848354

http://stackoverflow.com/a/26072841
type: Answer
answers question: http://stackoverflow.com/q/26070106
score: 2
downvote count: 0
has body: The following consideration is slightly academic, however I felt that it should be pointed out: Arrays#asList will give you a "view" on the supplied array. The JavaDoc says: "Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.)". Looking at your example: String[] arrx = {"alpha", "beta", "gamma"}; Collections.reverse(Arrays.asList(arrx)); System.out.println(Arrays.toString(arrx)); // [gamma, beta, alpha] ... this means, that the original array arrx will be reversed. If you just need the reversed array, all is fine. However: If you still need the original array, create a copy before reversing: String[] arrx = {"alpha", "beta", "gamma"}; List temp = new ArrayList(Arrays.asList(arrx)); Collections.reverse(temp); Object[] reversedArrx = temp.toArray(); System.out.println(Arrays.toString(arrx)); // [alpha, beta, gamma] System.out.println(Arrays.toString(reversedArrx)); // [gamma, beta, alpha] (Generics omitted for brevity).
upvote count: 2

http://stackoverflow.com/a/41553263
answers question: http://stackoverflow.com/q/26124417
has body: The following code is an example using spark2.0. Reading is much faster than inferSchema option. Spark 2.0 convert into parquet file in much more efficient than spark1.6. import org.apache.spark.sql.types._ var df = StructType(Array(StructField("timestamp", StringType, true),StructField("site", StringType, true),StructField("requests", LongType, true) )) df = spark.read .schema(df) .option("header", "true") .option("delimiter", "\t") .csv("/user/hduser/wikipedia/pageviews-by-second-tsv") df.write.parquet("/user/hduser/wikipedia/pageviews-by-second-parquet")
type: Answer
downvote count: 0
score: 7
upvote count: 7

http://stackoverflow.com/q/26069568
has answer: http://stackoverflow.com/a/26069778
has comment: http://stackoverflow.com/comment/40845577
score: 0
answer count: 1
has title: Why fields are not initialized correctly when I invoke a base class method (this method initialize the fields) in a subclass?
type: UnansweredQuestion
has body: I have a class called SimplePolygon which has a field as array called vertices. And there is a factory method called getNewPoly that invokes SimplePolygon constructor and returns a polygon. Inside getNewPoly(), 'vertices' is initialized as a result of invoking SimplePolygon constructor. What I did is I invoked getNewPoly in a constructor of a subclass called ConvexPolygon then I created a convexPolygon object then I called the length of vertices field for convexPolygon and It gave me 0. So what's wrong ? protected int n; // number of vertices of the polygon protected Point2D.Double[] vertices; // vertices[0..n-1] around the polygon protected static Line2D.Double[] edges; protected SimplePolygon(int size) { n = size; vertices = new Point2D.Double[n]; // creates array with n size. Elements // are doubles. } /** default no-parameter constructor */ protected SimplePolygon() { vertices = new Point2D.Double[0]; } /********* public getters &amp; toString ***************/ /** * static factory method constructs and returns an unverified * simple-polygon, initialised according to user provided input data. Runs * in O(n) time. * * @return an unverified simple-polygon instance */ public static SimplePolygon getNewPoly() { Scanner fileIn = null; try { fileIn = new Scanner(new FileInputStream("vertices")); } catch (FileNotFoundException e) { System.out.println("File not found."); System.exit(0); } int size = 0; // Number of edges of the polygon. ArrayList&lt;String&gt; lines = new ArrayList&lt;String&gt;(); // Adding every line from the file in an array list. while (fileIn.hasNextLine()) { lines.add(fileIn.nextLine()); size++; } int noOfCoordinates = size * 2; Point2D.Double[] vertices = new Point2D.Double[size]; ArrayList&lt;java.lang.Double&gt; coordinates = new ArrayList&lt;java.lang.Double&gt;(); ArrayList&lt;Point2D.Double&gt; points = new ArrayList&lt;Point2D.Double&gt;(); // Make every line a string tokenizer then split the string tokenizer // into two tokens then converti…
has comment: http://stackoverflow.com/comment/40845443
has comment: http://stackoverflow.com/comment/40845426
tagged with: java
type: Question

http://stackoverflow.com/q/26180094
has comment: http://stackoverflow.com/comment/41048262
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/41047864
has comment: http://stackoverflow.com/comment/41047692
tagged with: java
has comment: http://stackoverflow.com/comment/41048395
has comment: http://stackoverflow.com/comment/41048320
has comment: http://stackoverflow.com/comment/41048106
has comment: http://stackoverflow.com/comment/41048305
has comment: http://stackoverflow.com/comment/41047750
has answer: http://stackoverflow.com/a/26181179
has body: From a given string, am trying to replace a pattern such as "sometext.othertext.lasttext" with "lasttext". Is this possible in Java with Regex replace? If yes, how? Thanks in advance. I tried "hellow.world".replaceAll("(.*)\\.(.*)", "$2") which results in world. But, I want to replace any such arbitrary sequence. For instance com.google.code should be replace with code and com.facebook should be replaced with facebook. Just to add, a test input is: if (com.google.code) then and the test output should be: if (code) then Thanks.
type: AnsweredQuestion
upvote count: 0
has title: Use regex to replace a specific pattern
has answer: http://stackoverflow.com/a/26180655
favorite count: 0
has comment: http://stackoverflow.com/comment/41048845
has comment: http://stackoverflow.com/comment/41048009
type: Question
possible better answer: http://stackoverflow.com/a/26180655
has comment: http://stackoverflow.com/comment/41048966
has comment: http://stackoverflow.com/comment/41048448
score: -2
tagged with: regex
accepted answer: http://stackoverflow.com/a/26181179
has comment: http://stackoverflow.com/comment/41048471

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26128041
tags question: http://stackoverflow.com/q/26088153
tags question: http://stackoverflow.com/q/26072571
type: Tag
tags question: http://stackoverflow.com/q/26175326
tags question: http://stackoverflow.com/q/26133918

http://stackoverflow.com/a/26068733
has comment: http://stackoverflow.com/comment/40847781
has comment: http://stackoverflow.com/comment/40847836
accepted answer of: http://stackoverflow.com/q/26068660
has comment: http://stackoverflow.com/comment/40847920
has comment: http://stackoverflow.com/comment/40847865
downvote count: 0
score: 4
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40847738
answers question: http://stackoverflow.com/q/26068660
has comment: http://stackoverflow.com/comment/40847881
type: Answer
has body: This line doesn't make much sense: String[] list = new String[R.array.championlist]; R.array.championlist is an integer that points to the what I assume is a string array resource. You can load that string array with Resources.getStringArray(int). String[] list = resources.getStringArray(R.array.championlist);

webview
tags question: http://stackoverflow.com/q/26086468
tag name: webview
tags question: http://stackoverflow.com/q/26113057
tags question: http://stackoverflow.com/q/26173557
type: Tag
tags question: http://stackoverflow.com/q/26037881
tags question: http://stackoverflow.com/q/26039753

http://stackoverflow.com/q/26095711
score: 2
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40900037
tagged with: selenium
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40918469
favorite count: 0
has body: I am using selenium-server-standalone-2.43.1 version Below is the code i tried DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setJavascriptEnabled(true); capabilities.setBrowserName(browserType); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); URL url = new URL("http://" + remoteIP + ":"+ port + "/wd/hub"); RemoteWebDriver driver = new RemoteWebDriver(url, capabilities); And this is the error I am facing: java.lang.NoSuchFieldError: INSTANCE Can someone help me please?
type: UnansweredQuestion
has title: Failing to start selenium webdriver with the error "java.lang.NoSuchFieldError: INSTANCE"

http://stackoverflow.com/comment/40899770
comment on: http://stackoverflow.com/q/26099535
score: 0
type: Comment
type: QuestionComment
has text: This really depends on the amount of data and the type of client.

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/26154397
tags question: http://stackoverflow.com/q/26067298
tags question: http://stackoverflow.com/q/26182857
type: Tag
tags question: http://stackoverflow.com/q/26113441

http://stackoverflow.com/comment/41022175
comment on: http://stackoverflow.com/q/26166091
type: Comment
type: QuestionComment
has text: The next reference is `null` which is another way of saying not a value.
score: 1

http://stackoverflow.com/comment/41035766
type: QuestionComment
comment on: http://stackoverflow.com/q/26173413
has text: @Tirath I did the same of your suggestion, but I still cannot get getOdometer()'s value
score: 0
type: Comment

http://stackoverflow.com/a/26074404
score: 0
type: Answer
has body: 7 years later, I stumbled upon ExecutorService.invokeAny, which does exactly what I want: Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do (before the given timeout elapses). Upon normal or exceptional return, tasks that have not completed are cancelled. &lt;T&gt; T invokeAny(Collection&lt;? extends Callable&lt;T&gt;&gt; tasks) throws InterruptedException, ExecutionException; &lt;T&gt; T invokeAny(Collection&lt;? extends Callable&lt;T&gt;&gt; tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException; Implementation sketch: class LabyrinthGenerator implements Callable&lt;Labyrinth&gt; { private static final int N = 16; private static final ExecutorService pool = Executors.newFixedThreadPool(N); public static Labyrinth generate() { while (true) { List&lt;LabyrinthGenerator&gt; generators = Stream.generate(LabyrinthGenerator::new) .limit(N) .collect(Collectors.toList()); try { return pool.invokeAny(generators, 1, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { // all attempts failed or timed out, try again } } } @Override public Labyrinth call() throws Exception { // ... if (Thread.currentThread().isInterrupted()) { // some other generator found a result, abort } // ... } }
has comment: http://stackoverflow.com/comment/40853670
accepted answer of: http://stackoverflow.com/q/26074182
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26074182

http://stackoverflow.com/a/35251769
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26107340
has body: I have only one general remark, and that's not to use Java primitive Arrays. Save yourself a lot of trouble and use ArrayList. That way you can simply remove an element at an index, there's no need then to manually manage elements in a primitive array. Without a clear exception trace and a code snippet that shows how things are displayed I'm just speculating, but when you delete an item you shift everything manually and append a null value at the end of the array. When your array is then displayed you are most likely hitting a NullPointerException when dereferencing a null object. In general you should only rarely have the need for primitive arrays. Use an ArrayList instead and delete items using its remove method.

http://stackoverflow.com/comment/40948457
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26126353
has text: stacktrace or gtfo ;D

http://stackoverflow.com/q/26124372
has comment: http://stackoverflow.com/comment/40944894
has comment: http://stackoverflow.com/comment/40944812
score: 0
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/76262164
has title: Spring SimpleJdbcCall returns wrong value
has comment: http://stackoverflow.com/comment/40945363
has answer: http://stackoverflow.com/a/62480795
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40945484
type: Question
has comment: http://stackoverflow.com/comment/40944736
has answer: http://stackoverflow.com/a/26124679
has comment: http://stackoverflow.com/comment/40945435
has comment: http://stackoverflow.com/comment/40945172
tagged with: spring-jdbc
has body: I call a stored procedure using SimpleJdbcCall. public Map&lt;String, Object&gt; callStoredProcedure(SimpleJdbcCall jdbcCall, String procedureName, Map&lt;String, Object&gt; inParamMap) { log.info("Calling stored procedure with name : " + procedureName); SqlParameterSource in = new MapSqlParameterSource(inParamMap); Map&lt;String, Object&gt; out = jdbcCall.withProcedureName(procedureName).execute(in); return out; } Its result output is Key = #result-set-1, Value = [{=17.00}] I confused that when I get the class type of Value like this. Class class1 = entry.getValue().getClass(); My sp returns 17.00 when I execute on database but I got =17.00 in jdbcCall code. Any comment would be helpful.
tagged with: spring
has answer: http://stackoverflow.com/a/53505507
has comment: http://stackoverflow.com/comment/40945304
has answer: http://stackoverflow.com/a/26124891

http://stackoverflow.com/comment/50441707
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31219539
has text: Is it necessary to use STOMP to use these events? Currently I am just using a "raw" websocket.
score: 1

http://stackoverflow.com/a/26149317
upvote count: 1
has body: Any time you are looking to do fixed-interval opetations in Java you should be investigating the ScheduledExecutorService. In your case, something like: private static final ScheduledExecutorService SERVICE = Executors.newScheduledThreadPool(1, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread("Tick Thread", r); t.setDaemon(true); return t; } }); private static final AtomicReference&lt;Controller&gt; CONTROLLER = new AtomicReference&lt;&gt;(); public static final void setController(Controller c) { CONTROLLER.compareAndSet(null, c); } static { Runnable task = new Runnable() { public void run() { //do something each second.... // call the 'update()' method: Controller c = CONTROLLER.get(); if (c != null) { c.update(); } } } // delay 1 second, repeat each second. service.scheduleAtFixedRate(task, 1, 1, TimeUnit.SECONDS); } You can take that, and put it in a Static initializer of the class, and you will get the system started the moment the class is loaded.... You will likely want the thread on the ExecutorService to be a Daemon thead... so you need a custom thread factory..... The above code will start immediately, and will update the Controller, if there is one, every second. The moment you create c controller, you can set the value using the static method.
type: Answer
answers question: http://stackoverflow.com/q/26149061
has comment: http://stackoverflow.com/comment/40991240
has comment: http://stackoverflow.com/comment/40990989
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40991028
has comment: http://stackoverflow.com/comment/40991110

http://stackoverflow.com/comment/41036808
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26173289
has text: By "integration testing" I assume you mean end-to-end with all the bells and whistles (including database access and the likes)?

http://stackoverflow.com/q/26189137
has title: Creating class-wide arrays in Java
tagged with: java
has answer: http://stackoverflow.com/a/26189266
accepted answer: http://stackoverflow.com/a/26189266
type: Question
answer count: 1
score: 0
has body: When filling in the values for a class-wide (static) data structure/collection (in this case a 2D array), is it generally better to save the values directly into the static one, or should a temporary variable be created in the method? To make it more clear: public class MyClass{ private static int[][] table; public void setTable(int row, int col){ table = new char[row][col]; // fill table (eg. table[i][j] = 5;) } //// OR THIS////// public void setTable(int row, int col){ int[][] tempTable = new tempTable[row][col]; // fill tempTable table = tempTable; } } Creating a temporary variable feels redundant and useless here. But are there cases where this would be advised? Possibility of program crashing halfway through execution of method and corrupting data? Multi-threaded applications? I hope the question isn't subjective, just want to know if there is inherently something wrong with just filling it in directly.
has comment: http://stackoverflow.com/comment/41065269
type: AnsweredQuestion

http://stackoverflow.com/q/26125723
favorite count: 0
tagged with: atomic
tagged with: multithreading
has body: I have a code from which I am trying to get the instance of my class as I have written a wrapper around java.util.logging.Logger. Below is the snippet of code in my ClientLogger class - private static final Map&lt;Class&lt;?&gt;, ClientLogger&gt; s_classLoggers = new ConcurrentHashMap&lt;Class&lt;?&gt;, ClientLogger&gt;(); final private Logger m_logger; private ClientLogger(final Class&lt;?&gt; caller) { m_logger = Logger.getInstance(caller); } public static ClientLogger getInstance(final Class&lt;?&gt; klass) { final ClientLogger result; if (s_classLoggers.containsKey(klass)) { result = s_classLoggers.get(klass); } else { result = new ClientLogger(klass); s_classLoggers.put(klass, result); } return result; } And this is the way I am initializing it in my other classes where I need to use my above logger - private static final ClientLogger s_logger = ClientLogger.getInstance(TestLogger.class); Now when I am running my static analysis tool, it is complaining as in my ClientLogger class - Non-atomic use of check/put on this line s_classLoggers.put(klass, result); So I modified my above code like this to make it thread safe - private static final ConcurrentHashMap&lt;Class&lt;?&gt;, ClientLogger&gt; s_classLoggers = new ConcurrentHashMap&lt;Class&lt;?&gt;, ClientLogger&gt;(); public static ClientLogger getInstance(final Class&lt;?&gt; klass) { ClientLogger result; result = s_classLoggers.putIfAbsent(klass, new ClientLogger(klass)); // is below line thread safe and efficient? if (result == null) { result = new ClientLogger(klass); } return result; } Below is the way I will be initializing it to get my logger instance - private static final ClientLogger s_logger = ClientLogger.getInstance(TestLogger.class); So is my above code thread safe? I am doing result == null check since for the first time, it won't be there in the map so I need to make a new value of it and because of that, I need to remove the final modifier of result.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40947777
has comment: http://stackoverflow.com/comment/40947627
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26126046
has comment: http://stackoverflow.com/comment/40947415
linked to: http://stackoverflow.com/q/11126866
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/26126046
tagged with: static-analysis
has comment: http://stackoverflow.com/comment/40947667
has title: How to remove Non-atomic use of check/put and make the code thread safe?
has comment: http://stackoverflow.com/comment/40947883
has comment: http://stackoverflow.com/comment/40947317
answer count: 1

http://stackoverflow.com/comment/41018978
score: 0
type: AnswerComment
has text: Yes it took more time however when I change 'Integer' to 'int' it is returning fast. Sorry I thought it is blocking.
type: Comment
comment on: http://stackoverflow.com/a/26164431

http://stackoverflow.com/comment/41007842
has text: I don't see how using StringBuilder will fit to this problem?
comment on: http://stackoverflow.com/a/26158620
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26059712
has answer: http://stackoverflow.com/a/26059900
possible better answer: http://stackoverflow.com/a/30303365
tagged with: robocode
type: AnsweredQuestion
has title: How can I set alpha color on Robocode?
tagged with: java
accepted answer: http://stackoverflow.com/a/26059900
type: Question
has body: I built a robot in Robocode and I want it to have custom colors, more specifically using RGBA. Is that possible? I tried: setBodyColor(Color.fromArgb(150, 0, 150)); setBodyColor(Color(0.0f,0.0f,0.0f,0.0f)); But neither worked. Any suggestions?
score: 0
answer count: 2
tagged with: colors
has answer: http://stackoverflow.com/a/30303365

http://stackoverflow.com/comment/41013333
comment on: http://stackoverflow.com/a/26150262
type: Comment
has text: Both equally good answers but in my situation I picked this approach and marked it as the accepted answer. :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/26133518
type: Answer
accepted answer of: http://stackoverflow.com/q/26133413
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: The problem is that the interface requires a method that accepts anything as an argument that is a subtype of ILocation, not just an object of the specific type Location. If you had another concrete type Position that was a subtype of ILocation, then implementing the interface would require you to accept a Position object as well as a Location object. Note that in your work-around using a cast, you'd get a ClassCastException at run time if you happened to pass a Position instead of a Location object. As a design issue, to get around this you could define your interface as a generic: interface &lt;T extends ILocation&gt; TheInterface { void setGoalLocation(T loc); } Then your concrete class can bound the generic parameter: public class MyClass implements TheInterface&lt;Location&gt; { public void setGoalLocation(Location loc) { . . . } } As to return types, that works because any Location object is an ILocation, so when you return a Location you are returning an ILocation.
answers question: http://stackoverflow.com/q/26133413

http://stackoverflow.com/a/26066523
has body: You need to talk between applications as if you were talking between two distant applications. It does not matter that they are on the same server they simply must communicate using some protocol. What you want to do is actually RMI (remote method invokation) - http://docs.oracle.com/javase/tutorial/rmi/ Instead of using rmi you can use some more lightweight way of communication. You can communicate via Rest for example. In this case create servlet in webAppMaster application which takes as parameters your customObject1 serialized to JSON (either as URL request params or use POST method). Than this servlet will do the translation of JSON string to customObject1 and call processRequest. Later after processRequest() returns customObject2 translate it to JSON and send back to client. On client side read the json and deserialize JSON back to customObject2 in webappSlave. public class MasterServlet extends javax.servlet.http.HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CustomObject1 customObject1 = buildCustomObject1BasingOnRequestParams(HttpServletRequest request); // read the request params and build your object either from json or whatever format webappSlave used to send CustomObject2 customObject2 = RequestHandler.processRequest(customObject1); String json = transformTOJson(customObject2); // there are many libaries which does this response.getWriter().print(json); } } Your slave app would do the other way around. First serialize customObject1 to JSON, and later deserialize received JSON to customObjec2. As a third option you can use HTTP tunneling to send objects between applications (reffer for example to this post: Serializing over HTTP correct way to convert object.) as an example.
upvote count: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40848351
score: 5
has comment: http://stackoverflow.com/comment/40849954
answers question: http://stackoverflow.com/q/26065917

http://stackoverflow.com/comment/41017739
type: QuestionComment
has text: edited my question to add the complex type
comment on: http://stackoverflow.com/q/26158956
score: 0
type: Comment

http://stackoverflow.com/comment/40969630
has text: You could do something like [this](http://www.objectpartners.com/2013/04/04/improving-the-gwt-async-callback/).
score: 0
comment on: http://stackoverflow.com/q/26137995
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26258459
score: 1
answers question: http://stackoverflow.com/q/26185066
upvote count: 1
downvote count: 0
has body: This resolved the problem: com.fasterxml.jackson.core jackson-databind 2.3.3 The error was not straight forward. It was giving 406 and complaining about accept headers. Based on Dave Syer's suggestion that it could be related to dependency issue, I started looking at jackson dependencies.
type: Answer

http://stackoverflow.com/q/26118793
has body: I need to do something like this: while(prot.getProcessedTranscriptPositionFromAA(start) == null) start++; But because prot throws NullPointerException I cannot loop like this. How can I create a loop that catches the NullPointerException, increments start, and executes getProcessedTranscriptPositionFromAA again ,and so on, until getProcessedTranscriptPositionFromAA will not throw NullPointerException ("it's ok" that the loop have the possibility to be infinite). I never used goto and I don't even know how to use is, but will something like this will work somehow?: *here* try{ prot.getProcessedTranscriptPositionFromAA(start); } catch (NullPointerException e){ start++; goto *here* }
has answer: http://stackoverflow.com/a/26119352
has answer: http://stackoverflow.com/a/26118840
tagged with: goto
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40934151
type: Question
linked to: http://stackoverflow.com/q/271526
has title: Loop with repeated exception catching
score: 0
tagged with: loops
has answer: http://stackoverflow.com/a/26119454
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26118927
answer count: 4

http://stackoverflow.com/q/26118602
favorite count: 0
accepted answer: http://stackoverflow.com/a/26119073
type: Question
tagged with: jdbc
upvote count: 2
tagged with: spring
has body: I've got a method which returns me a ResultSet object: @Repository public class SomeDAOImpl implements SomeDAO{ @Override public ResultSet getSomething() { ... } } And this is how I call that: @Service public class SomeServiceImpl implements SomeService{ @Autowired private SomeDAO someDAO; @Transactional @Override public void doSomething() { someDAO.getSomething(); ... } } Questions: Do I have to close ResultSet? Is it ok to return ResultSet object?
answer count: 1
has title: ResultSet in Transaction
has answer: http://stackoverflow.com/a/26119073
tagged with: java
tagged with: hibernate
score: 2
has comment: http://stackoverflow.com/comment/40933688
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40871000
has text: @SergeBallesta Unfo. this is not the reason of the problem !
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26082435
score: 0

http://stackoverflow.com/q/26061971
has answer: http://stackoverflow.com/a/26062046
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40831370
has comment: http://stackoverflow.com/comment/40831141
has title: Printwriter to write into a file
has comment: http://stackoverflow.com/comment/40831163
accepted answer: http://stackoverflow.com/a/26062046
type: AnsweredQuestion
has body: Why can't I write a big amount of data via PrintWriter? String result = acquireLengthyData(); PrintWriter out = new PrintWriter("D:/log.txt"); out.println(result); where result.lenght() = 189718. But some data were missing in log.txt. Why? How can I write to the file correctly?
tagged with: java
has answer: http://stackoverflow.com/a/26062027
has comment: http://stackoverflow.com/comment/40831361
type: Question
possible better answer: http://stackoverflow.com/a/26062027
has comment: http://stackoverflow.com/comment/40831173
has comment: http://stackoverflow.com/comment/40831270

http://stackoverflow.com/comment/40993649
comment on: http://stackoverflow.com/q/26150710
type: Comment
type: QuestionComment
has text: Just as a side note, that code is horribly bad for several reasons. Probably the worst is the volume method (that takes parameters, with names that are identical to existing instance variables, and doesn't return anything but sets an instance variable)??? Did you copy that example from some tutorial? If so, do yourself a big favor and find another tutorial.
score: 5

http://stackoverflow.com/comment/40929208
score: 0
type: Comment
type: QuestionComment
has text: You can't create an instance of an `abstract class` now, so I am now sure what you expect adding `static` would do differently, or what you are trying to do differently.
comment on: http://stackoverflow.com/q/26115766

http://stackoverflow.com/a/26055906
has body: One way you can do this another framework that do that for desktop GUI application is by using Sikuli. Since it uses image recognition technology can be used across all desktop applications, also can be driven by multiple languages and its free. Just to be full this answer, I'll add that you can combine it with Cucumber and Jenkins like is shown here. Update export scripts to Java is not possible in this sense, since Sikuli scripts are written in Python scripting language and the scripts itself are run using the Jython interpreter (Java base implementation of Python language). See this answer and this answer. Look at these resources how-to: how-to-write-java-program-in-sikuli sikuli-java-insertion-dev use SikuliX API in your JAVA programs
downvote count: 0
has comment: http://stackoverflow.com/comment/109456033
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26055420
accepted answer of: http://stackoverflow.com/q/26055420
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/40819750

http://stackoverflow.com/a/26169693
score: 1
answers question: http://stackoverflow.com/q/26168696
type: AcceptedAnswer
downvote count: 0
has body: This seems due to the wrapper batch script that executes the groovyc executable. On Windows, the groovyc command will start a batch script called startGroovy.bat: "%DIRNAME%\startGroovy.bat" "%DIRNAME%" org.codehaus.groovy.tools.FileSystemCompiler %* I'm no expert in batch files but If you take a close look at startGroovy.bat, you can easily notice that there is some kind of a hack that is being done on the * wildcard that is passed as an argument to the script (e.g. c:\scripts\*.groovy): rem escape minus (-d), quotes (-q), star (-s). set _ARGS=%* if not defined _ARGS goto execute set _ARGS=%_ARGS:-=-d% set _ARGS=%_ARGS:"=-q% rem Windowz will try to match * with files so we escape it here rem but it is also a meta char for env var string substitution rem so it can't be first char here, hack just for common cases. rem If in doubt use a space or bracket before * if using -e. set _ARGS=%_ARGS: *= -s% set _ARGS=%_ARGS:)*=)-s% set _ARGS=%_ARGS:0*=0-s% set _ARGS=%_ARGS:1*=1-s% set _ARGS=%_ARGS:2*=2-s% set _ARGS=%_ARGS:3*=3-s% set _ARGS=%_ARGS:4*=4-s% set _ARGS=%_ARGS:5*=5-s% set _ARGS=%_ARGS:6*=6-s% set _ARGS=%_ARGS:7*=7-s% set _ARGS=%_ARGS:8*=8-s% set _ARGS=%_ARGS:9*=9-s% If you turn echoing on by executing set DEBUG=on in the command line, and then execute the groovyc command again, you will obtain the output of the batch script where you can see how the wildcard is being processed. Below is a sample log with a scenario where we have 3 files named File1.groovy, File2.groovy and File3.groovy. groovyc -d c:\destPath c:\scripts\*.groovy Sample output: C:\scripts&gt;set _ARG=C:\scripts\File3.groovy C:\scripts&gt;set _ARG=C:\scripts\File3.groovy C:\scripts&gt;set _ARG=C:\scripts\File3.groovy C:\scripts&gt;set CMD_LINE_ARGS= C:\scripts\File3.groovy C:\scripts&gt;set _ARG= It seems the script is ignoring the first two files and eventually only the last one is passed to the org.codehaus.groovy.tools.FileSystemCompiler class (the actual compiler). This behavior does not exist wh…
has comment: http://stackoverflow.com/comment/41242201
type: Answer
accepted answer of: http://stackoverflow.com/q/26168696
upvote count: 1

http://stackoverflow.com/q/26141312
answer count: 2
has answer: http://stackoverflow.com/a/26141373
tagged with: sql
possible better answer: http://stackoverflow.com/a/26141373
has comment: http://stackoverflow.com/comment/40977022
has comment: http://stackoverflow.com/comment/40975630
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41107223
has answer: http://stackoverflow.com/a/26141369
accepted answer: http://stackoverflow.com/a/26141369
has body: Im trying to create an SQL Statement that will differentiate between employees types. For example if the Boolean Type Manager Column is checked it will return. Im using the info to fill a Manager on Duty JCombo in Java. Im trying String sql = "SELECT Employees.Name FROM Employees WHERE Manager = 'true' ORDER BY Name ASC"; Cant seem to get it right.
type: Question
has title: SQL - Return row if Boolean is True
tagged with: java
has comment: http://stackoverflow.com/comment/40975622
has comment: http://stackoverflow.com/comment/40975613
tagged with: boolean
score: 0

http://stackoverflow.com/comment/41199993
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26222122
has text: :) you stole thoughts from my mind (for that all credits will go to you), i was going to do that but i was trying to work with `TextArea`. In a swing app i designed two years ago i used `JList` to represent Lengthy data. And by Large scale apps mean app i'm developing is a parallel computing framework which i think is pretty large when considering multiple threads running here and there and multiple machines communicating with each other. The problem i'm facing is real time representation of data graphically. Javafx takes a lot of time to reflect change on GUI.

http://stackoverflow.com/a/26075555
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40855988
has comment: http://stackoverflow.com/comment/40856224
upvote count: 1
downvote count: 0
has body: Leap Year That code is adjusting for Leap Year. The Earth's orbit around the Sun (a year) and Earth's rotation on its axis (a day) are not synchronized. So we must adjustments to the date so as to keep our daily calendar correct. That adjustment is close to a quarter day but not quite. So every four years we add a day except every few centuries we don't except for every so often we do. Algorithm From the Wikipedia article… if (year is not divisible by 4) then (it is a common year) else if (year is not divisible by 100) then (it is a leap year) else if (year is not divisible by 400) then (it is a common year) else (it is a leap year) Use Date-Time Library Instead of rolling your own code, I strongly suggest you use a date-time library. For Java that means either Joda-Time or the java.time package in Java 8 (inspired by Joda-Time, defined by JSR 310). Avoid using the old java.util.Date and .Calendar classes bundled with Java as they are notoriously troublesome with flaws in both design and implementation.
answers question: http://stackoverflow.com/q/26071456

http://stackoverflow.com/a/26174626
type: Answer
has comment: http://stackoverflow.com/comment/41038219
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41038182
has body: You need to use @RequestParam even if it is a composite Java object. So change this public String login(@Form User form) to public String login(@RequestParam("form") User form) You just need to send user details under "form" param from client.
answers question: http://stackoverflow.com/q/26174572
has comment: http://stackoverflow.com/comment/41037982
upvote count: 1
has comment: http://stackoverflow.com/comment/41038032

http://stackoverflow.com/a/26070561
answers question: http://stackoverflow.com/q/26070484
score: 0
has body: You may want to try first checking if currentNode == null before trying to dereference 'currentNode' on line 7 (it seems), this line -> int maxVal = currentNode.freq; Otherwise you are trying to dereference a null pointer which is was is liking throwing that nullPointerException The same applies to 'nextNode'
type: Answer

http://stackoverflow.com/comment/40956035
type: QuestionComment
score: 0
has text: @AleksandrM Im using struts 2 and tiles plugin for struts 2. Dosent the struts2 StrutsPrepareAndExecuteFilter do the same thing as tilesservlet?
comment on: http://stackoverflow.com/q/26127355
type: Comment

http://stackoverflow.com/q/26115937
tagged with: ldap
score: 0
has title: SSPR - Access PWM from my SOAP API
answer count: 1
tagged with: soap
tagged with: passwords
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26159347
has body: PWM (Password Management) : https://code.google.com/p/pwm/ I've downloaded war file from the above link and its running on my local tomcat server. I've a Java SOAP API which create a user directly in E-directory. Now we want to change the logic of this API. We want the API will just send all user attribute and value to PWM and PWM will create user on Edirectory. I'm new to PWM, so I don't know how I can access PWM application from my SOAP API and pass those value to PWM. Can anyone please guide on that matter? Thanks in advance.
accepted answer: http://stackoverflow.com/a/26159347

http://stackoverflow.com/q/26044015
has body: Running Netcool 7.3.1. Looking for simple api to access Object Server Tables. I've already done the run an SQL command from nco_sql, and scraped the output into a C# data table, but wondering if there was some type of api that I could use for either C# or Java to access table data?
has answer: http://stackoverflow.com/a/42004832
has answer: http://stackoverflow.com/a/28808641
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: tivoli
tagged with: java
answer count: 3
has title: Netcool Object Server api
downvote count: 0
has answer: http://stackoverflow.com/a/27576601
type: UnansweredQuestion

jpanel
tags question: http://stackoverflow.com/q/26108351
tags question: http://stackoverflow.com/q/26099338
tags question: http://stackoverflow.com/q/26049313
tags question: http://stackoverflow.com/q/26193256
tags question: http://stackoverflow.com/q/26083646
tags question: http://stackoverflow.com/q/26171201
tags question: http://stackoverflow.com/q/26034298
tags question: http://stackoverflow.com/q/26174832
tags question: http://stackoverflow.com/q/26055187
type: Tag
tags question: http://stackoverflow.com/q/26086783
tags question: http://stackoverflow.com/q/26080696
tags question: http://stackoverflow.com/q/26150066
tags question: http://stackoverflow.com/q/26066032
tags question: http://stackoverflow.com/q/26068941
tags question: http://stackoverflow.com/q/26190668
tags question: http://stackoverflow.com/q/26074225
tags question: http://stackoverflow.com/q/26154535
tags question: http://stackoverflow.com/q/26078983
tags question: http://stackoverflow.com/q/26087536
tag name: jpanel
tags question: http://stackoverflow.com/q/26170974
tags question: http://stackoverflow.com/q/26160408
tags question: http://stackoverflow.com/q/26126786
tags question: http://stackoverflow.com/q/26183482
tags question: http://stackoverflow.com/q/26083904

google-cloud-endpoints
tags question: http://stackoverflow.com/q/26080185
tags question: http://stackoverflow.com/q/26174798
type: Tag
tag name: google-cloud-endpoints
tags question: http://stackoverflow.com/q/26136058
tags question: http://stackoverflow.com/q/26118845

http://stackoverflow.com/comment/40943455
type: QuestionComment
has text: @kolossus [closing](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#close()) already flushes.
comment on: http://stackoverflow.com/q/26123594
score: 0
type: Comment

http://stackoverflow.com/a/28946528
score: 0
has body: You have Java, that means you can use the JDBC drivers to talk to MySQL. And you have Cobol, which integrates well with Java on the mainframe these days. You can write a Cobol object that will invoke the various methods in the JDBC driver. You can wrap that in a procedural (or set of procedural) Cobol program(s) to trigger a stored procedure or prepared query and return results. So a possible software stack might look like: Existing Application (Cobol) Procedureal Interface Module (Cobol) Cobol-To-Java interace (OO-Cobol) JDBC Driver for MySql (prepackaged JAR, Java) MySQL database
type: Answer
answers question: http://stackoverflow.com/q/26034749

http://stackoverflow.com/comment/40993513
has text: So what's the output of the code? I mean exactly what are you seeing?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26150710

http://stackoverflow.com/q/26088400
downvote count: 3
has answer: http://stackoverflow.com/a/26088431
accepted answer: http://stackoverflow.com/a/26088431
possible better answer: http://stackoverflow.com/a/26088661
has answer: http://stackoverflow.com/a/26088661
tagged with: static-methods
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40879608
favorite count: 0
has title: Getting "cannot find symbol" error while using static methods
has body: I have really simple code, I have deleted odd code. So this my class, one of his method is static and I would like to use it later in Main class: public class TradeInformationReader { private static String tradeType = "FX_SPOT"; public static double tradePrice = -1; private double price; public static int setTradeInformation(String path_to_file) { return 1; } } And here how I trying to call this last method: public class Main { public static int main(String[] args) { String path_to_file = "D:\\1.txt"; if (0 &gt; TradeInformationReader.setTradeInformation(path_to_file)) { return -1; } return 1; } } I read many posts with a similar issue, but couldn't find a solution. Everything looks fine to me. IDE doesn't show any mistakes and I'm trying just to call static method setTradeInformation, why it does not recognize it (cannot find symbol method setTradeInformation)? Any ideas? I will really appreciate your help.
type: Question
has comment: http://stackoverflow.com/comment/40879597
answer count: 2
has comment: http://stackoverflow.com/comment/40879685
upvote count: 3
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40879628
has comment: http://stackoverflow.com/comment/40879629

http://stackoverflow.com/a/26085150
has body: Call repaint(), it will paint it again.
score: 4
answers question: http://stackoverflow.com/q/26085124
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/26145018
type: Question
has comment: http://stackoverflow.com/comment/40983014
has answer: http://stackoverflow.com/a/26145977
score: -1
answer count: 1
has body: i want to create an application using inbuilt java package's which should support me in speech recognition ("Actually Thinking to develop app like in movie "her" which talks to human as and give response with AI")
has title: package introduction for using speech recognition in java
favorite count: 0
has comment: http://stackoverflow.com/comment/40982778
accepted answer: http://stackoverflow.com/a/26145977
has comment: http://stackoverflow.com/comment/40982823
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1

http://stackoverflow.com/q/26066622
type: Question
possible better answer: http://stackoverflow.com/a/26068000
tagged with: java
has comment: http://stackoverflow.com/comment/40840135
accepted answer: http://stackoverflow.com/a/26066711
tagged with: int
score: 0
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/40843840
has comment: http://stackoverflow.com/comment/40840971
has title: I need to make Scanner check to see if input is "quit", and then if it's not, accept an integer
type: AnsweredQuestion
has body: I'm trying to write a program that gets an integer from the user, but also ends the program if the user enters "quit". When I run the program, it works when I enter "quit", but when I start entering an integer, I get a blank line. If I enter the integer the second time, it works. I have tried several suggestions that I have found for similar problems - including try/catch, parsing the input to Integer, and firing a blank Scanner#nextLine or Scanner#nextInt (and going back and forth between all of these options). Here is an example of my latest attempt. Any insight would be appreciated. int colInput; System.out.println(", please pick a column in which to place your token (1-8)."); System.out.println("(Type 'quit' to exit the game or 'restart' to start over.)"); System.out.print("Column Choice: "); Scanner selectCol = new Scanner (System.in); try { if (selectCol.next().equals("quit")) Connect4.close(); } finally { colInput = selectCol.nextInt(); }
has answer: http://stackoverflow.com/a/26066711
has answer: http://stackoverflow.com/a/26068000

http://stackoverflow.com/a/26096808
type: Answer
has comment: http://stackoverflow.com/comment/40895197
has comment: http://stackoverflow.com/comment/40895476
has comment: http://stackoverflow.com/comment/40895178
has comment: http://stackoverflow.com/comment/40895301
has body: From Java doc. Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string. So it will take 12/31/2014 only from 12/31/2014XYZ and take as valid format. Eg: SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); try { java.util.Date date=sdf.parse("12/31/2014AnyThing"); System.out.println("Valid Date "+date); } catch (ParseException e) { System.out.println("Invalid Date"); } try { java.util.Date date=sdf.parse("AnyThing12/31/2014"); System.out.println("Valid Date "+date); } catch (ParseException e) { System.out.println("Invalid Date"); } Out put: Valid Date Wed Dec 31 00:00:00 IST 2014 Invalid Date Same as here. SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); try { java.util.Date date=sdf.parse("12/31/2014XYZ"); System.out.println("Valid Date "+date); } catch (ParseException e) { System.out.println("Invalid Date"); } try { java.util.Date date=sdf.parse("XYZ12/31/2014"); System.out.println("Valid Date "+date); } catch (ParseException e) { System.out.println("Invalid Date"); } Out put: Valid Date Wed Dec 31 00:00:00 IST 2014 Invalid Date Edit: @aioobe answer will provide the solution for not take this as valid date format.
has comment: http://stackoverflow.com/comment/40895276
answers question: http://stackoverflow.com/q/26096618
has comment: http://stackoverflow.com/comment/40895320
score: 0
has comment: http://stackoverflow.com/comment/40895257
has comment: http://stackoverflow.com/comment/40895155
has comment: http://stackoverflow.com/comment/40895043
has comment: http://stackoverflow.com/comment/40895506
has comment: http://stackoverflow.com/comment/40895605

http://stackoverflow.com/comment/41043077
has text: Yes, there is no global configuration to the Regex API---which, of course, is a very *good* thing.
type: QuestionComment
comment on: http://stackoverflow.com/q/26176992
type: Comment
score: 3

http://stackoverflow.com/q/26180592
has answer: http://stackoverflow.com/a/26180955
has comment: http://stackoverflow.com/comment/41049276
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/41048885
has comment: http://stackoverflow.com/comment/41048720
has answer: http://stackoverflow.com/a/26180878
has answer: http://stackoverflow.com/a/26180652
accepted answer: http://stackoverflow.com/a/26180878
has comment: http://stackoverflow.com/comment/41048724
has answer: http://stackoverflow.com/a/50016161
tagged with: arraylist
has body: I know that you get it by calling the iterator() method on the ArrayList that you created, but what does that method look like? Since Iterator is only an interface defined in Java, I am not sure how the ArrayList passes back a concrete implementation of the Iterator? I know how to implement these myself for my own classes...I want to know how Java's ArrayList does it...maybe there is a concrete Iterator Class in the standard Library I don't know about?
score: 0
possible better answer: http://stackoverflow.com/a/26180955
answer count: 4
has title: How does the Java class ArrayList return an Iterator Object?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26047125
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: If this is a geometric segment, then it ought to be defined in terms of two Points (a line segment) or two Points and a radius (circular segment), or something along those lines. In that case, it should have some private fields that store the Point data. Translating the whole segment just means translating each Point in the class. So if it's a line segment, and you have class Segment { Point start; Point end; //... } then you'd just need class Segment { Point start; Point end; public void translate(int xmove, int ymove) { start.translate(xmove,ymove); end.translate(xmove,ymove); } } This is good design because it reuses your Point class in defining the Segment, and uses Point methods to define Segment methods. But it does depend a little on quite what you mean by "segment"...
answers question: http://stackoverflow.com/q/26047058
accepted answer of: http://stackoverflow.com/q/26047058
type: Answer

http://stackoverflow.com/a/26138341
has comment: http://stackoverflow.com/comment/40971866
has body: The first thing to ask yourself is - do you really need to hide the implementation details? The reason I say this is that there's going to be an expense involved in doing so, which depending on your circumstances may or may not be worth paying. For example, if your API is being used by developers outside of your immediate team then it's probably worth the expense; however if it's just to hide the implementation details within you team I think it's overkill. If the API is for use within your project then a standard where by you try to depend only on abstract types or interfaces is, imho, sufficient (and already the standard). However, assuming you do need to hide the implementation and expose only the public API, the best way I know to do it is to produce two jars - one containing the public API and another that is the implementation of that API. If you're using Maven or Gradle to build the project that is using your API you simply declare a compile time dependency on the API jar (artifact) and a runtime dependency on the implementation jar (artifact). This pattern can be seen throughout the common Java APIs, the latest example being the JSON API that is implemented separately as part of Glassfish.
answers question: http://stackoverflow.com/q/26138126
has comment: http://stackoverflow.com/comment/40970795
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40970748
has comment: http://stackoverflow.com/comment/40970927

http://stackoverflow.com/comment/40782828
type: AnswerComment
has text: @aelor, it does match, but I want one which only matches if it is before <The server started in RUNNING mode.>. In your case, it will macth all exceptions, even after <The server started in RUNNING mode.>
comment on: http://stackoverflow.com/a/26034921
type: Comment
score: 1

http://stackoverflow.com/comment/40961407
type: Comment
has text: Java in general (at least, in my view) tends to prefer keeping a smaller syntax and not having that many ways to solve the same language-level problem. We just now got lambdas in Java 8, for example.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26133351

http://stackoverflow.com/q/26149028
tagged with: leap-year
type: Question
linked to: http://stackoverflow.com/q/1021324
tagged with: algorithm
upvote count: 5
score: 4
has answer: http://stackoverflow.com/a/26149238
duplicate of: http://stackoverflow.com/q/1021324
has comment: http://stackoverflow.com/comment/76321394
answer count: 1
has comment: http://stackoverflow.com/comment/40990696
has title: Why is my leap year algorithm not working (Java)?
favorite count: 0
has comment: http://stackoverflow.com/comment/40990440
has comment: http://stackoverflow.com/comment/40990535
has body: Here is what I have: Scanner input = new Scanner(System.in); System.out.print("Enter a year: "); int Year = input.nextInt(); System.out.print("Enter a month (first three letters with the first" + " letter uppercase): "); String Month = input.next(); String ThirtyOne = "Jan" + "Mar" + "May" + "Jul" + "Aug" + "Oct" + "Dec"; String DaysThirtyOne = ThirtyOne.substring(21) + "31"; String Thirty = "Apr" + "Jun" + "Sep" + "Nov"; String DaysThirty = Thirty.substring(12) + "30"; String TwentyEight = "Feb"; String DaysTwentyEight = TwentyEight.substring(3) + "28"; String DaysLeapYear = TwentyEight.substring(3) + "29"; boolean isLeapYear = ((Year % 4 == 0) &amp;&amp; (Year % 100 != 0) &amp;&amp; (Year % 400 == 0)); if (ThirtyOne.contains(Month)) { System.out.println(Month + " " + Year + " has " + DaysThirtyOne + " days in it."); } if (Thirty.contains(Month)) { System.out.println(Month + " " + Year + " has " + DaysThirty + " days in it."); } if(TwentyEight.contains(Month)) { System.out.println(Month + " " + Year + " has " + DaysTwentyEight + " days in it."); } if (isLeapYear) { System.out.println(Month + " " + Year + " has " + DaysLeapYear + " days in it."); } I am new to programming so I wouldn't be surprised if this code looks immature. Anyways, I have the user input a year and a month (first three letters). I created a boolean variable for a leap year that says whatever year the user inputs needs to be divisible by 4, 100, and 400. Then, I created an if statement for if it is a leap year to print out "Feb (whatever year the user inputs) has DaysLeapYear in it." I think I have something wrong with my algorithm because if I were to take out the if statement of TwentyEight and just kept the leap year if statements, the computer doesn't even print out how many days Feb would have if it was a leap year. Again, I think I'm going wrong in the algorithm, but it could be somewhere else and I was hoping for another look at this to see if someone sees something I am not since I am new …
has comment: http://stackoverflow.com/comment/40990550
has comment: http://stackoverflow.com/comment/40990388
accepted answer: http://stackoverflow.com/a/26149238
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40990565
downvote count: 1
has comment: http://stackoverflow.com/comment/40990494
has comment: http://stackoverflow.com/comment/40990500

http://stackoverflow.com/a/26172968
has comment: http://stackoverflow.com/comment/41034973
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41034895
type: Answer
accepted answer of: http://stackoverflow.com/q/26172891
answers question: http://stackoverflow.com/q/26172891
has comment: http://stackoverflow.com/comment/41034964
downvote count: 1
has comment: http://stackoverflow.com/comment/41034899
score: 3
has body: Your method returns a Point because you return result which is an instance of Point. If you want a double (value) for the distance you should do it this way: //euclidean distance (?) double distance (Point other) { Point result = new Point(); result.ycoord = Math.abs (ycoord - other.ycoord); result.xcoord = Math.abs (xcoord- other.xcoord); result.distance = Math.sqrt((result.ycoord)*(result.ycoord) +(result.xcoord)*(result.xcoord)); System.out.println(result); return result.distance; } }

http://stackoverflow.com/comment/40994078
type: AnswerComment
has text: Wow, this is great, thank you so much. One last clarification before I mark your answer as answer, if the call to baseRequest.setHandled(true) is not made, then it will be sent to the second registered handler?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26149232

http://stackoverflow.com/q/26041117
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/35610063
accepted answer: http://stackoverflow.com/a/35610063
tagged with: linux
upvote count: 30
possible better answer: http://stackoverflow.com/a/28935139
has comment: http://stackoverflow.com/comment/40792867
tagged with: unix
score: 30
has comment: http://stackoverflow.com/comment/40792884
type: AnsweredQuestion
has body: Our recent observation on our production system, tells us the resident memory usage of our Java container grows up. Regarding this problem, we have made some investigations to understand, why java process consumes much more memory than Heap + Thread Stacks + Shared Objects + Code Cache + etc, using some native tools like pmap. As a result of this, we found some 64M memory blocks (in pairs) allocated by native process (probably with malloc/mmap) : 0000000000400000 4K r-x-- /usr/java/jdk1.7.0_17/bin/java 0000000000600000 4K rw--- /usr/java/jdk1.7.0_17/bin/java 0000000001d39000 4108K rw--- [ anon ] 0000000710000000 96000K rw--- [ anon ] 0000000715dc0000 39104K ----- [ anon ] 00000007183f0000 127040K rw--- [ anon ] 0000000720000000 3670016K rw--- [ anon ] 00007fe930000000 62876K rw--- [ anon ] 00007fe933d67000 2660K ----- [ anon ] 00007fe934000000 20232K rw--- [ anon ] 00007fe9353c2000 45304K ----- [ anon ] 00007fe938000000 65512K rw--- [ anon ] 00007fe93bffa000 24K ----- [ anon ] 00007fe940000000 65504K rw--- [ anon ] 00007fe943ff8000 32K ----- [ anon ] 00007fe948000000 61852K rw--- [ anon ] 00007fe94bc67000 3684K ----- [ anon ] 00007fe950000000 64428K rw--- [ anon ] 00007fe953eeb000 1108K ----- [ anon ] 00007fe958000000 42748K rw--- [ anon ] 00007fe95a9bf000 22788K ----- [ anon ] 00007fe960000000 8080K rw--- [ anon ] 00007fe9607e4000 57456K ----- [ anon ] 00007fe968000000 65536K rw--- [ anon ] 00007fe970000000 22388K rw--- [ anon ] 00007fe9715dd000 43148K ----- [ anon ] 00007fe978000000 60972K rw--- [ anon ] 00007fe97bb8b000 4564K ----- [ anon ] 00007fe980000000 65528K rw--- [ anon ] 00007fe983ffe000 8K ----- [ anon ] 00007fe988000000 14080K rw--- [ anon ] 00007fe988dc0000 51456K ----- [ anon ] 00007fe98c000000 12076K rw--- [ anon ] 00007fe98cbcb000 53460K ----- [ anon ] I interpret the line with 0000000720000000 3670016K refers to the heap space, of which size we define using JVM parameter "-Xmx". Right after that, the pairs begin, of which sum is 64M exactly. We are…
type: Question
has answer: http://stackoverflow.com/a/28935139
linked to: http://stackoverflow.com/q/53576163
tagged with: java
tagged with: memory
has title: Growing resident memory usage (RSS) of Java Process

http://stackoverflow.com/comment/40951190
score: 0
comment on: http://stackoverflow.com/q/26126284
has text: Polling (every 10 seconds) is not a good solution because your app won't be able to run disconnected from the server. You should revist your requirements and possibly a port solution that the server can ping when it has a new message for your app to process. Side note: I invented the word performant! I've been using it for years.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41030549
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26152419
type: QuestionComment
has text: Any help? thanks for the edit I didn't see that.

http://stackoverflow.com/q/26127554
has answer: http://stackoverflow.com/a/26134339
upvote count: 5
tagged with: java
has body: Suppose I have a jar file called 'util.jar'. This jar file contains mostly JPA entities and some útil classes (no EJBs). How do I make this jar available to all wars deployed in Wildfly (without placing the jar inside the war's WEB-INF/lib)? I thied to create a module in Wildfly: <resource-root path="ufca.jar"/> and in my war MANIFEST.MF file: Dependencies: br.edu.ufca export but I'm getting all sorts of erros, like these: Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.LinkageError: Failed to link br/edu/ufca/web/FalhaValidacaoParametroVisao (Module "br.edu.ufca:main" from local module loader @16e9adb (finder: local module finder @121714c (roots: C:\wildfly-8.1.0.Final\modules,C:\wildfly-8.1.0.Final\modules\system\layers\base))) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:219) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] ... 3 more Caused by: java.lang.RuntimeException: java.lang.LinkageError: Failed to link br/edu/ufca/web/FalhaValidacaoParametroVisao (Module "br.edu.ufca:main" from local module loader @16e9adb (finder: local module finder @121714c (roots: C:\wildfly-8.1.0.Final\modules,C:\wildfly-8.1.0.Final\modules\system\layers\base))) at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:275) at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:190) ... 7 more Caused by: java.lang.…
answer count: 2
type: AnsweredQuestion
downvote count: 0
has title: Share util jar file with war deployments in Wildfly
favorite count: 0
accepted answer: http://stackoverflow.com/a/26134339
type: Question
score: 5
has comment: http://stackoverflow.com/comment/43181007
possible better answer: http://stackoverflow.com/a/27168006
tagged with: wildfly
has answer: http://stackoverflow.com/a/27168006
tagged with: jakarta-ee

http://stackoverflow.com/a/26068626
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26067292
has body: 1) This dialog appears as a result bad login attempt. To avoid showing pop-up at client side, you should create your own BasicAuthenticationEntryPoint implementation like this: @Service public class YourBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { @Override public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); } } This will avoid putting WWW-Authenticate header in your HTTP response, which causes the pop-up. Providing username/password in json formatted body needs object mapping which is not performed in authentication phase yet. As you already supported HTTP Basic authentication in your SecurityConfig class, passing Base64 encoded username/password in HTTP request's Authentication header will cover your requirement. 2) By default, Spring security creates stateful sessions, thus you do not need an extra implementation. However, if you need to force client to authenticate for every request in future, you can switch to stateless policy as below: http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);

http://stackoverflow.com/a/26091136
answers question: http://stackoverflow.com/q/26090789
score: 0
type: Answer
has body: Try cleaning and re-running your project. Some times the R.java file get corrupted. and it leads to null pointer exceptions.

http://stackoverflow.com/q/26057442
tagged with: java
has answer: http://stackoverflow.com/a/26619869
tagged with: m2e
tagged with: eclipse
tagged with: m2eclipse
type: Question
has body: I recently deleted an old Maven Module (= Eclipse project) and created a new one in its place. The updates were then pushed into Git. Everyone on the team is using Eclipse and pulling the update from Git doesn't remove the old project from Eclipse automatically. Is there any way of forcing this to happen or does everyone have to manually remove old projects from Eclipse (followed by Maven -> Import Project to get the new one)?
answer count: 1
score: 0
has title: Can deleted projects be automatically removed from Eclipse?
type: UnansweredQuestion
tagged with: git

numbers
tags question: http://stackoverflow.com/q/26077775
tags question: http://stackoverflow.com/q/26186417
tags question: http://stackoverflow.com/q/26160360
tags question: http://stackoverflow.com/q/26171493
tags question: http://stackoverflow.com/q/26131798
tags question: http://stackoverflow.com/q/26102783
tags question: http://stackoverflow.com/q/26128352
type: Tag
tag name: numbers

http://stackoverflow.com/comment/40942762
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26123322
type: AnswerComment
has text: He doesn't want an array containing big values, he wants a big array containing values.

servlets
tags question: http://stackoverflow.com/q/26189422
tags question: http://stackoverflow.com/q/26053367
tags question: http://stackoverflow.com/q/26149822
tags question: http://stackoverflow.com/q/26135990
tags question: http://stackoverflow.com/q/26184285
tags question: http://stackoverflow.com/q/26174003
tags question: http://stackoverflow.com/q/26136711
tags question: http://stackoverflow.com/q/26149080
tags question: http://stackoverflow.com/q/26036313
tags question: http://stackoverflow.com/q/26046374
tags question: http://stackoverflow.com/q/26037367
tags question: http://stackoverflow.com/q/26056757
tags question: http://stackoverflow.com/q/26141315
tags question: http://stackoverflow.com/q/26177895
tags question: http://stackoverflow.com/q/26087826
tags question: http://stackoverflow.com/q/26051175
tags question: http://stackoverflow.com/q/26109704
tags question: http://stackoverflow.com/q/26134086
tags question: http://stackoverflow.com/q/26182150
tags question: http://stackoverflow.com/q/26041978
tags question: http://stackoverflow.com/q/26097953
tags question: http://stackoverflow.com/q/26182708
tags question: http://stackoverflow.com/q/26154264
tags question: http://stackoverflow.com/q/26090572
tags question: http://stackoverflow.com/q/26175230
tags question: http://stackoverflow.com/q/26071035
tags question: http://stackoverflow.com/q/26052990
tags question: http://stackoverflow.com/q/26065671
tags question: http://stackoverflow.com/q/26085892
tags question: http://stackoverflow.com/q/26139942
tags question: http://stackoverflow.com/q/26055321
tags question: http://stackoverflow.com/q/26167362
tags question: http://stackoverflow.com/q/26065917
tags question: http://stackoverflow.com/q/26100587
tags question: http://stackoverflow.com/q/26118845
tags question: http://stackoverflow.com/q/26052929
tags question: http://stackoverflow.com/q/26113345
tags question: http://stackoverflow.com/q/26051100
tags question: http://stackoverflow.com/q/26056739
tags question: http://stackoverflow.com/q/26191135
tags question: http://stackoverflow.com/q/26154172
tags question: http://stackoverflow.com/q/26092489
tags question: http://stackoverflow.com/q/26193272
tags question: http://stackoverflow.com/q/26177025
tags question: http://stackoverflow.com/q/26036459
tags question: http://stackoverflow.com/q/26045569
tags question: http://stackoverflow.com/q/26073327
tags question: http://stackoverflow.com/q/26092467
tags question: http://stackoverflow.com/q/26142606
tags question: http://stackoverflow.com/q/26078116
tags question: http://stackoverflow.com/q/26164353
tags question: http://stackoverflow.com/q/26090965
tags question: http://stackoverflow.com/q/26116748
tags question: http://stackoverflow.com/q/26126071
tags question: http://stackoverflow.com/q/26134338
tags question: http://stackoverflow.com/q/26068987
tags question: http://stackoverflow.com/q/26126425
tags question: http://stackoverflow.com/q/26089364
tags question: http://stackoverflow.com/q/26139856
tags question: http://stackoverflow.com/q/26150128
tags question: http://stackoverflow.com/q/26048011
tags question: http://stackoverflow.com/q/26056989
tags question: http://stackoverflow.com/q/26045368
tag name: servlets
tags question: http://stackoverflow.com/q/26137995
tags question: http://stackoverflow.com/q/26110694
tags question: http://stackoverflow.com/q/26072238
tags question: http://stackoverflow.com/q/26040312
tags question: http://stackoverflow.com/q/26057803
tags question: http://stackoverflow.com/q/26129780
type: Tag
tags question: http://stackoverflow.com/q/26063733
tags question: http://stackoverflow.com/q/26061189
tags question: http://stackoverflow.com/q/26114624
tags question: http://stackoverflow.com/q/26101321
tags question: http://stackoverflow.com/q/26148119
tags question: http://stackoverflow.com/q/26167174
tags question: http://stackoverflow.com/q/26072544
tags question: http://stackoverflow.com/q/26152018
tags question: http://stackoverflow.com/q/26131280

http://stackoverflow.com/q/26159483
linked to: http://stackoverflow.com/q/21449152
has answer: http://stackoverflow.com/a/26159545
type: AnsweredQuestion
tagged with: android-layout
has body: I have AdjustPan on all my layouts set as: But there is one layout that contains a couple of static fragments where if I click the textbox inside the fragment, the background image resizes and the views that are aligned to the parents bottom go up. I tried to set the manifest to: <activity android:name=".CaptureVisitActivity" android:label="@string/title_activity_capture_visit" android:windowSoftInputMode="adjustPan" > But again, the window is resized. This is the layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background_landscape" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".CaptureVisitActivity" > <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="@string/title_activity_capture_visit" android:textAppearance="?android:attr/textAppearanceLarge" /> <fragment android:id="@+id/frag_summary" android:name="com.vancert.activities.CaptureVisitActivity$JobSummaryFragment" android:layout_width="match_parent" android:layout_height="wrap_content" tools:layout="@layout/fragment_job_summary" /> <fragment android:id="@+id/frag_further_work" android:name="com.vancert.activities.CaptureVisitActivity$JobFurtherWorkFragment" android:layout_width="match_parent" android:layout_height="wrap_content" tools:layout="@layout/fragment_further_work" /> <fragment android:id="@+id/fragment1" android:name="com.vancert.activities.CaptureVisitActivity$JobReportsFragment" android:layout_width="match_parent" android:layout_height="wrap_content" tools:layout="@layout/fragment_job_re…
tagged with: android-fragments
tagged with: java
has title: AdjustPan not working in some layouts
has comment: http://stackoverflow.com/comment/41009414
type: Question
has comment: http://stackoverflow.com/comment/41009346
answer count: 1
accepted answer: http://stackoverflow.com/a/26159545
duplicate of: http://stackoverflow.com/q/21449152
score: 0
tagged with: android

http://stackoverflow.com/comment/40789674
score: 0
type: Comment
has text: @JamesB Why? The same behavior applies to `static` variables.
type: AnswerComment
comment on: http://stackoverflow.com/a/26039523

http://stackoverflow.com/comment/40909773
type: Comment
comment on: http://stackoverflow.com/q/26104557
score: 0
has text: I remember some simmelar issue. Try setting the ImageButton color alpha before you add the listener. (to 1.0 or something)
type: QuestionComment

http://stackoverflow.com/a/26158478
has comment: http://stackoverflow.com/comment/41008160
has comment: http://stackoverflow.com/comment/41007493
has comment: http://stackoverflow.com/comment/41007900
has comment: http://stackoverflow.com/comment/41007533
score: 1
has comment: http://stackoverflow.com/comment/41007818
upvote count: 2
has comment: http://stackoverflow.com/comment/41022914
has comment: http://stackoverflow.com/comment/41007766
has comment: http://stackoverflow.com/comment/41007922
answers question: http://stackoverflow.com/q/26158430
has comment: http://stackoverflow.com/comment/41007596
has comment: http://stackoverflow.com/comment/41008203
has body: Try this: String s = "This is a test"; System.out.println(s.replaceFirst("\\w+\\s", ""));
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41008107

http://stackoverflow.com/comment/41047173
has text: Actually this package was genrated automatically by wsimport. And it has the same looking as you wrote `@javax.xml.bind.annotation.XmlSchema( namespace = "http://www.opentravel.org/OTA/2003/05", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.aerlingus.ta.models.b2b.faresearch;`
type: Comment
comment on: http://stackoverflow.com/a/26179817
score: 0
type: AnswerComment

http://stackoverflow.com/q/26181347
type: Question
possible better answer: http://stackoverflow.com/a/26196488
has answer: http://stackoverflow.com/a/26196488
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26183565
has title: Chronicle Map UnsupportedClassVersionError
tagged with: chronicle-map
tagged with: chronicle
favorite count: 0
has comment: http://stackoverflow.com/comment/99987526
accepted answer: http://stackoverflow.com/a/26183565
has body: I'm just trying out ChronicleMap and have run into an issue immediately, an "UnsupportedClassVersionError: Unsupported major.minor version 52.0". I'm using Java 7... should I interpret this error to mean that Chronicle Map is compiled under Java 8? Do I need to download the source code and compile under Java 7 to fix this (would this even work)?
tagged with: unsupported-class-version
linked to: http://stackoverflow.com/q/10382929
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/10382929
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26058824
upvote count: 5
has comment: http://stackoverflow.com/comment/42683365
type: Answer
answers question: http://stackoverflow.com/q/26058573
downvote count: 0
has comment: http://stackoverflow.com/comment/47352515
score: 5
has body: Streams are defined to do lazy processing. So in order to complete your count() operation it doesn’t need to look at the other items. Otherwise, it would be broken, as limit(…) is defined to be a proper way of processing infinite streams in a finite time (by not processing more than limit items). In principle, it would be possible to complete your request without ever looking at the int values at all, as the operation chain limit(3).count() doesn’t need any processing of the previous operations (other than verifying whether the stream has at least 3 items).

http://stackoverflow.com/a/26059382
has body: you are getting an array of objects . Just simply retrieve the object from it's index . $("#currentPlayer").append(playerNameAndType[0]); $("#playerType").append(playerNameAndType[1]);
answers question: http://stackoverflow.com/q/26059060
has comment: http://stackoverflow.com/comment/40826019
score: 0
type: Answer

http://stackoverflow.com/a/26092701
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26087018
has comment: http://stackoverflow.com/comment/41123533
accepted answer of: http://stackoverflow.com/q/26087018
type: Answer
has comment: http://stackoverflow.com/comment/40887739
has comment: http://stackoverflow.com/comment/90704246
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40887838
has body: The following code may help you to solve your problem, its working........ import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class Email { private static String USER_NAME = "username"; // GMail user name (just the part before "@gmail.com") private static String PASSWORD = "password"; // GMail password private static String RECIPIENT = "xxxxx@gmail.com"; public static void main(String[] args) { String from = USER_NAME; String pass = PASSWORD; String[] to = { RECIPIENT }; // list of recipient email addresses String subject = "Java send mail example"; String body = "hi ....,!"; sendFromGMail(from, pass, to, subject, body); } private static void sendFromGMail(String from, String pass, String[] to, String subject, String body) { Properties props = System.getProperties(); String host = "smtp.gmail.com"; props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.ssl.trust", host); props.put("mail.smtp.user", from); props.put("mail.smtp.password", pass); props.put("mail.smtp.port", "587"); props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props); MimeMessage message = new MimeMessage(session); try { message.setFrom(new InternetAddress(from)); InternetAddress[] toAddress = new InternetAddress[to.length]; // To get the array of addresses for( int i = 0; i &lt; to.length; i++ ) { toAddress[i] = new InternetAddress(to[i]); } for( int i = 0; i &lt; toAddress.length; i++) { message.addRecipient(Message.RecipientType.TO, toAddress[i]); } message.setSubject(subject); message.setText(body); Transport transport = session.getTransport("smtp"); transport.connect(host, from, pass); transport.sendMessage(message, message.getAllRecipients()); transport.close(); } catch (AddressException ae) { ae.printStackTrace(); } catch (MessagingException me) { me.printStackTrace(); } } }
upvote count: 2

http://stackoverflow.com/q/26098996
has comment: http://stackoverflow.com/comment/40899025
has comment: http://stackoverflow.com/comment/40906826
has comment: http://stackoverflow.com/comment/40898885
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40899766
tagged with: multithreading
has title: Synchronization: multiple locks - create lock objects?
has body: A quick (I think) concurrency question: I'm going through a multithreading course at Udemy.com, and the teacher talked through the code below. Although he explained it, I'm still not sure why you would create the lock1 and lock2 objects rather than locking on list1 and list2. App.java: public class App { public static void main(String[] args) { Worker worker = new Worker(); worker.main(); } } Worker.java: import java.util.ArrayList; import java.util.List; import java.util.Random; public class Worker { private Random random = new Random(); private Object lock1 = new Object(); private Object lock2 = new Object(); private List&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;(); private List&lt;Integer&gt; list2 = new ArrayList&lt;Integer&gt;(); public void stageOne() { synchronized (lock1) { try { Thread.sleep(1); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } list1.add(random.nextInt(100)); } } public void stageTwo() { synchronized (lock2) { try { Thread.sleep(1); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } list2.add(random.nextInt(100)); } } public void process() { for(int i=0; i&lt;1000; i++) { stageOne(); stageTwo(); } } public void main() { System.out.println("Starting ..."); long start = System.currentTimeMillis(); Thread t1 = new Thread(new Runnable() { public void run() { process(); } }); Thread t2 = new Thread(new Runnable() { public void run() { process(); } }); t1.start(); t2.start(); try { t1.join(); t2.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } long end = System.currentTimeMillis(); System.out.println("Time taken: " + (end - start)); System.out.println("List1: " + list1.size() + "; List2: " + list2.size()); } }
type: Question
has answer: http://stackoverflow.com/a/26099196
accepted answer: http://stackoverflow.com/a/26099196
tagged with: java
score: 0
tagged with: locking
answer count: 1

http://stackoverflow.com/q/26157715
favorite count: 0
accepted answer: http://stackoverflow.com/a/26175854
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: playframework-2.3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26158736
has title: How to do custom action composition to log request and response in Play 2.3?
possible better answer: http://stackoverflow.com/a/26158736
answer count: 2
has answer: http://stackoverflow.com/a/26175854
has body: I'm working on Play 2.3 (Java) application and I need a custom Action Composition to log request and response. With what I've got so far I am able to get the body of request, but not response: import play.libs.F; import play.mvc.Action; import play.mvc.Http; import play.mvc.Result; public class LogAction extends Action.Simple { public F.Promise&lt;Result&gt; call(Http.Context ctx) throws Throwable { //Request body String requestBody = ctx.request().body().asText(); //Need to get response body here //String responseBody = ??? return delegate.call(ctx); } } How to I get the response body in this scenario? If it's difficult to do in java, it may as well be in scala, however it has to work with a java controller method @With annotation.
downvote count: 0

http://stackoverflow.com/q/26112632
has comment: http://stackoverflow.com/comment/40923512
has body: I have following string &lt;b&gt;bold&lt;/b&gt; ...... &lt;b&gt;bold1..... &lt;b&gt;bold2&lt;/b&gt; &lt;u&gt;12333&lt;/u&gt; I want this &lt;b&gt;bold&lt;/b&gt; ...... &amp;lt;b&amp;gt;bold1..... &lt;b&gt;bold2&lt;/b&gt; &lt;u&gt;12333&lt;/u&gt; i.e replace &lt; and &gt; only when if it doesn't complete &lt;b&gt;&lt;/b&gt; or &lt;u&gt;&lt;/u&gt; pair. i was trying replaceAll("&lt;","&amp;lt;") .replaceAll("&gt;","&amp;gt;") but don't know how to avoid if there is a pair.
has comment: http://stackoverflow.com/comment/40923586
has comment: http://stackoverflow.com/comment/40923465
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40923464
has answer: http://stackoverflow.com/a/26112945
has comment: http://stackoverflow.com/comment/40923542
upvote count: 0
has answer: http://stackoverflow.com/a/26113168
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26113007
downvote count: 1
has title: Replace only when not in a pair
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/40910930
type: AnswerComment
has text: @Thomas Owens i give the link to Git repository.
type: Comment
comment on: http://stackoverflow.com/a/26105474
score: 0

http://stackoverflow.com/comment/40993324
type: AnswerComment
has text: So what can be the solution? Move the inner classes to indepent classes? I was thinking about this, but I dont know how to implement this with listeners.
score: 0
comment on: http://stackoverflow.com/a/26149851
type: Comment

hql
tag name: hql
tags question: http://stackoverflow.com/q/26170370
type: Tag
tags question: http://stackoverflow.com/q/26120005
tags question: http://stackoverflow.com/q/26046308
tags question: http://stackoverflow.com/q/26164375

http://stackoverflow.com/a/26045520
upvote count: 4
has comment: http://stackoverflow.com/comment/40801013
downvote count: 0
has comment: http://stackoverflow.com/comment/40801483
answers question: http://stackoverflow.com/q/26045422
type: Answer
has body: You could use a try-catch block to check if the input is an integer: try { int i = Integer.parseInt(input); // input is a valid integer } catch (NumberFormatException e) { // input is not a valid integer }
score: 4

http://stackoverflow.com/q/26068698
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40844168
tagged with: java
has comment: http://stackoverflow.com/comment/40844616
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/26069252
accepted answer: http://stackoverflow.com/a/26069252
possible better answer: http://stackoverflow.com/a/26068890
linked to: http://stackoverflow.com/q/4290878
has body: I have an enum in my class which contains an Class attribute, as so: public enum DatEnum { CONSTANT_ONE(ClassOne), CONSTANT_TWO(ClassTwo); private Class&lt;? extends UpperBoundClass&gt; classAttribute; private DatEnum(Class&lt;? extends UpperBoundClass&gt; classAttribute) { this.classAttribute = classAttribute; } public &lt;T extends UpperBoundClass&gt; T getInstance() { UpperBoundClass instance = classAttribute.newInstance(); return instance; } } But then I get a warning in the first line of the getter: Unchecked cast from capture#4-of ? extends UpperBoundClass to T And also in the second line of the getter: Unchecked cast from UpperBoundClass to T So far the code works, but i'd really like to get rid of the warning as well as to have a better understanding of what the problem actually is here.
has answer: http://stackoverflow.com/a/26068890
has comment: http://stackoverflow.com/comment/40843801
score: 0
answer count: 2
tagged with: casting
upvote count: 1
downvote count: 1
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/40843789
has title: Get instance of generic class from an enum attribute in Java

http://stackoverflow.com/q/26089158
has answer: http://stackoverflow.com/a/26089213
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40881124
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40881110
possible better answer: http://stackoverflow.com/a/26089228
type: AnsweredQuestion
tagged with: java
has title: How to convert int to char in java? Why it works? How to prevent information lost?
downvote count: 1
accepted answer: http://stackoverflow.com/a/26089213
type: Question
has body: I read couple posts about converting int to char. But none of them address my question in detail. Like I want to convert 5 to '5'. It's narrowing conversion since int has 4 byte while char only has 2 bytes. I got two question here: 1. why (char)(a + '0') can convert a to char successfully while (char)a fails? 2. How to make sure no information get lost in this conversion?
has answer: http://stackoverflow.com/a/26089228

http://stackoverflow.com/comment/40920734
type: QuestionComment
comment on: http://stackoverflow.com/q/26107707
has text: @kapep You're right. Updating now.
score: 0
type: Comment

http://stackoverflow.com/comment/41043882
type: QuestionComment
comment on: http://stackoverflow.com/q/26178113
score: 2
has text: A misconfiguration in Eclipse probably. Try to reinstall some plugins or reinstall Eclipse.
type: Comment

http://stackoverflow.com/comment/41063897
has text: What's it an ArrayList *of?* ArrayList itself is practically certain not to be the culprit here, but a class of your own with a custom readObject()/writeObjext() pair definitely is.
score: 1
comment on: http://stackoverflow.com/q/26185719
type: Comment
type: QuestionComment

readonly
tag name: readonly
type: Tag
tags question: http://stackoverflow.com/q/26132696

http://stackoverflow.com/comment/40878398
comment on: http://stackoverflow.com/q/26087708
has text: Your code is working fine. Can you add the exact input you gave and produce the error?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26176562
upvote count: 5
tagged with: java
has title: PDFBOX JPG image is working but PNG not working
tagged with: pdfbox
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/41065922
answer count: 2
has body: I had print an image into 'PDF' using the following code: InputStream in = new FileInputStream(new File("C:/"+imageName)); PDJpeg img = new PDJpeg(doc, in); contentStream.drawXObject(img, 20, pageYaxis-120, 80, 80); Here when imagName="a.jpg" its working fine, In case of imagName="b.png" its not working. In jpg images its working but in png its not. Why it is so? Please help me. How can I make print both the formats, I mean format in depended?
accepted answer: http://stackoverflow.com/a/26190046
possible better answer: http://stackoverflow.com/a/42654559
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26190046
has comment: http://stackoverflow.com/comment/41049022
has answer: http://stackoverflow.com/a/42654559
tagged with: http://stackoverflow.com/tag/png
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/40999046
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26153770
has text: What jar should I use?

http://stackoverflow.com/comment/40863823
has text: Re _"Looking at the effective pom for child module I don't see the profiles."_ I assume the aggregator project (the one declaring <module>s) is not the one declared as <parent> in the (sub-)modules or in one of their pearents. Inheritance and Aggreqation don't have necessarily the same tree hierarchy, see [Project Inheritance vs Project Aggregation](https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance_vs_Project_Aggregation).
score: 1
comment on: http://stackoverflow.com/q/26079112
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40811374
type: QuestionComment
has text: numberOfEntries is a private variable in LList that counts for all the entries that I add. index is a counter in the method so I can return what position is the entry in the linked list in.
comment on: http://stackoverflow.com/q/26050963
score: 0
type: Comment

http://stackoverflow.com/comment/103367905
type: AnswerComment
comment on: http://stackoverflow.com/a/26135970
type: Comment
score: 1
has text: You tried to insert 12 with Your solution? Hint: **[5, 6, 9, 12, 11, 0]**

http://stackoverflow.com/comment/41270777
type: AnswerComment
comment on: http://stackoverflow.com/a/26266969
type: Comment
has text: My previous example was wront .. I meant you cannot do `Integer resultB = request.executee().getREsult()` where request is of intance `RequestB`.
score: 0

http://stackoverflow.com/a/26092759
has body: the java.util.concurrent.locks.Lock interface has a tryLock(long, TimeUnit) method that does just that. see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html as far as i know this is not possible with the built in monitor locks (the ones used by the synchronized keyword).
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26092713
type: Answer
upvote count: 5

http://stackoverflow.com/comment/41054655
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26179833
type: AnswerComment
has text: Hi @Xstian, your suggestion worked. Respect & Thanks.!

http://stackoverflow.com/comment/40827490
comment on: http://stackoverflow.com/a/26059221
type: Comment
score: 0
type: AnswerComment
has text: Spot on! I did similar thing after thinking about scenarios. I also inserted the condition to not append brackets if the node is root node. Cheers!

http://stackoverflow.com/q/26105157
upvote count: 0
has comment: http://stackoverflow.com/comment/40910020
has comment: http://stackoverflow.com/comment/40910797
has comment: http://stackoverflow.com/comment/40910607
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40910760
tagged with: resource-leak
has comment: http://stackoverflow.com/comment/40910277
type: Question
has comment: http://stackoverflow.com/comment/40910446
has comment: http://stackoverflow.com/comment/40910185
score: -2
has comment: http://stackoverflow.com/comment/40918835
has comment: http://stackoverflow.com/comment/40910805
tagged with: java
has comment: http://stackoverflow.com/comment/40910180
has body: I am getting a big memory leak from char. This is not my writing and I am not good at cleaning up memory so help would be appreciated. This class uses char so I will start with it. package server.util; import java.text.NumberFormat; import org.jboss.netty.buffer.ChannelBuffer; public class Misc { public static String getRS2String(final ChannelBuffer buf) { final StringBuilder bldr = new StringBuilder(); byte b; while (buf.readable() &amp;&amp; (b = buf.readByte()) != 10) bldr.append((char) b); return bldr.toString(); } public static double randomDouble(double min, double max) { return (Math.random() * (max - min) + min); } public static String formatPlayerName(String str) { str = ucFirst(str); str.replace("_", " "); return str; } public static int getCurrentHP(int i, int i1, int i2) { double x = (double) i / (double) i1; return (int) Math.round(x * i2); } public static String removeSpaces(String s) { return s.replace(" ", ""); } public static String capitalize(String s) { for (int i = 0; i &lt; s.length(); i++) { if (i == 0) { s = String.format("%s%s", Character.toUpperCase(s.charAt(0)), s.substring(1)); } if (!Character.isLetterOrDigit(s.charAt(i))) { if (i + 1 &lt; s.length()) { s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)), s.substring(i + 2)); } } } return s; } public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) { return ((objectX - playerX &lt;= distance &amp;&amp; objectX - playerX &gt;= -distance) &amp;&amp; (objectY - playerY &lt;= distance &amp;&amp; objectY - playerY &gt;= -distance)); } public static int distanceToPoint(int pointX, int pointY, int pointX2, int pointY2) { return (int) Math.sqrt(Math.pow(pointX2 - pointX, 2) + Math.pow(pointY2 - pointY, 2)); } public static String longToReportPlayerName(long l) { int i = 0; final char ac[] = new char[12]; while (l != 0L) { final long l1 = l; l /= 37L; ac[11 - i++] = Misc.playerNameXlateTable[(int) (l1 - l * 37L)];…
linked to: http://stackoverflow.com/q/15612157
tagged with: memory
has comment: http://stackoverflow.com/comment/40910485
has answer: http://stackoverflow.com/a/26105263
tagged with: char
has comment: http://stackoverflow.com/comment/40910535
has comment: http://stackoverflow.com/comment/40910557
answer count: 1
has comment: http://stackoverflow.com/comment/40910070
favorite count: 0
tagged with: memory-leaks
has title: char Memory Leak in Java
has comment: http://stackoverflow.com/comment/40910113
has comment: http://stackoverflow.com/comment/40910018
has comment: http://stackoverflow.com/comment/40910083
linked to: http://stackoverflow.com/q/6470651
has comment: http://stackoverflow.com/comment/40910359
has comment: http://stackoverflow.com/comment/40910786
has comment: http://stackoverflow.com/comment/40910106

http://stackoverflow.com/a/26118693
type: Answer
answers question: http://stackoverflow.com/q/26117982
has body: Very bad example, especially when dealing with user input: Statement stat = authConn.createStatement(); String query = ("SELECT * FROM users where userName='" + user + "' ORDER BY id DESC LIMIT 1;"); ResultSet rs = stat.executeQuery(query); Replace above with: // got rid of ORDER BY and LIMIT - shouldn't userName be unique? // in your select list avoid '*' select only columns that you need PreparedStatement ps = authConn.prepareStatement("SELECT pass FROM users where userName = ?"); ps.setString(1, user); ResultSet rs = ps.executeQuery(); if (rs.next()) { password = rs.getString("pass"); } authConn.close();
score: 0

http://stackoverflow.com/a/26134793
answers question: http://stackoverflow.com/q/26133022
type: AcceptedAnswer
has body: You have declared composite key with fields disciplineId &amp; subDisciplineId for your entity SubdisciplinePlayer. Now in your program you are creating 2 instances of SubdisciplinePlayer with same composite id. SubdisciplinePlayer sdp = new SubdisciplinePlayer(); sdp.setDisciplineId(sd.getDisciplineId()); sdp.setSubDisciplineId(sd.getId()); SubdisciplinePlayer sdp2 = new SubdisciplinePlayer(); sdp2.setDisciplineId(sd.getDisciplineId()); sdp2.setSubDisciplineId(sd.getId()); So when you call Session.save(sd), hibernate observed that you are trying to save 2 instances of SubdisciplinePlayer and throwing the exception as : org.hibernate.NonUniqueObjectException: a different objectwith the same identifier value was already associated with the session: [net.viralpatel.hibernate.SubdisciplinePlayer# net.viralpatel.hibernate.SubdisciplinePlayer@1cd7e9c3] To fix the issue just make sure that the composite id of SubdisciplinePlayer should have different values as primary key should be unique.
accepted answer of: http://stackoverflow.com/q/26133022
downvote count: 0
has comment: http://stackoverflow.com/comment/40997269
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/40904656
type: QuestionComment
comment on: http://stackoverflow.com/q/26101050
has text: Thanks, that's seems like the right approach to the issue. I felt I was going the wrong way.
score: 1
type: Comment

http://stackoverflow.com/q/26080354
has comment: http://stackoverflow.com/comment/40865201
has comment: http://stackoverflow.com/comment/40865338
type: AnsweredQuestion
tagged with: java
has title: Android where to create ScheduledThreadPool and what happens if not shutdown?
type: Question
has comment: http://stackoverflow.com/comment/40864969
answer count: 1
accepted answer: http://stackoverflow.com/a/26080715
has comment: http://stackoverflow.com/comment/40865247
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40865100
has answer: http://stackoverflow.com/a/26080715
has body: I am creating a ScheduledThreadPool to run some method calls periodically. For an example I want to save everything to the DB every 10 seconds... So I got: public class Scheduler{ ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5); public Scheduler(){ foo = Foo.getInstance(); saveValues(); } private void saveValues(){ ScheduledFuture saveValues = scheduledExecutorService.scheduleAtFixedRate( new Runnable(){ public void run() { Log.e(TAG, "in save values"); foo.save(); } }, 2000, 2000, TimeUnit.MILLISECONDS); } } but the problem is it runs once and never again. I read in one tutorial that it is important to shut down the Executer cause it might run on forever otherwise so I expected I did not need to take care of it's lifecycle except for creating it and shutting it down at one point. Foo is an Api which is a singleton. It gets called by the activity and calls Scheduler. I was also wondering if it should extend Application, but did not find it necessary yet. Where in my app do I need to call it, is it ok in the Scheduler class or not? Does Scheduler need to be a Runnable? And where exactly do I shut down the Executer? Thanks in advance ps: if you think that an Executer is not the right way to do it, let me know. I looked through many threads and pages and did not find a perfect answer so the Executer seemed alright.

http://stackoverflow.com/a/26134339
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26127554
has comment: http://stackoverflow.com/comment/40973459
has comment: http://stackoverflow.com/comment/40985731
answers question: http://stackoverflow.com/q/26127554
has comment: http://stackoverflow.com/comment/40979579
has comment: http://stackoverflow.com/comment/40987681
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/40980858
upvote count: 4
has body: An alternative to creating a custom module and defining a dependency to that module is to just deploy the jar file to the application server (f.i. ufca.jar). Once the jar is deployed, you can simply declare a dependency to this deployment from your war-file using f.i. deployment.ufca.jar as the id. In your war-file you can f.i. use the jboss-deployment-structure.xml to add the dependency, f.i. using &lt;dependencies&gt; &lt;module name="deployment.ufca.jar" /&gt; &lt;/dependencies&gt; See also: https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly

http://stackoverflow.com/a/26121664
has comment: http://stackoverflow.com/comment/40976116
downvote count: 0
has comment: http://stackoverflow.com/comment/40964181
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40969913
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40970987
type: Answer
has comment: http://stackoverflow.com/comment/40963712
has comment: http://stackoverflow.com/comment/40963619
accepted answer of: http://stackoverflow.com/q/26121406
answers question: http://stackoverflow.com/q/26121406
has body: You cannot use a REST service framework to access a SOAP Web-Service. This are two completely different technologies. It's like you're asking how to drive with a locomotive on a motorway...
has comment: http://stackoverflow.com/comment/40963650

http://stackoverflow.com/comment/41012886
type: QuestionComment
has text: OK please add the content of your bat file or at least the part where you try to start the classes. It is most likely a problem with classpath setting.
score: 0
comment on: http://stackoverflow.com/q/26160992
type: Comment

http://stackoverflow.com/comment/40811791
type: Comment
type: QuestionComment
has text: @shinjw yes, there _is_ a recursive call. @azurefrog a recursive function can have a `for` loop, there's nothing inherently wrong with that
score: 0
comment on: http://stackoverflow.com/q/26051331

http://stackoverflow.com/q/26129140
has comment: http://stackoverflow.com/comment/40954595
has comment: http://stackoverflow.com/comment/40953918
type: UnansweredQuestion
upvote count: 1
tagged with: calendar
has body: I am using Netbeans 8. I am still in the beginner courses for computer science. I am trying to write two methods which are addDays and addMonths. Here are the methods public void addMonths(int n) { month += n; if (month &gt;= 13) { month = 0 + n - 1; } } public void addDays(int n) { day += n; if (day &gt;= 32) { day = 0 + n ; } } I know they are wrong. Can someone help me fix them ? Please keep it simple and not use advanced coding.
has comment: http://stackoverflow.com/comment/40957325
score: 1
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/26129276
has comment: http://stackoverflow.com/comment/40953941
answer count: 2
downvote count: 0
has title: addDays and addMonths to a date methods in Java
has comment: http://stackoverflow.com/comment/40954235
favorite count: 0
has answer: http://stackoverflow.com/a/26129296

http://stackoverflow.com/comment/40816034
type: AnswerComment
comment on: http://stackoverflow.com/a/26051281
has text: @OsborneCox unfortunately this is the drawback if you have a fixed size image (especially with all devices with different sizes). You could use a nine patch drawable instead, which would auto scale the blue background to fill the white area. let me know if you need more info about this method.
type: Comment
score: 0

http://stackoverflow.com/comment/41010221
type: Comment
type: QuestionComment
has text: Which line is line 30 i´n `POIDocWriter`?
comment on: http://stackoverflow.com/q/26159931
score: 0

http://stackoverflow.com/comment/40981924
score: 0
has text: Thanks for the link.. I found following error eclipse.buildId=4.3.2.M20140221-1700 java.version=1.6.0_38 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product Error Wed Oct 01 10:33:55 EDT 2014 A workspace crash was detected. The previous session did not exit normally. Not using saved taglib indexes.
type: QuestionComment
comment on: http://stackoverflow.com/q/26143821
type: Comment

http://stackoverflow.com/a/26090352
answers question: http://stackoverflow.com/q/26089421
score: 0
type: Answer
has body: Since i was playing around trying to figure my problem while waiting i felt onto the solution for it. For those which have the same Problem: Solution: Since the new Modena style is used by default, the context menu's are styled with a drop shadow / Gaussian blur effect, which made when opening the Menu it gave some kind of strange effect when using an other background on the stage. To solve this its only needed to overwrite(resetting) the style.. in my case it was the follow one which i needed to overwrite in a new css file. -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.2) , 12, 0.0 , 0 , 8 );

http://stackoverflow.com/q/26055044
has answer: http://stackoverflow.com/a/26055251
duplicate of: http://stackoverflow.com/q/4707504
tagged with: java
linked to: http://stackoverflow.com/q/4707504
possible better answer: http://stackoverflow.com/a/26055109
score: 0
accepted answer: http://stackoverflow.com/a/26055102
has answer: http://stackoverflow.com/a/26055156
has title: Confused with why private variable can be accessed?
has answer: http://stackoverflow.com/a/26055102
has body: I recently see a question that what is the execution result of this code below. public class Sandys { private int court; public static void main(String argv[]){ Sandys s = new Sandys(99); System.out.println(s.court); } Sandys(int ballcount){ court = ballcount; } } I think it can't be executed because in main i try to access a private variable. However, this code can be perfectly executed, and the result is 99. So I am confused, why the private variable can be accessed in this code? Though the main is in Sandys class, however i create a new Sandys. Can I still access the private variable of the new Sandys object in main?
has comment: http://stackoverflow.com/comment/40818091
answer count: 4
has answer: http://stackoverflow.com/a/26055109
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/40818174

http://stackoverflow.com/comment/40807377
comment on: http://stackoverflow.com/a/26048907
has text: Yes startTime is an instance variable. It is set up in the main activity in my code.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26147917
score: 2
has body: There are two different interfaces in Java for iteration that are important, Iterable and Iterator. They each serve a different purpose. Iterable When something implements this interface, this means that it can be iterated on. This is useful for us because Java gives us a shortcut for iterating over things that implement Iterable using a for-each loop: List&lt;String&gt; elements = ... ; // List is an instance of Iterable for (String element : elements) System.out.println(element); Anything that is an instance of Iterable can be used in a for-each loop. If you have your own custom MyDeque class that implements Iterable, then you can use that in a for-each as well: MyDeque&lt;String&gt; elements = ... ; for (String element : elements) System.out.println(element); This brings us to... Iterator This interface is how the iteration is actually performed. The for-each loop compiles to something like this: MyDeque&lt;String&gt; elements = ... ; for (Iterator&lt;String&gt; $iter = elements.iterator(); $iter.hasNext();) { String element = $iter.next(); System.out.println(element); } This piece of code is functionally equivalent to the for-each above. hasNext() is the continuation condition (do I have more stuff to give you?) and next() actually gives you the next element, or throws a NoSuchElementException if we don't have anything else. The point of making your custom deque implement Iterable is just to make it so you can iterate over the elements in your deque using something like a for loop. Its Iterator implementation is the thing that will let you actually do that iteration.
downvote count: 0
answers question: http://stackoverflow.com/q/26147586
upvote count: 2
type: Answer

http://stackoverflow.com/a/26166343
has body: If I understand what you want to do correctly, I think the natural way to solve this would be zip: You have two Observables that asynchronously emit their results, namely ebs and the return value of context.findGame(...). You can combine their result by doing something like this: public rx.Observable&lt;Game&gt; findGame(long templateId, GameModelType game_model, GameStateType state) { rx.Observable&lt;RxMessage&lt;byte[]&gt;&gt; ebs = context.getGameTemplate(templateId); rx.Observable&lt;RxMessage&lt;byte[]&gt;&gt; gameObs = context.findGame(templateId, state); return Observable.zip(gameObs, ebs, new Func2&lt;RxMessage&lt;byte[]&gt;, RxMessage&lt;byte[]&gt;, Game&gt;() { @Override public Game call(RxMessage&lt;byte[]&gt; gameRawReply, RxMessage&lt;byte[]&gt; t1) { Game game = null; switch(game_model) { case SINGLE: { game = singleGames.get(0); } } return game; } }); } The Func2 - the third argument of zip - will be called when both of your source Observables have called their onNext. It will be used to combine the values they emit to a new value of type Game and this will be emitted to subscribers of the resulting Observable. EDIT: Some more information... Note that I changed the return of call() from Observable&lt;Game&gt; to just Game. Otherwise the result of zip would not have been an Observable&lt;Game&gt; but an Observable&lt;Observable&lt;Game&gt;&gt;. Unlike map and flatMap there is only zip in rx - no flatZip. But since you always want to emit exactly one game for each pair of input items (one from ebs, one from gameObs) that's not a problem in this case. Also, the call() of the Func2 could now be further simplified to just: @Override public Game call(RxMessage&lt;byte[]&gt; gameRawReply, RxMessage&lt;byte[]&gt; t1) { switch(game_model) { case SINGLE: { return singleGames.get(0); } } }
accepted answer of: http://stackoverflow.com/q/26165644
has comment: http://stackoverflow.com/comment/41028692
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41033763
upvote count: 1
answers question: http://stackoverflow.com/q/26165644

if-statement
tags question: http://stackoverflow.com/q/26162814
tags question: http://stackoverflow.com/q/26049191
tags question: http://stackoverflow.com/q/26105736
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/26187972
tags question: http://stackoverflow.com/q/26043985
tags question: http://stackoverflow.com/q/26110669
tags question: http://stackoverflow.com/q/26166361
tags question: http://stackoverflow.com/q/26166542
tags question: http://stackoverflow.com/q/26152726
tags question: http://stackoverflow.com/q/26154412
tags question: http://stackoverflow.com/q/26079972
tags question: http://stackoverflow.com/q/26134221
tags question: http://stackoverflow.com/q/26067617
tags question: http://stackoverflow.com/q/26110992
tags question: http://stackoverflow.com/q/26088277
tags question: http://stackoverflow.com/q/26085322
tags question: http://stackoverflow.com/q/26096059
tags question: http://stackoverflow.com/q/26118129
tags question: http://stackoverflow.com/q/26076096
tags question: http://stackoverflow.com/q/26051186
tags question: http://stackoverflow.com/q/26047364
tags question: http://stackoverflow.com/q/26188168
tags question: http://stackoverflow.com/q/26143959
tags question: http://stackoverflow.com/q/26111987
tags question: http://stackoverflow.com/q/26051236
tags question: http://stackoverflow.com/q/26088634
tags question: http://stackoverflow.com/q/26153907

http://stackoverflow.com/q/26140641
linked to: http://stackoverflow.com/q/8382641
has answer: http://stackoverflow.com/a/26141588
score: 0
has body: after a restart of my computer i am trying to start up PHPStorm. i havent installed nor deleted anything on my computer but suddenly im getting the following error: Failed to clear URL cache Failed to clear URL cache [ 3877] ERROR - llij.ide.plugins.PluginManager - com.intellij.openapi.wm.impl.TestWindowManager cannot be cast to com.intellij.openapi.wm.impl.WindowManagerImpl java.lang.ClassCastException: com.intellij.openapi.wm.impl.TestWindowManager cannot be cast to com.intellij.openapi.wm.impl.WindowManagerImpl at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:277) at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:206) at com.intellij.idea.MainImpl$2.run(MainImpl.java:141) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) [ 3882] ERROR - llij.ide.plugins.PluginManager - JetBrains PhpStorm 6.0.3 Build #PS-129.814 [ 3882] ERROR - llij.ide.plugins.PluginManager - JDK: 1.7.0_51 [ 3882] ERROR - llij.ide.plugins.PluginManager - VM: OpenJDK 64-Bit Server VM [ 3883] ERROR - llij.ide.plugins.PluginManager - Vendor: Oracle Corporation [ 3883] ERROR -…
tagged with: phpstorm
answer count: 1
has comment: http://stackoverflow.com/comment/40975087
accepted answer: http://stackoverflow.com/a/26141588
type: AnsweredQuestion
tagged with: java
type: Question
has title: PHPstorm ERROR 3877

http://stackoverflow.com/q/26043013
has title: Java gives me wrong time every time i try to get it
possible better answer: http://stackoverflow.com/a/26043212
favorite count: 0
has comment: http://stackoverflow.com/comment/40796349
has comment: http://stackoverflow.com/comment/40796530
linked to: http://stackoverflow.com/q/1707799
downvote count: 5
has body: I need to get normal correct time in android application. But every time I run the app, I get wrong hours and wrong minutes. And it is not the incorrect TimeZone. Every time I run the app, the time is different! I've searched through questions here, but haven't found the answer for me. Nothing works with this... Why is it so problematic in java? In c#. for example, you can get time by just writting: var time = DateTime.Now. How can I get normal correct time? The time zone on my computer is set to UTC +02:00. (Ukraine, Kiev). My code: Calendar curTime = new GregorianCalendar(); curTime.setTimeZone(TimeZone.getTimeZone("Ukraine/Kiev")); DateFormat dateFormat = new SimpleDateFormat("HH:ss"); dateFormat.setCalendar(curTime); String time = dateFormat.format(curTime.getTime());
tagged with: android
tagged with: datetime
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/40796537
accepted answer: http://stackoverflow.com/a/26043449
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26043449
has comment: http://stackoverflow.com/comment/40796855
has comment: http://stackoverflow.com/comment/40796410
has answer: http://stackoverflow.com/a/26043212
has comment: http://stackoverflow.com/comment/40796265

http://stackoverflow.com/comment/41029413
score: 1
has text: As @Gas touches, your test is useless and in this particular case it could very well be that you're using the default parallel GC and that the extra time is the extra time neded for a full stop when you have successfully used up all of the 2G.
comment on: http://stackoverflow.com/q/26168410
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26052033
has body: //how do i say "if the user inputs 1, use the deposit method? code same as you take input to add new account or use the exist.then you can get what type of action user want to perform after creating an account. if is an existing account take account number as input and find it from arraylist you cant get the account if you use this code for(int i = 0; i&lt;accounts.size();i++) { accounts.get(i).deposit(double amount); } and create a deposite function clearly for that account number
score: 0
answers question: http://stackoverflow.com/q/26051221
type: Answer

try-catch
tags question: http://stackoverflow.com/q/26171920
tags question: http://stackoverflow.com/q/26073247
type: Tag
tags question: http://stackoverflow.com/q/26130608
tags question: http://stackoverflow.com/q/26149824
tags question: http://stackoverflow.com/q/26184510
tags question: http://stackoverflow.com/q/26127598
tag name: try-catch

http://stackoverflow.com/q/26038333
has comment: http://stackoverflow.com/comment/40814889
has comment: http://stackoverflow.com/comment/40810968
type: UnansweredQuestion
tagged with: swt
upvote count: 1
has comment: http://stackoverflow.com/comment/41220541
has comment: http://stackoverflow.com/comment/40788660
tagged with: java
has title: How to wait till SWT browser finishes loading?
linked to: http://stackoverflow.com/q/12735755
type: Question
has answer: http://stackoverflow.com/a/31798446
tagged with: browser
answer count: 2
has comment: http://stackoverflow.com/comment/40815997
downvote count: 0
favorite count: 0
has body: I am using a SWT browser in my application. I need to run a script on HTML page in the browser. But the script is being run before the page is completely loaded. So how do i make the app wait till the browser finishes loading. I have tried something like this. completed = true; browser.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent event) { completed = true; //say this is a global variable } @Override public void changed(ProgressEvent event) { completed = false; System.out.println("Page changing"); } }); //some other method void m1() { browser.setText("blah blah blah"); while (completed == false) {} // EXECUTE THE SCRIPT NOW } But this does not work! This is similar to Java SWT browser: Waiting till dynamic page is fully loaded but there is no solution.
has answer: http://stackoverflow.com/a/26055101
score: 1

http://stackoverflow.com/a/26072304
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26072242
has comment: http://stackoverflow.com/comment/40850213
type: Answer
answers question: http://stackoverflow.com/q/26072242
downvote count: 0
has body: When you detect a new key, create a new list: if (s.startsWith("K:")) { key = s; values = new ArrayList&lt;&gt;(); } If you don't do this, every key will be mapped to the same list. You want each key mapped to its own list.
score: 3
type: AcceptedAnswer

obiee
tag name: obiee
type: Tag
tags question: http://stackoverflow.com/q/26188410

http://stackoverflow.com/q/26181462
has answer: http://stackoverflow.com/a/26181782
tagged with: android
answer count: 4
accepted answer: http://stackoverflow.com/a/26181821
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/41050900
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/26181831
has answer: http://stackoverflow.com/a/26181821
type: AnsweredQuestion
has title: AsyncTask does not correctly restart in Android
has answer: http://stackoverflow.com/a/26181762
tagged with: java
has body: I am developing an Android application and I need show remind dialog from time to time in according to variable from shared preferences. If user does not want to see reminder message, he can disable this option also in my PreferenceActivity. I am using AsyncTask class to show remind message to user from time to time . User can press options button at every moment to go to PreferenceActivity to enable/disable reminder option and set pause time value between reminds, and the go back to activity. So I am checking all values in onResume method. And if users does not want to see remind messages I need to finish current working AsyncTask, or if user changed value between reminds, I need to restart current AsyncTack with new pause value. But I see an unpredictable behavior of my AsyncTack: sometimes it stops, sometimes not and continue working and showing message)))), sometimes it works and sometimes - not))))). Here is a piece of code: This is my AsyncTack class private class ReadReminderTask extends AsyncTask&lt;Long, Void, Void&gt; { private long mRemindTime; private volatile boolean running = true; public ReadReminderTask(){ } @Override public Void doInBackground(Long... params){ mRemindTime = params[0]; while (running){ try{ Thread.sleep(mRemindTime); publishProgress(); } catch (Exception e){ e.printStackTrace(); } } return null; } @Override protected void onProgressUpdate(Void... progress) { super.onProgressUpdate(progress); // showReminder is a method where I show remind message showReminder(); } @Override protected void onCancelled() { running = false; } } This is onResume method of my Activity where I need to show reminder message: if(!settings.getBoolean("needToRemind", false)) { mReadReminderTask.cancel(true); } else if(settings.getBoolean("needToRemind", false)) { mReadReminderTask = new ReadReminderTask(); mReadReminderTask.execute(settings.getLong("timeRemind", 1)); } Can anyone help me with my problem?
has answer: http://stackoverflow.com/a/26181831
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41051557
has comment: http://stackoverflow.com/comment/41051269

http://stackoverflow.com/a/26059617
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26059533
has body: Percentages as doubles are less than or equal to one -- they're a fraction between 0 and 1. So 17% is 0.17, not 17.
upvote count: 3

http://stackoverflow.com/comment/40799332
type: Comment
has text: @sjelmo5: It is useful when you are selecting *between fixed values*. In your case, you are dealing with *ranges*, which makes the `switch` statement unsuitable.
type: AnswerComment
comment on: http://stackoverflow.com/a/26044319
score: 0

http://stackoverflow.com/a/26098962
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26098604
type: Answer
upvote count: 1
has body: Hi this will do even the number is double or long, which is useful always while parsing. List&lt;String&gt; myStrings = new ArrayList&lt;String&gt;(); myStrings.add("text"); myStrings.add("25"); myStrings.add("102.23333333"); myStrings.add("22.34"); NumberFormat nf = NumberFormat.getInstance(); for( String text : myStrings){ try { System.out.println( nf.parse(text)); } catch (ParseException e) { e.printStackTrace(); } }

http://stackoverflow.com/comment/40943239
type: AnswerComment
type: Comment
has text: Oh, what configuration is that?
comment on: http://stackoverflow.com/a/26123262
score: 0

http://stackoverflow.com/q/26170382
tagged with: android
has answer: http://stackoverflow.com/a/26170636
score: -1
accepted answer: http://stackoverflow.com/a/26170464
has title: Display ArrayList to TextView
tagged with: java
answer count: 3
downvote count: 1
possible better answer: http://stackoverflow.com/a/26170526
has answer: http://stackoverflow.com/a/26170526
has body: I am trying to do something simple: display my ArrayList to a TextView. I have tried to use methods that would do this without success. Or am I supposed to use a ListView instead of a TextView? Anyway here is the code. I hope someone can help. public class MainActivity extends Activity { Button aButton; // Global Scope TextView text2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_layout); aButton = (Button) this.findViewById(R.id.button1); aButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Books"); list.add("Newspapers"); list.add("Magazines"); for (int i = 0; i &lt; list.size(); i++) { //System.out.println(list.get(i)); Log.i("Results", list.get(i)); text2.setText(text2.getText()); } } }); }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26170464
upvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/40960335
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26132696
has text: I didn't downvote your question. Try removing all event handlers.

http://stackoverflow.com/comment/40948268
has text: Is this homework or something?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26126265

http://stackoverflow.com/q/26137897
has title: Java modules calling Spring context throws BeanFactory not initialized or already closed - call 'refresh' before accessing beans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40969400
tagged with: spring-bean
has comment: http://stackoverflow.com/comment/40974298
tagged with: spring
has body: All though I see lots of questions, some answers are not relevant to my setup. I have a total of 3 modules API, Impl and consumer. Consumer has dependency of API and Impl. Consumer has web.xml, which looks like <web-app> Archetype Created Web Application contextConfigLocation classpath*:/**/conf/spring-config.xml org.springframework.web.context.ContextLoaderListener HelloWorld com.name.TestMe HelloWorld /* </webapp> In consumer resource conf/spring-config.xml exists with configuration <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> <import resource="classpath*:/**/repository.xml"/> </beans> within repository.xml I have <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> classpath:/**/properties/mongo-config.properties <!-- <import resource="config/mongo-core.xml" /> --> <import resource="config/spring-core.xml" /> </beans> Am I missing anything here? The whole stacktrace is as below java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationCon…
has answer: http://stackoverflow.com/a/26141491
tagged with: java
has comment: http://stackoverflow.com/comment/40971135
type: Question
has comment: http://stackoverflow.com/comment/40970206
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40971688
has comment: http://stackoverflow.com/comment/40969407

http://stackoverflow.com/a/31640718
has body: I tried to crawl websites with Hadoop &amp; Nutch and I got the same error. When I checked my ivy/ivy.xml I saw missing dependency &lt;dependency org="org.apache.gora" name="gora-hbase" rev="0.2" conf="*-&gt;default" /&gt; When I uncomment it, run ant clean and ant runtime, bug disapper. I am using Ubuntu 12 server too.
answers question: http://stackoverflow.com/q/26178919
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/61739202

http://stackoverflow.com/a/26070973
score: 1
upvote count: 1
downvote count: 0
has body: Invert the loop condition. You want to loop while absolutex is bigger than epsilon, not while it's smaller. You want to stop when it is small enough. do { } while(absolutex &gt; .000001);
type: Answer
answers question: http://stackoverflow.com/q/26070915

http://stackoverflow.com/a/26099226
has comment: http://stackoverflow.com/comment/40900070
score: 0
type: Answer
has body: Try to close the connection after finish server or if you want to run the code more than one time you can solve this problem with a lood around your read from stream
answers question: http://stackoverflow.com/q/26099119
has comment: http://stackoverflow.com/comment/40899213

http://stackoverflow.com/comment/40934028
comment on: http://stackoverflow.com/q/26118748
has text: Use online parser for correct json parsing and all well be okey: http://www.jsoneditoronline.org/
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41066070
score: 2
comment on: http://stackoverflow.com/q/26189649
has text: Where did u call the `initialize` method. u should call it in onCreate
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40927612
comment on: http://stackoverflow.com/q/26114702
has text: I am using Adobe echosign web services and the url of their wsdl is: https://secure.echosign.com/services/EchoSignDocumentService19?wsdl I am not sure but it’s highly improbable that it would be corrupt.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40866927
has text: the third number actually i'm sorry i should add the text input 500 400 100 300 200 200 900 200 150 I want to scan only 500, 300, and 900
comment on: http://stackoverflow.com/q/26081151
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41425611
score: 0
type: AnswerComment
has text: Thanks for your answer! It works quite good, but i have the problem that on redeploy it resets my config files to the default ones.
type: Comment
comment on: http://stackoverflow.com/a/26216097

http://stackoverflow.com/comment/81367404
comment on: http://stackoverflow.com/a/42848413
type: AnswerComment
has text: I encountered the same issue, fails with JDK 1.8.0_45, works fine with JDK 1.8.0_131
score: 4
type: Comment

http://stackoverflow.com/a/26090592
answers question: http://stackoverflow.com/q/26087818
type: Answer
has body: A connection timeout almost always indicates a firewall problem.
has comment: http://stackoverflow.com/comment/40901966
score: 0

http://stackoverflow.com/comment/40971645
type: Comment
has text: Thanks for Jasypt, this will probably fit me best.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26124020

http://stackoverflow.com/q/26064437
score: 2
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40838694
type: Question
has comment: http://stackoverflow.com/comment/40839308
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/40838974
has title: Java EE7: @DatasourceDefinition, how to parameterize values?
has comment: http://stackoverflow.com/comment/40838916
tagged with: jpa
downvote count: 0
answer count: 1
has body: I am learning how to use @DataSourceDefinition. The documentation gives a specific example as @DataSourceDefinition(name="java:global/MyApp/MyDataSource", className="com.foobar.MyDataSource", portNumber=6689, serverName="myserver.com", user="lance", password="secret" ) Question How can I substitute these values for environment variables? like DB_HOST, DB_URL The reason is when I deploy my application to providers like OPENSHIFT, all I get the values to use to connect to database. I would not like to hardcode them in my codebase. This adds coupling to particular database and can not be switched at runtime Any ideas?
favorite count: 0
has comment: http://stackoverflow.com/comment/40839157
has answer: http://stackoverflow.com/a/26113436

http://stackoverflow.com/comment/41024910
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26167561
has text: To be even more explicit; all the attacker has to do is precompute the SHA-256 of all 32-bit integer values (will take a few seconds), and then they'll be able to generate collisions for any given input.
score: 1

http://stackoverflow.com/comment/41066503
type: QuestionComment
has text: Interesting. I've typically use jackson in 'web apps' where it's used for object marshalling. In that case we had to have the libs on the server.
comment on: http://stackoverflow.com/q/26174143
score: 0
type: Comment

http://stackoverflow.com/comment/40904049
type: AnswerComment
type: Comment
has text: sorry to say,in my script While loop is perfect.But it's displaying the invalid output
comment on: http://stackoverflow.com/a/26101576
score: 0

http://stackoverflow.com/a/26099692
accepted answer of: http://stackoverflow.com/q/26099338
type: Answer
has comment: http://stackoverflow.com/comment/40900532
upvote count: 3
score: 3
has body: A component can have only 1 parent. See the last line of my code snippet for how it should be done JPanel panel = new JPanel(); panel.add(play); panel.add(stopeject); panel.add(rewind); panel.add(fastforward); panel.add(pause); //right now panel is the parent component of play, stop, eject JPanel panel2 = new JPanel(); panel2.add(play); //play is now owned by panel2, not panel panel2.add(stopeject); //stopeject is now owned by panel2, not panel panel2.add(new JButton("Rewind")); // this is how you should do this
has comment: http://stackoverflow.com/comment/40901059
answers question: http://stackoverflow.com/q/26099338
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26176058
answer count: 1
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/26178036
has body: I would like to have a boolean flag in GAE Datastore to allow or disallow a function to run. In my understanding, If we use a datastore property as the flag, we need to pay for each and every read operation. It happens like this, if(flag == true){ //Do }else{ //Don't } Could you please advise how to use a "flag" efficiently. Is it possible to use a static variable in the program itself other than saving it to the datastore? Please advise. Thanks, Karthick
score: 0
tagged with: static-variables
accepted answer: http://stackoverflow.com/a/26178036
type: AnsweredQuestion
tagged with: java
tagged with: flags
has title: How to use a static flag in GAE Datastore?
type: Question
tagged with: google-cloud-datastore

http://stackoverflow.com/q/26134348
tagged with: soap
answer count: 0
has comment: http://stackoverflow.com/comment/40963142
type: UnansweredQuestion
has title: How to cache JAXB context in Spring SOAP web service?
upvote count: 1
tagged with: web-services
tagged with: spring
type: Question
has comment: http://stackoverflow.com/comment/40978231
has comment: http://stackoverflow.com/comment/40963865
score: 1
tagged with: java
tagged with: jaxb
has body: We profiled our spring soap web service through spring insight and new relic, more than 60% of the time is consumed in spring jars. We are guessing this is something to do with logging, jaxb context. we are exposing soap ws. We also observed that some of the time is consumed by security header. Can we cache JAXB context in Spring soap web service? OR Any other pointer to improve spring soap web service performance? Thanks for help. Configuration details:- </sws:interceptors> <sws:static-wsdl id="employeeTransfer" location="/WEB-INF/wsdl/employeeTransfer.wsdl" />
has comment: http://stackoverflow.com/comment/40963551
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40828616
has text: if you are new to ui design use a tool like netbeans.and analyze generated codes
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26060587
type: QuestionComment

http://stackoverflow.com/comment/41030374
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26170234
type: QuestionComment
has text: No, include in your post so we see what you're doing. Assuming rye doing it right, but not getting the results you expect suggest you're doing something wrong

http://stackoverflow.com/q/26100034
answer count: 1
has body: i have the following: public &lt;T extends Node&gt; T create(Class&lt;T&gt; classType, String id, Transaction t){ T obj; try { NodeKey nodeKey = new NodeKey(classType, id); obj = classType.getConstructor(NodeKey.class, Transaction.class).newInstance(nodeKey, t); add(obj, t); return obj; } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } has you can see, i "build" NodeKey nodeKey = new NodeKey(classType, id);; I want to be able to overload the above method accepting just NodeKey and Transaction, but the i don't know how can i tell to generics that the T type is the Class returned by a method like nodeKey.getUserType(). Is this possible?
tagged with: generics
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40900716
has title: generic type inside parameter
type: Question
has answer: http://stackoverflow.com/a/26100089
score: 0

http://stackoverflow.com/q/26106297
has body: I have the following code: Controller.java: package Test; import java.applet.Applet; import java.awt.Color; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Controller extends Applet implements Runnable, KeyListener { private Robot robot = new Robot(); @Override public void init() { setSize(800, 480); setBackground(Color.BLACK); setFocusable(true); addKeyListener(this); } @Override public void start() { Thread thread = new Thread(this); thread.start(); } public void run() { try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } ... Do Stuff .... } @Override public void destroy() { // TODO Auto-generated method stub super.destroy(); } @Override public void stop() { // TODO Auto-generated method stub super.stop(); } @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_CONTROL: robot.fire(); break; } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } } Robot.java package Test; import java.util.Timer; import java.util.TimerTask; public class Robot { private Timer timer = new Timer(); private int firerate = 2500; public Robot() { } public void fire() { timer.schedule(new TimerTask() { @Override public void run() { System.out.println("2 Seconds!"); } }, firerate); } } I have a thread which runs updates in intervals of 17 ms. In the Robot class I make the robot do something 2.5 seconds each time after CTRL is pressed My questions are as follows: Since Thread is used in the Main class and Timer is used in the Robot Class (both implement run() function): a. Do those two methods interrupt each other? b. Are there any pros / cons in using those two together? c. Is there a way to use Thread for scheduling tasks such as this? Thanks in advance.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40914399
has answer: http://stackoverflow.com/a/26106390
has comment: http://stackoverflow.com/comment/40914229
score: 0
accepted answer: http://stackoverflow.com/a/26106390
answer count: 1
has title: Timer and Thread Questions
tagged with: timer
tagged with: multithreading
type: AnsweredQuestion

http://stackoverflow.com/a/26145731
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26145635
score: 2
answers question: http://stackoverflow.com/q/26145635
has body: Your error is in: for ( int i=0; i &lt;= rows ;i++) { for ( int a=0; a&lt;= columns ;a++) { The issue is that i starts at 0 and goes all the way to rows (same with a and columns) The way to fix this is to simply change: int i=0 to int i=1 And do the same for a. This is known as an "Off by one error" and is common enough to have it's own name. (you're not alone :) ) You could also change both of the &lt;= to just &lt; to fix this problem.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26104738
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/79667526
downvote count: 1
has comment: http://stackoverflow.com/comment/78958069
accepted answer of: http://stackoverflow.com/q/26102870
answers question: http://stackoverflow.com/q/26102870
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/79677451
score: -1
has comment: http://stackoverflow.com/comment/78957273
has body: Consider to use Java EE and remote EJBs. You can use an Application Server which uses NIO, if that is important to you (I guess most/ all do these days). E.g. have a look at Wildfly. Using a Java EE Application Server will get you a more stable solution with less code in shorter time than when implementing the low-level socket handling etc. yourself.

http://stackoverflow.com/a/26157238
has body: Problem in "hibernate.hbm2ddl.auto" create Creates new db in every time you start your application. Must be "update" instead "create"
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26104797
answers question: http://stackoverflow.com/q/26104797

http://stackoverflow.com/comment/40963118
type: Comment
score: 0
has text: U need to Initialize the book list first with out that u wont be able to add any element that will be having null value.
type: QuestionComment
comment on: http://stackoverflow.com/q/26133031

http://stackoverflow.com/a/26071312
answers question: http://stackoverflow.com/q/26071237
score: 0
has body: ? Is a wild card suggesting "anything". In ur example it means list of all classes which extend Pet. Could be Dog or Cat or any animal which is a Pet
type: Answer

http://stackoverflow.com/a/26046145
has body: Since both array have same length so make this class HangarAdapter extends ArrayAdapter&lt;String&gt; { //shipDesc below is the second string array. String[] shipDesc = {"10 Planets Every 5 Secs \n 100$", "50 Planets Every 5 Secs \n 500$", "100 Planets Every 5 Secs \n 1500$", "500 Planets Every 4 Secs \n 3000$", "1000 Planets Every 4 Secs \n 7500$", "5000 Planets Every 4 Secs \n 15000$", "10000 Planets Every 3 Secs \n 50000$", "30000 Planets Every 3 Secs \n 100000$", "60000 Planets Every 3 Secs \n 500000$", "100000 Planets Every 1 Secs \n 1000000$"}; public HangarAdapter(Context context,String[] values) { super(context, R.layout.hangar_layout, values); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater theInflater = LayoutInflater.from(getContext()); View theView = theInflater.inflate(R.layout.hangar_layout, parent, false); TextView TextView1 = (TextView) theView.findViewById(R.id.textView1); //TextView2 Is the text view i want the second string array to go into TextView TextView2 = (TextView) theView.findViewById(R.id.textView2); TextView1.setText(getItem(position)); TextView2.setText(shipDesc[position]) ImageView theImageView = (ImageView) theView.findViewById(R.id.imageView); return theView; }
accepted answer of: http://stackoverflow.com/q/26044993
answers question: http://stackoverflow.com/q/26044993
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41060273
type: Comment
has text: Following code would output "true, false, false": public class HelloWorld{ public static void main(String []args){ String s1 = "Hello"; String s2 = "Hello"; String s3 = new String("Hello"); String s4 = new String(new char[] {'H', 'e', 'l', 'l', 'o'}); System.out.println(s1 == s2); System.out.println(s1 == s3); System.out.println(s1 == s4); } }
score: 1
comment on: http://stackoverflow.com/a/26158505
type: AnswerComment

http://stackoverflow.com/comment/41069956
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26191909
score: 0
has text: @ElliottFrisch That's ok. I am also looking forward the answer for this.

http://stackoverflow.com/q/26087645
has comment: http://stackoverflow.com/comment/40878273
has comment: http://stackoverflow.com/comment/40878227
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26087664
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/40878239
score: 2
tagged with: unreachable-statement
answer count: 1
downvote count: 0
has body: I am doing the android tutorial and in the Adding Actions Buttons part, openSearch() and openSettings() are undefined. So I made them as private voids in the same class. In the switch, though, openSearch(); is apparently unreachable. When I delete that case, the method in the next case is unreachable. Here is my code. return super.onOptionsItemSelected(item); // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_search: openSearch(); return true; case R.id.action_settings: openSettings(); return true; default: return super.onOptionsItemSelected(item); } private void openSettings() { Toast.makeText(this, "Search button pressed", Toast.LENGTH_SHORT).show(); } private void openSearch() { Toast.makeText(this, "Search button pressed", Toast.LENGTH_SHORT).show(); }
tagged with: android
has title: Android tutorial switch 1st case method is unreachable
favorite count: 0

http://stackoverflow.com/comment/41073943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26194191
has text: @Aabbccc Did you fix the second problem? (`ab<= text.length();`)
score: 0

http://stackoverflow.com/a/26100253
has body: The first element of an array has the index 0. The last valid index of your array is lengde-1. Try this: for (int i=0; i &lt; lengde; i++) { System.out.println((i) + (" give a number")); minTabell[i] = keyboard.nextInt(); } To print the array, i suggest the following: System.out.println(Arrays.toString(minTabell));
has comment: http://stackoverflow.com/comment/40901081
score: 0
has comment: http://stackoverflow.com/comment/40901053
answers question: http://stackoverflow.com/q/26100116
type: Answer

http://stackoverflow.com/comment/40968933
type: Comment
has text: java.lang.NullPointerException.(NullPointerException.java:36) at com.ibm.as400.access.SocketContainerUnix.getInputStream(SocketContainerUnix.java:65) at com.ibm.as400.access.AS400ImplRemote.signonConnect(AS400ImplRemote.java:1834) at com.ibm.as400.access.AS400ImplRemote.getConnection(AS400ImplRemote.java:957) at
comment on: http://stackoverflow.com/a/26116671
score: 0
type: AnswerComment

http://stackoverflow.com/a/26041515
has body: It is probably this bug: https://javafx-jira.kenai.com/browse/RT-38490 ...which is fixed in the latest 8u40 early access build.
accepted answer of: http://stackoverflow.com/q/26039910
has comment: http://stackoverflow.com/comment/40802082
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26039910
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26122284
has body: I have a solution, but it's a little hacky, let's assume the return type for foo is String: import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; ... final Date fixedDate = ...; MyClass myObject = mock(MyClass.class); when(myObject.foo(anyString(), any(Date.class))).thenAnswer(new Answer&lt;String&gt;() { public String answer(InvocationOnMock invocation) throws Throwable { // Switch the 2nd argument invocation.getArguments()[1] = fixedDate; // Then call the real method return (String) invocation.callRealMethod(); } }); With MyClass being for example: public class MyClass { public String foo(String s, Date d) { return s + d; } } EDIT: In your last example with ImageSorter, i think you don't need Mockito, a simple decorator would do the trick: public interface ImageSorter { void sortImages(Images images, User user); void sortImages(Images images, User user, Date date); } public class ImageSorterDecorator implements ImageSorter { final ImageSorter delegate; final Date fixedDate; public ImageSorterDecorator (ImageSorter delegate, Date fixedDate){ this.delegate = delegate; this.fixedDate = fixedDate; } public void sortImages(Images images, User user){ delegate.sortImages(images, user, fixedDate); } public void sortImages(Images images, User user, Date date){ delegate.sortImages(images, user, fixedDate); } }
has comment: http://stackoverflow.com/comment/40967504
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40967138
answers question: http://stackoverflow.com/q/26122060
upvote count: 2

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26074182
tags question: http://stackoverflow.com/q/26157606
tags question: http://stackoverflow.com/q/26111826
tags question: http://stackoverflow.com/q/26147651
tags question: http://stackoverflow.com/q/26177772
tags question: http://stackoverflow.com/q/26192322
tags question: http://stackoverflow.com/q/26092713
tags question: http://stackoverflow.com/q/26183287
tags question: http://stackoverflow.com/q/26041012
tags question: http://stackoverflow.com/q/26182853
tags question: http://stackoverflow.com/q/26092632
tags question: http://stackoverflow.com/q/26078895
tags question: http://stackoverflow.com/q/26110579
tags question: http://stackoverflow.com/q/26080044
type: Tag
tags question: http://stackoverflow.com/q/26065262
tags question: http://stackoverflow.com/q/26113798
tags question: http://stackoverflow.com/q/26077944

http://stackoverflow.com/comment/40887339
comment on: http://stackoverflow.com/a/26089136
has text: I used the copy() method for this, is it the best way? Also, i didnt understand why that happened, each object should have its own attributes, if not it destroys the holy purpose of the Super Class... This only happens with arrays?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40844422
type: AnswerComment
type: Comment
has text: Depends. Is your query only supposed to be returning one result? If so, maybe it's not specific enough.
comment on: http://stackoverflow.com/a/26069014
score: 0

http://stackoverflow.com/a/26053670
has comment: http://stackoverflow.com/comment/40815828
answers question: http://stackoverflow.com/q/26053372
type: Answer
upvote count: 1
score: 1
has body: Exactly as Shashi says. If you have a message consumer and a call receive on it before calling connection.start() you get receive giving any messages. Start the connection and you'll get messages. Likewise if you have a message listener set, it won't start getting any messages until connection.start() is called. In both cases nothing will be received, even if messages are on the queue, until connection.start() is called. In terms of internals - is there some behaviour you're seeing that you can't explain? Can you clarify. JMS2.0 Contexts are auto-start so if you're using the new API call to start isn't required.
downvote count: 0

http://stackoverflow.com/a/26263194
type: Answer
downvote count: 0
has body: In the end there is no difference everything will end up in a ModelAndView eventually. When using the Model or ModelMap as a method argument it will get pre-populated with some values Path Variables Result of any @ModelAttribute annotated methods Any @SessionAttributes available to the controller In short it is the pre-populated model made available to the method. The Model is always created and is merged with the one you add/create with a ModelAndView.
upvote count: 8
answers question: http://stackoverflow.com/q/26147123
accepted answer of: http://stackoverflow.com/q/26147123
type: AcceptedAnswer
score: 8

http://stackoverflow.com/q/26076656
has comment: http://stackoverflow.com/comment/40857950
has title: Calculating angle between two points - java
type: Question
has comment: http://stackoverflow.com/comment/40858099
score: 10
upvote count: 13
tagged with: lines
has comment: http://stackoverflow.com/comment/40857986
answer count: 3
downvote count: 3
has body: I need to calculate the angle in degrees between two points, with a fixed point that is connected with the given two points by a line. Here is an image that illustrates what I need: Here is what I have tried so far: public static float GetAngleOfLineBetweenTwoPoints(float x1, float x2, float y1, float y2) { float xDiff = x2 - x1; float yDiff = y2 - y1; return (float) (Math.atan2(yDiff, xDiff) * (180 / Math.PI)); } It's pointless to say that it doesn't provide the correct answer.
tagged with: points
has answer: http://stackoverflow.com/a/30162305
has answer: http://stackoverflow.com/a/26076956
linked to: http://stackoverflow.com/q/7586063
favorite count: 0
has comment: http://stackoverflow.com/comment/40857949
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32843059
tagged with: angle
tagged with: java

http://stackoverflow.com/comment/110764274
type: Comment
has text: @workplaylifecycle If you care about time zones, how could you not care about changes to the rules defined within those time zones? For example, if your time zone was scheduled to go off of Daylight Saving Time (DST) later in the year on November 1 (“Fall back”) but your politicians suddenly decide to cancel that event and instead stay on DST year round, then your existing tzdata will be wrong by an hour for any date in the future after November 1. This example is not fiction, by the way.
type: AnswerComment
comment on: http://stackoverflow.com/a/38061562
score: 0

http://stackoverflow.com/comment/41061151
type: QuestionComment
comment on: http://stackoverflow.com/q/26186767
has text: I don't know what you are saying, it is working for me in java8 as well as java7. There might be some problem on your softwares or may be you are doing some other mistake.
score: 0
type: Comment

http://stackoverflow.com/q/26144060
tagged with: fxmlloader
tagged with: fxml
tagged with: java
tagged with: javafx
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26144453
has body: I'm trying to make a basic calculator application with JavaFX but I'm having trouble launching the application. This is the error 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:363) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303) 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:875) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157) at com.sun.javafx.application.LauncherImpl$$Lambda$48/815033865.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) Caused by: javafx.fxml.LoadException: /path/.../view/CalculatorScreen.fxml:10 at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2595) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2435) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2403) at calculator.Calculator.start(Calculator.java:27) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821) at com.sun.javafx.application.LauncherImpl$$Lambda$51/1284973402.run(Unknown Source) at com.sun.javafx.application.Platfo…
type: UnansweredQuestion
tagged with: controller
has answer: http://stackoverflow.com/a/39429774
has comment: http://stackoverflow.com/comment/40991798
has title: JavaFX Load Exception
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/134932720
score: 0
has text: Been awhile, now they're at: `https://www.oracle.com/java/technologies/java-archive-misc-downloads.html#jdk8demos`
type: Comment
comment on: http://stackoverflow.com/a/26138251
type: AnswerComment

http://stackoverflow.com/comment/40872647
comment on: http://stackoverflow.com/q/26084565
type: Comment
type: QuestionComment
has text: I think you will have to build an xml document or even a string of html instead of actual DOM elements.
score: 1

http://stackoverflow.com/comment/40993809
has text: YOY can't you use other libraries?? JSON really should be built into the JDK, but I'm guessing at this point Oracle knows whatever paradigm they picked would be viciously criticized by partisans of the other schemes. But it is impractical to build any semi-modern Java app without JSON support.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26150062

http://stackoverflow.com/comment/41199218
type: AnswerComment
has text: I figured out bullet #2 above by using URLConnection from java.net. Still working on #1 and #3.
type: Comment
comment on: http://stackoverflow.com/a/26255525
score: 0

http://stackoverflow.com/comment/41036583
type: QuestionComment
score: 0
has text: @cherry - Please post the text of a stack trace, and not a screen capture of Eclipse. Some folks can't read the tiny print, and future visitors cannot search for the text.
comment on: http://stackoverflow.com/q/26173513
type: Comment

http://stackoverflow.com/comment/40927176
score: 0
comment on: http://stackoverflow.com/a/26113505
type: Comment
has text: Yes,now the counter is starting Automatically.But after completing last Question timer is still starting.And how can i show a flow like 20 19 18.....till 0.
type: AnswerComment

http://stackoverflow.com/a/26125632
has body: Your problem is that you use set() on an empty temp list. set() replaces an element in the array, but the array is empty: no element to replace. What you need to do is add() into the temp list instead of using set(). The elements will be added sequentially, so in the right order and you do not need the total variable for that. Now, it will get a little different when you replace back the elements in words. The temp list will have elements indexed from 0 to (last - first), and you want to replace in words the elements from first to last. For that, I think the following loop will work: for (String word : temp) { words.set(first++, word); } Note: because you know in advance the final size of temp (i.e. last - first + 1), you should preallocate it using: ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;(last - first + 1);
score: 0
has comment: http://stackoverflow.com/comment/40953028
has comment: http://stackoverflow.com/comment/40947336
has comment: http://stackoverflow.com/comment/40953048
type: Answer
answers question: http://stackoverflow.com/q/26125164

http://stackoverflow.com/comment/40941149
comment on: http://stackoverflow.com/q/26122060
score: 0
has text: Why do you want to do this? Your test is now executing code differently than it will at deployment. Are you doing this because your test scenario is written for a specific date instance?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26138964
score: 1
has comment: http://stackoverflow.com/comment/40972834
has comment: http://stackoverflow.com/comment/40972775
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40972875
has body: I don't know the types of the arguments and classes you're using, so I can't provide a complete example, but you can stub using callbacks with the Answer&lt;T&gt; interface: Mockito.doAnswer(new Answer() { Object answer(InvocationOnMock invocation) { ImagesSorter mock = (ImagesSorter) invocation.getMock(); Object[] args = invocation.getArguments(); return mock.sortImages((List&lt;Image&gt;) args[0], (UserInfo) args[1], fakeNowDate); } }).when(imagesSorterSpy).sortImages(imagesAsInsertionOrder, user);
has comment: http://stackoverflow.com/comment/40971745
has comment: http://stackoverflow.com/comment/40972935
accepted answer of: http://stackoverflow.com/q/26138715
upvote count: 1
has comment: http://stackoverflow.com/comment/40973094
has comment: http://stackoverflow.com/comment/41005908
has comment: http://stackoverflow.com/comment/40973039
answers question: http://stackoverflow.com/q/26138715

http://stackoverflow.com/comment/40803030
has text: its a java language,
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26046577

http://stackoverflow.com/comment/40943830
type: AnswerComment
has text: @talex I think I wouldn't even understand the correct answer - that would be too much of a responsibility!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26118747

http://stackoverflow.com/comment/41061610
type: Comment
type: QuestionComment
has text: that doesnt mean you are in the same local network. Please make sure you are or just give hamchi a try anyway, or any other tunnel client.
score: 0
comment on: http://stackoverflow.com/q/26185592

http://stackoverflow.com/q/26080696
linked to: http://stackoverflow.com/q/5621338
tagged with: jpanel
score: -1
has answer: http://stackoverflow.com/a/26080729
answer count: 2
has title: Working with layout managers
upvote count: 0
tagged with: layout-manager
favorite count: 0
possible better answer: http://stackoverflow.com/a/26080720
tagged with: swing
accepted answer: http://stackoverflow.com/a/26080729
has answer: http://stackoverflow.com/a/26080720
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10213100
tagged with: java
downvote count: 1
type: Question
has body: I'm trying to make a kitchen display system using a FlowLayout and I'm trying to figure out a way to add another panel on the 2nd row when the first row is already full. The width of the GUI will change according to user preference. When wider, it should show more of the components per row.

http://stackoverflow.com/comment/41039883
type: AnswerComment
has text: What can of 'cast' error message do you get ? I added the classes I'm importing, maybe you're using something else that java.util.Properties... Otherwise, I just tested it, provided you can get the File, you should be fine.
comment on: http://stackoverflow.com/a/26164779
score: 0
type: Comment

http://stackoverflow.com/comment/41058249
has text: make use of some `loop`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26185522

http://stackoverflow.com/comment/40817155
comment on: http://stackoverflow.com/a/26051281
has text: Also, if I am using a nine patch image, are the XML ImageView settings you've specified remain except for the centreCrop?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26129012
answers question: http://stackoverflow.com/q/26128526
type: Answer
downvote count: 0
score: 3
has body: Use DecimalFormat to format numbers: DecimalFormat df = new DecimalFormat("#,###.####", new DecimalFormatSymbols(Locale.US)); System.out.println(df.format((double)12.000000)); System.out.println(df.format((double)1234.56781)); System.out.println(df.format((double)123456789.012)); This pattern here is only necessary to cut after the 4th decimal place, like your second example suggested. If you don't want that new DecimalFormat("", new DecimalFormatSymbols(Locale.US)) would also work. (It is necessary to set the format symbols or the symbols of the current locale will be used. These symbols may differ from the desight ones) The output will be 12 1,234.5678 123,456,789.012
upvote count: 3

http://stackoverflow.com/q/26053011
has answer: http://stackoverflow.com/a/37574919
favorite count: 0
tagged with: google-drive-api
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37572197
score: 2
tagged with: video
tagged with: java
type: Question
downvote count: 0
has body: I would like to retrieve the download link for large video files. I have no problems with small video files but with large videos, the response from the server is that the file "exceeds the maximum file size that Google can scan" I want to use the link as the source to a video tag. But because that link gives me the error, I can't use it. I'm using the Java SDK and I'm using File.getWebContentLink() to get the link. I've tried getDownloadLink() but that one doesn't even work. Basically, is there anyway I can get the download link for large video files?
has title: How to Retrieve the Download Link for Large Video Files
answer count: 2

http://stackoverflow.com/comment/41011091
type: Comment
comment on: http://stackoverflow.com/a/26144646
has text: @John there is no space after `new` in my code because it's part of the static method name in `Files` class.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26159630
score: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26159737
has answer: http://stackoverflow.com/a/26159750
has answer: http://stackoverflow.com/a/26159842
has answer: http://stackoverflow.com/a/26159757
tagged with: java
has body: I am giving a time interval in the form of a input file . INPUT FILE 2 3 //First start time and second one end time 5 6 9 11 3 10 I want to sort the interval on the basics of start time i.e. (2,3) , (3,10) ,(5,6) ,(9,11) Does i have to make a structure of this. or it can be done straight. My approach: class Interval implements Comparable&lt;Interval&gt;{ private int start , end; public Interval(int start , int end){ this.start = start; this.end = end; } public int compareTo(Interval o) { // TODO Auto-generated method stub if(o==null) return -1; return start-o.start; } } I am not getting the output of it. Is there any better method Please HElp me.
type: Question
has comment: http://stackoverflow.com/comment/41009846
upvote count: 1
has answer: http://stackoverflow.com/a/26159736
downvote count: 1
linked to: http://stackoverflow.com/q/26125557
favorite count: 0
has comment: http://stackoverflow.com/comment/41009614
has title: Sorting intervals in java

http://stackoverflow.com/a/26193296
downvote count: 0
type: Answer
has body: Add javamail.jar to your tomcat lib folder.
score: 1
has comment: http://stackoverflow.com/comment/41085954
upvote count: 1
answers question: http://stackoverflow.com/q/26192867
accepted answer of: http://stackoverflow.com/q/26192867
type: AcceptedAnswer

http://stackoverflow.com/q/26059095
has comment: http://stackoverflow.com/comment/40827360
possible better answer: http://stackoverflow.com/a/26059210
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26059380
has body: We are prototyping a game for android devices using libgdx. For the screen management we are using a enum with the Screen names to get a abstraction layer for the ScreenManager Class. So you can do something like this to show a new screen and hide the old screen:ScreenManager.getInstance().show( Screens.LOGIN ); Now we want to use the back button of the device to jump back through the screens or exit the app. So we wanted to create a field inside each enum value to declare the parentScreen and use it if the back button is pressed. Unfortunately its not possible to use enum own fields inside itself and we get the following error: Cannot refer to the static enum field Screens.LOGIN within an initializer on protected Screens parentScreen = Screens.LOGIN;. Maybe anyone has a idea how this can be solved. Here is the actual enum: /** * Used to hide actual implementations of Screen interface and expose only "pointer objects". * All of them are declared with package-private class modifier. */ public enum Screens { SPLASH { @Override protected Screen getScreenInstance( MyGdxGame game ) { return new SplashScreen( game ); } }, LOGIN { @Override protected Screen getScreenInstance( MyGdxGame game ) { return new LoginScreen( game ); } }, GAME { protected Screens parentScreen = Screens.LOGIN; @Override protected Screen getScreenInstance( MyGdxGame game ) { return new GameScreen( game ); } }, CREDITS { protected Screens parentScreen = Screens.LOGIN; @Override protected Screen getScreenInstance( MyGdxGame game ) { return new CreditsScreen( game ); } }; protected Screens parentScreen = null; /** Every enum member musts override this method and it will be visible only inside the package */ protected abstract Screen getScreenInstance( MyGdxGame game ); } This function should show the screens parent: /** * Execute when the user clicks the back button * Default called by the AbstractScreen Class */ public void backButton() { this.show( this.currentScreen.parentScreen ); } Thanks for your…
has title: Java - Use enum values inside itself
tagged with: android
has comment: http://stackoverflow.com/comment/40825564
has comment: http://stackoverflow.com/comment/40825878
type: AnsweredQuestion
tagged with: enums
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26059380
type: Question
has answer: http://stackoverflow.com/a/26059210
tagged with: libgdx

http://stackoverflow.com/comment/40845926
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26069538
has text: Maybe I am misreading your question. It seemed to me the settings are editable by the user and then sent to the backend anyway, so the question was just how to store them, and not whether the backend should be aware of them.

http://stackoverflow.com/a/26034808
has body: I solved problem after selecting JavaSE-1.8 execution environment in eclipse. It shows compatible jars jre1.8.0_20[perfect match]
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26034338
answers question: http://stackoverflow.com/q/26034338
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/42631431
score: 6
has body: I have read this whole thread few minutes ago. Nevertheless I was confused why should we use checkNotNull. Then look over Precondition class doc of Guava and I got what I expected. Excessive use of checkNotNull will degrade performance definitely. My thought is checkNotNull method is worth required for data validation which comes from user directly or very end API to user interaction. It shouldn't be used in each and every methods of internal API because using it you can't stop exception rather correct your internal API to avoid Exception. According to DOC: Link Using checkNotNull: public static double sqrt(double value) { Preconditions.checkArgument(value &gt;= 0.0, "negative value: %s", value); // calculate the square root } Warning about performance The goal of this class is to improve readability of code, but in some circumstances this may come at a significant performance cost. Remember that parameter values for message construction must all be computed eagerly, and autoboxing and varargs array creation may happen as well, even when the precondition check then succeeds (as it should almost always do in production). In some circumstances these wasted CPU cycles and allocations can add up to a real problem. Performance-sensitive precondition checks can always be converted to the customary form: if (value &lt; 0.0) { throw new IllegalArgumentException("negative value: " + value); }
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/91186987
answers question: http://stackoverflow.com/q/26184322
has comment: http://stackoverflow.com/comment/103828081
has comment: http://stackoverflow.com/comment/91189797
type: Answer

oop
tags question: http://stackoverflow.com/q/26114936
tags question: http://stackoverflow.com/q/26125721
tags question: http://stackoverflow.com/q/26037632
tags question: http://stackoverflow.com/q/26110310
tags question: http://stackoverflow.com/q/26072184
tag name: oop
tags question: http://stackoverflow.com/q/26067017
tags question: http://stackoverflow.com/q/26184901
tags question: http://stackoverflow.com/q/26153675
tags question: http://stackoverflow.com/q/26045831
tags question: http://stackoverflow.com/q/26090567
tags question: http://stackoverflow.com/q/26113663
tags question: http://stackoverflow.com/q/26111136
tags question: http://stackoverflow.com/q/26076189
tags question: http://stackoverflow.com/q/26127934
tags question: http://stackoverflow.com/q/26167178
tags question: http://stackoverflow.com/q/26090063
tags question: http://stackoverflow.com/q/26107409
tags question: http://stackoverflow.com/q/26073509
tags question: http://stackoverflow.com/q/26055881
tags question: http://stackoverflow.com/q/26087508
tags question: http://stackoverflow.com/q/26161502
tags question: http://stackoverflow.com/q/26075240
tags question: http://stackoverflow.com/q/26083938
tags question: http://stackoverflow.com/q/26109688
tags question: http://stackoverflow.com/q/26042391
tags question: http://stackoverflow.com/q/26151072
tags question: http://stackoverflow.com/q/26194290
tags question: http://stackoverflow.com/q/26125971
tags question: http://stackoverflow.com/q/26070920
type: Tag
tags question: http://stackoverflow.com/q/26151838
tags question: http://stackoverflow.com/q/26118322

http://stackoverflow.com/comment/40900756
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26055514
has text: @AnuragSharma That's a good idea, but I use JC 2.1.2, there's no such event here. But it doesn't matter, because I still can use EVENT_STATUS_COMMAND and check if ProactiveHandler is available. But, as far as I see, ProactiveHandler becomes available only after phone reset
score: 0

http://stackoverflow.com/a/26044403
downvote count: 0
score: 1
has body: Yes and no. In theory an interface cannot have any implementation because it defines a contract and just that. However in Java 8 they added default methods http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html which look a lot like what you need in here.
answers question: http://stackoverflow.com/q/26044356
upvote count: 1
type: Answer

http://stackoverflow.com/comment/40941584
score: 3
comment on: http://stackoverflow.com/q/26122728
type: Comment
type: QuestionComment
has text: `String[] array = s.split( "\\s+" );`

binary
tags question: http://stackoverflow.com/q/26172458
tags question: http://stackoverflow.com/q/26163306
tags question: http://stackoverflow.com/q/26122266
tags question: http://stackoverflow.com/q/26192615
tags question: http://stackoverflow.com/q/26098541
tag name: binary
tags question: http://stackoverflow.com/q/26113533
tags question: http://stackoverflow.com/q/26130771
type: Tag
tags question: http://stackoverflow.com/q/26085302

http://stackoverflow.com/a/26039058
has comment: http://stackoverflow.com/comment/40821802
type: Answer
has body: Following code will iterate through the cells of a row. it will keep a count for each cell it encounters(cellCount). another couont(nullCount), is incremented only if the cell is blank. if both these counts are equal, row is empty. boolean isEmptyRow = false; int cellCount = 0; int nullCount = 0; Iterator&lt;Cell&gt; cellIterator = row.iterator(); while (cellIterator.hasNext()) { cellCount++; Cell cell = (Cell) cellIterator.next(); if ((cell == null) || ((cell != null) &amp;&amp; (cell.getCellType() == Cell.CELL_TYPE_BLANK))) { nullCount++; } } if ((cellCount != 0) &amp;&amp; (nullCount != 0) &amp;&amp; (cellCount == nullCount)) { //If nullCount &amp; cellCouont are same, Row is empty isEmptyRow = true; }
has comment: http://stackoverflow.com/comment/40822266
accepted answer of: http://stackoverflow.com/q/26035706
answers question: http://stackoverflow.com/q/26035706
has comment: http://stackoverflow.com/comment/40822036
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40822261
score: 0

http://stackoverflow.com/comment/40969754
has text: Help me !...........
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26138027

http://stackoverflow.com/comment/41068511
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26185015
type: Comment
has text: @IsaacWoods btw it occurs that the other option is heavily overloading your `attachBufferData` method instead. Still messy and lots of typing, but maybe slightly cleaner and more in the spirit of things.

http://stackoverflow.com/a/26163111
has comment: http://stackoverflow.com/comment/43879277
has comment: http://stackoverflow.com/comment/42111263
has body: Thanks for reporting this issue. We have fixed the "GlassFish Tools for Luna" entry on Eclipse Marketplace. Please try installing again. In the future, you will get a more expedient response to questions regarding GlassFish Tools for Eclipse, but posting on the following forum: https://community.oracle.com/community/java/java_development_tools/application_development_in_java/enterprise_pack_for_eclipse
has comment: http://stackoverflow.com/comment/43982333
score: 0
has comment: http://stackoverflow.com/comment/42108988
type: Answer
answers question: http://stackoverflow.com/q/26157539

http://stackoverflow.com/comment/41078120
type: QuestionComment
has text: I'm not an expert but it seems that using a BKS keystore may be available on both Android and standard Java, or you can convert from one to the other as in [this](http://stackoverflow.com/questions/22341745/how-to-generates-jceks-keystore-in-android) question.
score: 0
comment on: http://stackoverflow.com/q/26180405
type: Comment

http://stackoverflow.com/comment/40944245
type: AnswerComment
has text: this is what i've tried http://stackoverflow.com/questions/26124143/how-to-run-progress-bar-in-java
comment on: http://stackoverflow.com/a/26122871
type: Comment
score: 0

http://stackoverflow.com/q/26073016
answer count: 2
has comment: http://stackoverflow.com/comment/40851780
has answer: http://stackoverflow.com/a/26073585
accepted answer: http://stackoverflow.com/a/26073585
has comment: http://stackoverflow.com/comment/40852140
has comment: http://stackoverflow.com/comment/40851416
has comment: http://stackoverflow.com/comment/40885688
has answer: http://stackoverflow.com/a/26073082
has body: i am currently developing a mobile application using eclipse. right now o am facing problem for bringing checked check box to new page... this is code for the check box page... page name : mcpakej1.xml ` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:layout_centerHorizontal="true" tools:context="com.example.mobilecatering.MainActivity" > <CheckBox android:id="@+id/pakejA1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView2" android:layout_below="@+id/textView2" <CheckBox android:id="@+id/pakejA2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/nasiputih1" android:layout_below="@+id/nasiputih1" android:text="Nasi Beriyani" /> <CheckBox android:id="@+id/pakejA3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/nasiberiyani1" android:layout_below="@+id/nasiberiyani1" android:text="Nasi Minyak" /> <CheckBox android:id="@+id/pakejA4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView3" android:layout_below="@+id/textView3" android:text="Ayam Masak Kurma" /> <CheckBox android:id="@+id/pakejA5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/ayamkurma1" android:layout_below="@+id/ayamkurma1" android:text="Ayam Masak Lemak" /> <CheckBox android:id="@+id/pakejA6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/ayamlemak1" an…
has comment: http://stackoverflow.com/comment/40851410
tagged with: android
has comment: http://stackoverflow.com/comment/40851650
tagged with: checkbox
has comment: http://stackoverflow.com/comment/40851924
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40851560
possible better answer: http://stackoverflow.com/a/26073082
tagged with: java
tagged with: eclipse
has title: bring checked check box values to other pages
type: Question
score: 0

barcode
tags question: http://stackoverflow.com/q/26126481
tags question: http://stackoverflow.com/q/26037791
type: Tag
tags question: http://stackoverflow.com/q/26119879
tag name: barcode

http://stackoverflow.com/q/26157170
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41009825
tagged with: java
has answer: http://stackoverflow.com/a/36569588
type: Question
has answer: http://stackoverflow.com/a/36569360
score: 0
tagged with: jakarta-mail
has title: Not able to send html mail body along with xls file as attachment
answer count: 3
has comment: http://stackoverflow.com/comment/41010273
has body: I am using below code to send xls file and showing some data in tabular format.I am able to get xls file as an attachment but the html code is not coming in tabular format. If I uncomment msg.setContent(body, "text/html") line then i only get table format in body but the attachment is not there public synchronized static void sendEmail(Session session, String toEmail, String subject, String body, String recipient) { try { MimeMessage msg = new MimeMessage(session); // msg.addHeader("Content-type", "text/html"); msg.setFrom(new InternetAddress("abc@xyz", "abc@xyz")); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail, false)); msg.setReplyTo(InternetAddress.parse(recipient, false)); msg.setSubject(subject); msg.setSentDate(new Date()); //================================================================== // create and fill the first message part MimeBodyPart mbp1 = new MimeBodyPart(); mbp1.setText(body); // create the second message part MimeBodyPart mbp2 = new MimeBodyPart(); // attach the file to the message FileDataSource fds = new FileDataSource("D:/Shashank/output.xls"); mbp2.setDataHandler(new DataHandler(fds)); mbp2.setFileName(fds.getName()); // create the Multipart and add its parts to it Multipart mp = new MimeMultipart(); mp.addBodyPart(mbp1); mp.addBodyPart(mbp2); // add the Multipart to the message msg.setContent(mp); // msg.setContent(body, "text/html"); msg.saveChanges(); //================================================================== System.out.println("Message is ready"); Transport.send(msg); System.out.println("EMail Sent Successfully!!"); } catch (Exception e) { e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/36569501
linked to: http://stackoverflow.com/q/14744197

http://stackoverflow.com/q/26147044
tagged with: cronexpression
has body: I'm trying to have my code execute on a fixed schedule, based on a Spring cron expression. I would like the code to be executed every day at 1:01:am. I tried the following expression, but this didn't fire up for me. What's wrong with the syntax here? @Scheduled(cron = "0 1 1 ? * *") public void resetCache() { // ... }
answer count: 6
has answer: http://stackoverflow.com/a/48310253
has comment: http://stackoverflow.com/comment/83422135
tagged with: spring-scheduled
linked to: http://stackoverflow.com/q/11499740
has answer: http://stackoverflow.com/a/37966649
has answer: http://stackoverflow.com/a/26148652
favorite count: 0
upvote count: 307
has answer: http://stackoverflow.com/a/38514136
tagged with: cron
has answer: http://stackoverflow.com/a/26147143
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/76617776
has answer: http://stackoverflow.com/a/37710207
tagged with: spring
has comment: http://stackoverflow.com/comment/76617753
has comment: http://stackoverflow.com/comment/83422053
downvote count: 0
tagged with: java
has title: Spring cron expression for every day 1:01:am
score: 307
type: Question

http://stackoverflow.com/q/26086783
answer count: 1
tagged with: paintcomponent
favorite count: 0
tagged with: jframe
score: 2
type: AnsweredQuestion
tagged with: paint
downvote count: 0
has answer: http://stackoverflow.com/a/26089255
accepted answer: http://stackoverflow.com/a/26089255
has body: I'm using Netbeans (JDK 1.7) on Windows 8.1 to run an application that: Uses the Graphics object to draw a frog in the paintComponent() of a 400x400 JPanel; Adds the panel to a JFrame for displaying purposes; This should be a very simple task, of course, but I'm having trouble understanding a specific behavior in this application. Here is the problem: the very first time the window is displayed, the panel shows up at an offset (image below) when it shouldn't. I'm trying to understand why this is happening and how to solve it: After one of the arrow keys are pressed on the keyboard the drawing gets displaced 5 pixels to the left/right/up/down. However, when this happens, the entire JPanel seems to be moved to the (0,0) coordinate of the window (which is what I expected from the beginning), thus moving the drawing a lot more than it should: I painted a black border on the edges of the panel to make the problem more apparent. Here is the Short, Self Contained, Correct (Compilable), Example: KAfrog.java: import javax.swing.SwingUtilities; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class KAfrog { public static void main( String args[] ) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } } // end of anonymous innerclass ); // end of invokeLater } private static void createAndShowGUI() { System.out.println("Created GUI on EDT? " + SwingUtilities.isEventDispatchThread()); Window janela = new Window("Khan Academy Frog"); janela.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } // end of anonymous innerclass ); // end of addWindowListener } } Window.java: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.LineBorder; class DrawingPanel extends JPanel { private int x = 50, y = 50; pu…
tagged with: java
type: Question
has title: Custom painting JPanel offsets the drawing
tagged with: jpanel
upvote count: 2

http://stackoverflow.com/comment/40951213
comment on: http://stackoverflow.com/q/26127598
score: 0
type: Comment
type: QuestionComment
has text: @AndrewBuxa You're not using any array inside the try block. So there is no chance that this exception block will be reached.

http://stackoverflow.com/comment/41032673
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26167763
type: Comment
has text: First thank you. I read the example you gave and the only thing is I need to use URL instead of track id

http://stackoverflow.com/comment/40919296
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26109383
has text: If anyone has any suggestions, feel free to help me out. This is going to drive me nuts.
score: 0

http://stackoverflow.com/a/26142648
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26141239
answers question: http://stackoverflow.com/q/26141239
type: Answer
upvote count: 1
score: 1
has body: You are traversing the matrix as if it was a binary tree: for every element, you visit two sons, namely (i, j+1) and (i+1, j). The starting node is (0, 0). On the first recursion level, you visit (0, 1) and (1, 0). On the second level, (0, 2), (1, 1), (1, 1) and (2, 0) [note the double visit]. On the third level, (0, 3), (1, 2), (2, 1), (1, 2), (2, 1), (1, 2), (2, 1) and (3, 0) [note the triple visits]. And so on. (The actual visits are not performed in this order.) The fix: From a node, go to the left; go down only for the first node of a row. public void traversingMatrix(int i, int j) { if (i &gt;= maxRow || j &gt;= maxCol) { return; } traversingMatrix(i, j + 1); if (j == 0) traversingMatrix(i + 1, j); }
type: AcceptedAnswer

twitter4j
tags question: http://stackoverflow.com/q/26072639
tags question: http://stackoverflow.com/q/26074134
tags question: http://stackoverflow.com/q/26039816
type: Tag
tags question: http://stackoverflow.com/q/26157632
tag name: twitter4j
tags question: http://stackoverflow.com/q/26055767
tags question: http://stackoverflow.com/q/26038285

http://stackoverflow.com/comment/40790128
type: Comment
comment on: http://stackoverflow.com/a/26035793
has text: Thank you! :) ur code did help me understand the logic better. I was later corrected that constraint was 10^8 and not 10^4. Anyways I edited that part and got it done. Thanks for ur efforts :)
type: AnswerComment
score: 0

http://stackoverflow.com/q/26118012
has answer: http://stackoverflow.com/a/26118938
has answer: http://stackoverflow.com/a/28142389
score: 0
answer count: 2
tagged with: teradata
has comment: http://stackoverflow.com/comment/40932791
has title: JDBC Connectivity thru Java to Teradata
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40932877
tagged with: java
accepted answer: http://stackoverflow.com/a/26118938
possible better answer: http://stackoverflow.com/a/28142389
type: Question
has body: I am getting an Null pointer exception while connecting to Teradata through Java method using Teradata driver: DriverManager.getConnection() Any ideas would be great.
has comment: http://stackoverflow.com/comment/40934055

http://stackoverflow.com/a/49189501
answers question: http://stackoverflow.com/q/26098867
score: 0
type: Answer
has body: You need to switch that window first then do operation what ever you want. You have to use below command for switch window. driver.switchTo().window("Window ID"); You can use below command for getting all opened windows unique ID. Set&lt;String&gt; windows = driver.getWindowHandles(); In your case, Please use below code for switch window. String vBaseWindowHandle = driver.getWindowHandle(); Set&lt;String&gt; windows = driver.getWindowHandles(); for(String temp : windows) { driver.switchTo().window(temp); } // Do code for new window driver.close(); driver.switchTo().window(vBaseWindowHandle); Fore more information related to how to handle windows and popup please go to below URL https://trickyautomationworld.blogspot.in/2018/03/how-to-handle-windows-in-selenium.html https://trickyautomationworld.blogspot.in/2018/03/how-to-handle-popup-in-selenium.html

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/26053546

http://stackoverflow.com/a/26172302
type: Answer
has body: You need to make use of extra variables to store the # totals. In my answer I use the array sum[] and reference it using the sum of the die minus two. import java.util.Random; import java.util.Scanner; public class ThrowingPairsOfDice { /** * main method simulates throwing 2 dice 1,000,000 times * */ public static void main(String[] args) { Random die1 = new Random(); Random die2 = new Random(); int throwOfDice=0; int [] sum = {0, 0, 0, 0, 0}; System.out.println("How many times should I throw two dice?"); Scanner kb = new Scanner(System.in); int numberOfTimes = kb.nextInt(); // throw the dice the number of times requested for (int i=1;i&lt;=numberOfTimes;i++) { int toss1 =die1.nextInt(5)+1; int toss2 =die2.nextInt(5)+1; throwOfDice = toss1 + toss2; System.out.println(toss1+ "+" +toss2+ "= " +throwOfDice); if (throwOfDice &lt; 7) sum[throwOfDice - 2]++; } for (int i=0;i&lt;=4;i++) { System.out.println("# of throws totalling " + (i + 2) + " = " + sum[i]); } } }
upvote count: 1
has comment: http://stackoverflow.com/comment/41033969
answers question: http://stackoverflow.com/q/26172083
has comment: http://stackoverflow.com/comment/41033677
score: 1
downvote count: 0

http://stackoverflow.com/a/26186262
downvote count: 0
score: 15
has comment: http://stackoverflow.com/comment/120836431
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26186261
accepted answer of: http://stackoverflow.com/q/26186261
type: Answer
upvote count: 15
has body: To open a link in a new tab (PDF or not) you must modify the HTML of that link from PDF to PDF To open a PDF in the browser you must make a server side change to the response header. In Java, you would do this: response.setContentType("application/pdf"); response.addHeader("content-disposition", "inline; filename=link_to_pdf.pdf"); Of key importance is the inline. If you put attachment, your browser will try to download it instead. You can read more here.

http://stackoverflow.com/comment/40846464
type: AnswerComment
type: Comment
has text: My opinion, those fall under point 3.
comment on: http://stackoverflow.com/a/26069770
score: 1

http://stackoverflow.com/a/26116895
answers question: http://stackoverflow.com/q/26116836
score: 0
has body: Try following: String test="ABCDEF (Self)"; test=test.replaceAll("\\(Self\\)", ""); System.out.println(test.trim()); Output : ABCDEF The dig is to use Regular Expressions for more on it visit this link. And the code won't have a problem if there is no Self in string.
type: Answer

http://stackoverflow.com/q/26050157
has title: Eclipse Check for redundant method calls
has comment: http://stackoverflow.com/comment/40809770
type: Question
has body: I have a bunch of methods calling each other. The actual code is not important here, but here is an example: void doStuff(){ doMoreStuff(); doEvenMoreStuff(); } void doMoreStuff(){ doEvenMoreStuff(); } void doEvenMoreStuff(){ // Do some stuff } As you can see, calling doStuff() causes doEvenMoreStuff() to be called twice. This isn't really a problem but it could help identify some problems and make my code cleaner. My question is, is there a way in Eclipse to check for things like this?
has answer: http://stackoverflow.com/a/26050211
has comment: http://stackoverflow.com/comment/40809656
tagged with: java
has comment: http://stackoverflow.com/comment/40809804
tagged with: eclipse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40809692
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40809871

http://stackoverflow.com/q/26176159
has body: Problem: Java/Swing application which shows separate JFrames on every connected display. I've found that display information from GraphicsEnvironment.getLocalGraphicsEnvironment() structure is invalid since the application start and the data are not updated dynamically when new monitor is connected or existing one disconnected. Is there some kind of "force refresh" or "update" procedure for graphic environment during application run?
has answer: http://stackoverflow.com/a/26177301
answer count: 2
has answer: http://stackoverflow.com/a/26176335
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: monitor
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
tagged with: refresh
has title: How to refresh GraphicsEnvironment.getLocalGraphicsEnvironment() structure when reconecting display outputs?

http://stackoverflow.com/comment/41034168
type: Comment
has text: I commented out the lines you did, and added `GridPane.setHalignment(rootGrid, HPos.CENTER);`, but the text and button are still left-aligned
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26169947

http://stackoverflow.com/a/26178678
has body: This is not very safe but you may try. On eclipse, if you're configured to see the source code, double click on SocketImpl to get its source code. Then create a package java.net in your project and create a class named SocketImpl and package java.net using this source code. Find the accept() method, to change its visibility to public. Change it from your BufferedServerSocketImpl as well. Implement all other methods required by your (new) abstract superclass. Remember: you're cheating the classloader. Be careful.
type: Answer
has comment: http://stackoverflow.com/comment/41045153
has comment: http://stackoverflow.com/comment/41045390
answers question: http://stackoverflow.com/q/26178168
has comment: http://stackoverflow.com/comment/41045279
score: 0
has comment: http://stackoverflow.com/comment/41045179

http://stackoverflow.com/q/26126425
tagged with: glassfish
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/40948979
answer count: 1
has comment: http://stackoverflow.com/comment/40948945
accepted answer: http://stackoverflow.com/a/26127258
favorite count: 0
upvote count: 2
has title: error while executing servlet programs
type: AnsweredQuestion
tagged with: netbeans
has body: while practising servlet programs i encountered this problem. and now i am facing this same problem in whichever project i create . dont know what i am doing wrong. i am using netbeans 8.1 and glass fish server . the error is :- HTTP Status 500 - Internal Server Error type Exception report messageInternal Server Error descriptionThe server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Error instantiating servlet class calc root cause com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class calc root cause java.lang.NoSuchMethodException: calc.<init>() note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs. GlassFish Server Open Source Edition 4.1 html code:- TODO supply a title Enter the number one Enter the number two addition subtraction multiplication Division servlet code:- import java.io.*; import javax.servlet.*; import javax.servlet.http.*; class calc extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException { PrintWriter pw=res.getWriter(); float result=0; float a=Float.parseFloat(req.getParameter("no1")); float b=Float.parseFloat(req.getParameter("no2")); String opr=req.getParameter("opr"); if(opr.equals("addition")) { result=a+b; } if(opr.equals("subtraction")) { result=a-b; } if(opr.equals("multiplication")) { result=a*b; } if(opr.equals("division")) { result=a/b; } pw.println("the answer is "+result); } } xml code:- <?xml version="1.0" encoding="UTF-8"?> calc calc calc /calc 30 index.html
tagged with: java
downvote count: 2
tagged with: netbeans-8.1
has comment: http://stackoverflow.com/comment/40948594
type: Question
has answer: http://stackoverflow.com/a/26127258

http://stackoverflow.com/q/26041546
has comment: http://stackoverflow.com/comment/40793688
has title: How to understand the concept of recursion in java?
favorite count: 0
has answer: http://stackoverflow.com/a/26041667
upvote count: 1
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26042063
has answer: http://stackoverflow.com/a/26042039
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40793615
has comment: http://stackoverflow.com/comment/40793694
has comment: http://stackoverflow.com/comment/40793572
type: Question
has answer: http://stackoverflow.com/a/26041802
has answer: http://stackoverflow.com/a/26041693
downvote count: 0
answer count: 6
possible better answer: http://stackoverflow.com/a/26041693
accepted answer: http://stackoverflow.com/a/26042063
has body: I'm new to java programming, and our teacher taught us the concept of recursion and I found it to be a bit complicated. All I understood that it works like a loop(like the factorial of 4) but I still don't quite get it why it works like that. Can I get a detailed explanation on this topic? Here is the piece of code and a picture my teacher used to explain. package javaapplication1; public class JavaApplication1 { static int factorial(int n){ int t; if(n == 0){ return 1; } else { t = factorial(n - 1); return n * t; } } public static void main(String[] args) { System.out.println(factorial(5)); } } In the following image, the blue color represents stack winding, and the green is stack unwinding, and again I don't know what stack winding and unwinding is. https://i.sstatic.net/pjqJy.png
linked to: http://stackoverflow.com/q/717725
has answer: http://stackoverflow.com/a/63108319
tagged with: concept

http://stackoverflow.com/q/26067498
has comment: http://stackoverflow.com/comment/40842210
type: Question
has comment: http://stackoverflow.com/comment/40841902
tagged with: data-structures
has comment: http://stackoverflow.com/comment/40842086
has title: Optimization of a Data Tree for Video Game Objects
tagged with: arraylist
score: 0
tagged with: game-engine
has comment: http://stackoverflow.com/comment/40842058
has comment: http://stackoverflow.com/comment/40842262
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40842434
answer count: 0
tagged with: java
has body: So I'm currently working on Data Structures for my java game, and I'm using ArrayLists. However, I've found that having these structures causes severe speed problems. I store my game objects in storage objects called Zones. In pseudo code: object Zone{ ArrayList ObjList; Do Task (Draw/Phys/Logic){ for(i=0 to ObjList.length){ ObjList[i].doTask; } AddObject(obj){ ObjList.add(obj) } And I store them using a simple nested for loop: for(i=0 to number of storage classes){ for(j=0 to number of objects per storage class){ objectClass Obj = new Object; StorageClass.add(Obj); } overall ArrayList.add(StorageClass); } And that's basically it, I've turned off the collision detection because I know it's not done with the objects themselves and only by the storage class. However, I can render 800 objects in 1 storage class at 60fps, but should I attempt to run 10 storage classes with 80 objects each I get barely 8 fps. Is there any data structuring I can use to improve my speed, or is this the only way it can be done?

http://stackoverflow.com/a/26179174
answers question: http://stackoverflow.com/q/26179103
score: 1
downvote count: 0
has body: Handling exception depends on what you want to do. Most of the time you can do nothing in current method and only able to communicate error to caller method, then you wrap and rethrow (or even declare exception in you own signature). But some time you can handle it. For example if you fail to find and open property file you can use default values.
type: Answer
upvote count: 1

http://stackoverflow.com/q/26081151
upvote count: 1
has comment: http://stackoverflow.com/comment/40866608
has answer: http://stackoverflow.com/a/26081191
has comment: http://stackoverflow.com/comment/40866927
has body: I have a text input and I'm trying to scan every third number. I could only scan every number, but not specifically every third number Scanner inFile = new Scanner(new FileReader("budgettracker.txt")); int counter = 0; PrintWriter outFile = new PrintWriter ("textout.text"); while(inFile.hasNextInt()) { counter++; inFile.nextInt(); } Scanner inFile1 = new Scanner(new FileReader("budgettracker.txt")); int a[] = new int[counter]; for (int p = 0; p&lt;counter; p++) { if(a[p] == a[0] || a[p] == a[3] || a[p] == a[6]) { a[p] = inFile1.nextInt(); outFile.print(a[p] + " "); } } outFile.close(); inFile.close(); }
score: 1
tagged with: java
type: Question
has title: How do I scan specific numbers in an array from a text?
answer count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26188603
has body: You can do it the same way as with instances of any other class. EchoThread thread = new EchoThread(socket); thread.setGlobalVariables(globalVars); thread.start();
accepted answer of: http://stackoverflow.com/q/26188562
type: Answer
answers question: http://stackoverflow.com/q/26188562
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26182593
tagged with: java
linked to: http://stackoverflow.com/q/36589644
upvote count: 4
has comment: http://stackoverflow.com/comment/41106413
tagged with: ios
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41081898
favorite count: 0
has answer: http://stackoverflow.com/a/26429133
tagged with: android
has comment: http://stackoverflow.com/comment/41088197
has title: AES Encryption Java to iOs - With password, iv and salt
tagged with: aes
score: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41088137
has comment: http://stackoverflow.com/comment/41106623
tagged with: encryption
has comment: http://stackoverflow.com/comment/78039260
accepted answer: http://stackoverflow.com/a/26429133
type: Question
has body: i'm developing an app for three platforms (Android, ios and WP8). This app connect with server and uses AES for security. I have ready a test version for android and Windows Phone working good and the code generated (in base64) with android is decoded with the wp code and on the contrary. But, on iOs i get other response with the same SALT, KEY and IV. This is my code for android: public static SecretKeySpec generateKey(char[] password, byte[] salt) throws Exception { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); KeySpec spec = new PBEKeySpec(password, salt, 1024, 128); SecretKey tmp = factory.generateSecret(spec); SecretKeySpec secret = new SecretKeySpec(tmp.getEncoded(), "AES"); return secret; } public static Map encrypt(String cleartext, byte[] iv, SecretKeySpec secret) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); // If the IvParameterSpec argument is omitted (null), a new IV will be // created cipher.init(Cipher.ENCRYPT_MODE, secret, iv == null ? null : new IvParameterSpec(iv)); AlgorithmParameters params = cipher.getParameters(); byte[] usediv = params.getParameterSpec(IvParameterSpec.class).getIV(); byte[] ciphertext = cipher.doFinal(cleartext.getBytes("UTF-8")); Map result = new HashMap(); result.put(IV, usediv); result.put(CIPHERTEXT, ciphertext); return result; } public static String decrypt(byte[] ciphertext, byte[] iv, SecretKeySpec secret) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(iv)); String plaintext = new String(cipher.doFinal(ciphertext), "UTF-8"); return plaintext; } public static void main(String arg) throws Exception { byte[] salt = new byte[] { -11, 84, 126, 65, -87, -104, 120, 33, -89, 19, 57, -6, -27, -19, -101, 107 }; byte[] interop_iv = Base64.decode("xxxxxxxxxxxxxxx==", Base64.DEFAULT); byte[] iv = null; byte[] ciphertext; SecretKeySpec secret; secret = generateKey("xxxxxxxxxxxxxxx…
has comment: http://stackoverflow.com/comment/67306836
has comment: http://stackoverflow.com/comment/78039247

http://stackoverflow.com/comment/40879594
type: Comment
has text: Try connecting with Port: 8080, or 80, or 1024. And make sure that both servers are running.
score: 0
comment on: http://stackoverflow.com/q/26087818
type: QuestionComment

http://stackoverflow.com/comment/40915617
type: Comment
comment on: http://stackoverflow.com/q/26107340
score: 0
type: QuestionComment
has text: Oh alright. Well if anything I learned something. I appreciate the input.

http://stackoverflow.com/q/26134929
has body: I am executing another java program through a Process object. This takes some time to complete. In the mean time, will the parent program continue running or will it be on hold, to wait for the child process to stop? I know that two threads can run in parallel, can a thread be used to execute this other program? Please let me know if you need any more details, if this became too abstract.
has comment: http://stackoverflow.com/comment/40964096
possible better answer: http://stackoverflow.com/a/26135050
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26135021
accepted answer: http://stackoverflow.com/a/26135021
favorite count: 0
has comment: http://stackoverflow.com/comment/40967992
tagged with: multithreading
has answer: http://stackoverflow.com/a/26135050
has title: Processes in Java- Do they work concurrently?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40964087
tagged with: java
has comment: http://stackoverflow.com/comment/40964066
tagged with: process
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/26126975
score: 0
tagged with: file-io
has body: So, in my program I'm supposed to read integers from a text file to make a key-listed array of them. Easy enough, except when I got to read the file I get nothing but zeroes out of it. The file itself looks like this: 10111 86 78 95 20222 81 73 87 30333 71 63 77 40444 62 58 67 50555 51 62 48 And the code I'm currently is: File stuff = new File("TheData.txt"); int [] temp = new int[36]; int spine =0; try { Scanner sc = new Scanner(stuff); while(sc.hasNextInt()){ temp[spine++] = sc.nextInt(); System.out.println("" + temp[spine]); } } catch (FileNotFoundException ex) { Logger.getLogger(ProgramDriver3.class.getName()).log(Level.SEVERE, null, ex); } I'm trying to read the numbers into a temporary array of ints so I can sort them into where they're supposed to go (the long ones are student ids, the short ones are test scores). When I try and run the thing, though, all I get is run: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BUILD SUCCESSFUL (total time: 1 second) I'm not entirely certain what's going wrong
has comment: http://stackoverflow.com/comment/40949744
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26127069
has answer: http://stackoverflow.com/a/26127063
has title: Reading a file of integers, getting nothing but zero
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/26143707
type: Answer
accepted answer of: http://stackoverflow.com/q/26141093
has body: The getRealPath() gives the absolute path (on the file system) leading to a file specified in the parameters of the call. It returns the path in the format specific to the OS. Read request#getRealPathfor its documentation. Also it is advised to use servletRequest.getSession().getServletContext().getRealPath("/") instead of servletRequest.getRealPath("/") as it is deprecated. so the best way is to provide the upload path for the server by yourself, as the method values specific to the OS the returned path may not be accessible(Permissions). Hope this helps !!
has comment: http://stackoverflow.com/comment/41144071
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26141093

http://stackoverflow.com/q/26041317
has comment: http://stackoverflow.com/comment/40793297
has comment: http://stackoverflow.com/comment/40793333
type: Question
has comment: http://stackoverflow.com/comment/40793243
score: 1
tagged with: refactoring
tagged with: java
has title: Java code refactoring: multiple instanceof operator usages
linked to: http://stackoverflow.com/q/103564
has answer: http://stackoverflow.com/a/26073636
upvote count: 1
tagged with: polymorphism
tagged with: operators
favorite count: 0
tagged with: instanceof
has answer: http://stackoverflow.com/a/26041413
accepted answer: http://stackoverflow.com/a/26041413
has answer: http://stackoverflow.com/a/26070053
answer count: 4
has body: Consider the following example where the classes TextFile, XmlFile, HtmlFile, ShellScriptFile, et cetera, are all subclasses of the class SimpleFile. I am writing a class FileOperations, which has a method that searches the contents of a generic file depending on its type. Following is a code sample: public searchFile(SimpleFile targetFile, String searchStr) { if (targetPage instanceof HtmlFile) { // search html file } else if (targetPage instanceof TextFile) { // search text file } else if (targetPage instanceof XmlFile) { // search xml file } else if (targetPage instanceof ShellScriptFile) { // search shell file } ... } This structure smells bad to me. I am aware that this is the best case for polymorphism. But I do not have control over the File class or its subclasses.I cannot write to them. Is there another way to go about cleaning this mess? Because the if-else structure is going to keep increasing as I add support for different file types. Else, if I am stuck with this structure, then is instanceof the fastest operator in Java? What are its implications on performance? Would it be better to use getClass() or isAssignableFrom() for the above case? I appreciate your comments or suggestions!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26070030
downvote count: 0
possible better answer: http://stackoverflow.com/a/26073636

http://stackoverflow.com/comment/40952737
has text: please use number as you are doing next int when you type a then it goes in the catch block and continues the loop execution.
comment on: http://stackoverflow.com/a/26127697
type: AnswerComment
score: 0
type: Comment

file
type: Tag
tags question: http://stackoverflow.com/q/26133085
tags question: http://stackoverflow.com/q/26064689
tags question: http://stackoverflow.com/q/26057685
tags question: http://stackoverflow.com/q/26035562
tags question: http://stackoverflow.com/q/26114624
tag name: file
tags question: http://stackoverflow.com/q/26161447
tags question: http://stackoverflow.com/q/26090774
tags question: http://stackoverflow.com/q/26177527
tags question: http://stackoverflow.com/q/26065292
tags question: http://stackoverflow.com/q/26056922
tags question: http://stackoverflow.com/q/26145174
tags question: http://stackoverflow.com/q/26044177
tags question: http://stackoverflow.com/q/26135853
tags question: http://stackoverflow.com/q/26104923
tags question: http://stackoverflow.com/q/26189989
tags question: http://stackoverflow.com/q/26165386
tags question: http://stackoverflow.com/q/26193490
tags question: http://stackoverflow.com/q/26137942
tags question: http://stackoverflow.com/q/26087801
tags question: http://stackoverflow.com/q/26118099
tags question: http://stackoverflow.com/q/26169696
tags question: http://stackoverflow.com/q/26132721
tags question: http://stackoverflow.com/q/26075439
tags question: http://stackoverflow.com/q/26138285
tags question: http://stackoverflow.com/q/26108200
tags question: http://stackoverflow.com/q/26104775
tags question: http://stackoverflow.com/q/26143782
tags question: http://stackoverflow.com/q/26077093
tags question: http://stackoverflow.com/q/26103136
tags question: http://stackoverflow.com/q/26153899
tags question: http://stackoverflow.com/q/26036793
tags question: http://stackoverflow.com/q/26088209
tags question: http://stackoverflow.com/q/26097282

http://stackoverflow.com/q/26162771
has answer: http://stackoverflow.com/a/26162824
answer count: 2
has body: Example: "initial" should return "ineetial", "alumni" should return "alumnee" and "illuminati" should return "illumeenati" However, using this code: str = str.replaceAll("(\\w+)i(.?)", "$1ee$2"); I keep getting 'initeeal', 'alumnee' and 'illuminatee' and I don't understand why.
score: 0
tagged with: regex
possible better answer: http://stackoverflow.com/a/26162824
has answer: http://stackoverflow.com/a/26162842
accepted answer: http://stackoverflow.com/a/26162842
has title: Replace first occurrence of character not in the beginning of a word in a word using regex
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26089551
tagged with: spring-security
linked to: http://stackoverflow.com/q/2877262
score: 0
type: UnansweredQuestion
tagged with: spring
has body: When I try to run Spring java annotation based configuration I get that exception trace Sep 28, 2014 10:24:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@20ad9418: startup date [Sun Sep 28 22:24:38 EET 2014]; root of context hierarchy Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: com.learn.HelloWorldConfig at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:378) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at com.learn.MainApp.main(MainApp.java:9) Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException--&gt;null at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:317) at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:128) at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:100) at org.springframework.context.annotation.Confi…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40881867
has comment: http://stackoverflow.com/comment/40882035
type: Question
has title: java.lang.IllegalStateException when run spring java based configuration?

http://stackoverflow.com/q/26045689
score: 2
type: AnsweredQuestion
downvote count: 0
has title: ArrayList java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
possible better answer: http://stackoverflow.com/a/26045730
accepted answer: http://stackoverflow.com/a/26045751
has answer: http://stackoverflow.com/a/26045730
favorite count: 0
has comment: http://stackoverflow.com/comment/40801499
has comment: http://stackoverflow.com/comment/40801313
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40801338
answer count: 2
tagged with: java
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/26045751
has body: I am getting stumped by this error. java.lang.ArrayIndexOutOfBoundsException: length=10; index=10 Below is the code that is causing the exception. 'keys' is an ArrayList. for (int i = 0; i &lt; keys.size(); i++) { if (values[i] != null) { contentValues.put(keys.get(i), String.valueOf(values[i])); } } What could be causing this outOfBoundsException?

http://stackoverflow.com/comment/40970252
has text: @brimborium It is a parsed string from XML
score: 0
comment on: http://stackoverflow.com/q/26138228
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40924731
type: Comment
comment on: http://stackoverflow.com/q/26113360
type: QuestionComment
has text: [Countdown Timer in Android](http://www.androidhub4you.com/2014/01/countdown-example-in-android-custom.html)
score: 0

http://stackoverflow.com/q/26192111
has comment: http://stackoverflow.com/comment/41070506
downvote count: 0
has comment: http://stackoverflow.com/comment/41070427
favorite count: 0
has comment: http://stackoverflow.com/comment/41071751
type: Question
has comment: http://stackoverflow.com/comment/41078708
score: 1
has comment: http://stackoverflow.com/comment/41070322
has comment: http://stackoverflow.com/comment/41070166
has body: In the below program, DList1 is a list abstraction. I would like to run some unit test cases in main() function of DList1 class. To be specific, In main() method at Line 105, l.head.item != 9 , gives compile error: Incompatible operand types Object and int. At compile time, value 9 is of primitive type int and l.head.item is of type class Object. At run time, l.head.item will be of type class Integer. Am not sure about the type of value 9. /* DList1.java */ /** * A DList1 is a mutable doubly-linked list. (No sentinel, not * circularly linked.) */ public class DList1 { /** * head references the first node. * tail references the last node. * * DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS. */ protected DListNode1 head; protected DListNode1 tail; protected long size; /* DList1 invariants: * 1) head.prev == null. * 2) tail.next == null. * 3) For any DListNode1 x in a DList, if x.next == y and x.next != null, * then y.prev == x. * 4) For any DListNode1 x in a DList, if x.prev == y and x.prev != null, * then y.next == x. * 5) The tail can be accessed from the head by a sequence of "next" * references. * 6) size is the number of DListNode1s that can be accessed from the * head by a sequence of "next" references. */ /** * DList1() constructor for an empty DList1. */ public DList1() { this.head = null; this.tail = null; this.size = 0; } /** * insertFront() inserts an item at the front of a DList1. */ public void insertFront(Object item) { if(this.head == null){ this.head = new DListNode1(item); this.tail = this.head; }else{ DListNode1 newNode = new DListNode1(item); newNode.next = this.head; this.head.prev = newNode; this.head = newNode; } this.size++; } /** * removeFront() removes the first item (and node) from a DList1. If the * list is empty, do nothing. */ public void removeFront() { if(this.size == 0){ return; }else if(size ==1){ this.head = null; this.tail = null; }else{ this.head.next.prev = null; this.head = this.head.next; } } /** * toString() returns a String repr…
has comment: http://stackoverflow.com/comment/41070344
answer count: 2
has comment: http://stackoverflow.com/comment/41094878
upvote count: 1
has answer: http://stackoverflow.com/a/26192174
linked to: http://stackoverflow.com/q/26192821
has comment: http://stackoverflow.com/comment/41092040
has answer: http://stackoverflow.com/a/26192146
has comment: http://stackoverflow.com/comment/41076797
has title: How to compare objects with different types?
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41071440
has comment: http://stackoverflow.com/comment/41070249

http://stackoverflow.com/q/26116107
downvote count: 0
tagged with: oracle-aq
tagged with: jms
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26443379
score: 3
has title: JMS TextMessage - not working after deployment to WebLogic
tagged with: spring
has body: I am facing a strange issue after migrating my application from OC4J to WebLogic 10.3.6 server. My application produces JMS TextMessage into OracleAQ queue. It was working fine. But after deploying the application to WebLogic, produced text messages are getting stored in USER_DATA_TEXT_LOB (clob) column instead of USER_DATA_TEXT_VC (varchar2) column in underlying queue, whereas the USER_DATA_TEXT_LEN is very less (less than 1k chars). As a consequence, consumer application is failing to dequeue the message and throwing the error: Payload is NULL. Appreciate any help in this regard. Update: I have tried with jms BytesMessage and it is working as expected.
upvote count: 3
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: weblogic11g

http://stackoverflow.com/comment/41026967
has text: ANy errors in the browser console?
score: 0
comment on: http://stackoverflow.com/q/26168777
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26168334
tagged with: java
type: Question
tagged with: broadcastreceiver
has body: I've seen various people implement onReceive() within their class which extends BroadcastReceiver. But is there a way to implement onReceive() in a different class than MainActivity, when a button in pressed in the MainActivity? If that's possible, how would I call onReceive() when the button is pressed? I have a receiver implemented in my AndroidManifest file as well, so will that be triggered also, when the button is pressed and onReceive() is called? MainActivity class - public class MainActivity extends Activity { Button activateButton; LocationManager mManager; AlertDialog.Builder box; BroadcastReceiver b; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); activateButton = (Button)findViewById(R.id.activate); activateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { DialogBox(); } }); } protected void DialogBox() { box = new AlertDialog.Builder(this); box.setTitle("Reject incoming calls?"). setMessage("On activation, your phone will reject all incoming calls").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent = new Intent("android.intent.action.PHONE_STATE"); MainActivity.this.sendBroadcast(intent); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); final AlertDialog alert = box.create(); alert.show(); } RejectCall class - public class RejectCall extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Log.i("RejectClass", "Triggered"); ITelephony telephonyService; TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try { Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod("getITelephony"); m.setAccessible(true); telephonyService = (IT…
score: 0
has answer: http://stackoverflow.com/a/26169491
has title: Implement onReceive() when a button in MainActivity is pressed
answer count: 1
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/26169491
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/26190710
type: Answer
upvote count: 2
has body: A relatively short and neat way to count a specific character in a string is using the return value of the replaceAll method: public static int countChar(final String str, final char c) { return str.replaceAll("[^" + c + "]","").length(); } The pattern [^x] (x can be replaced with any char (or amount of different chars)) will match everything in a given String except x. So [^T] of TEST would replace E and S with the given replacement (which is "" (nothing)) and keeps the Ts. The method would return TT. If you count that length, you'll receive the count of the searched character of the given string. The example System.out.println(countChar("TEST", 'T')); System.out.println(countChar("TEST", 'E')); System.out.println(countChar("TEST", 'S')); prints 2 1 1 (keep in mind that is method is case sensitive)
answers question: http://stackoverflow.com/q/26190594
score: 2
accepted answer of: http://stackoverflow.com/q/26190594
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/35819258
downvote count: 0
type: Answer
has body: Building jEdit In Eclipse and Ant The best way to debug JEdit in Eclipse that I have found is this: You are going to have to make sure you setup your eclipse environment, so that you can build JEdit using the "build.xml" file provided. In particular, you need to make sure that the correct Ant versions, JDK, JRE, etc.. are setup in your Eclipse environment. Next, you want to go to the File Menu Then you will see this screen. (You have to filter it by typing "Ant" in the textbox for Wizards) Find the path to your Ant "build.xml" File After you have completed importing that project, don't build from project build. Instead find the build.xml file in the project, right click, and select - the "Run As" Item and then "Alternate Tools Configurations" Then you will see this screen. You will not see any of the Ant Build sub items, you have to click on the New Icon on the top left. (I circled it in Red) When you click that, you can add various parameters for the Ant Build. Really for our discussion here, all you need to do is select "Targets" Then select these only - build, and run-debug Next you want to click on the textbox at the top right, and edit the default name there and make it something like "jedit build.xml run-debug" or whatever will help you when you need it again. Next click on the apply button, and then click on the Run button. If you can successfully build with all your environment settings, then you are all set for Eclipse debugging. The best way to debug this application though, is to do this: Find the path to your build.xml file on your box. copy the path. Go to command prompt, as Administrator change to the path you copied. Then build JEdit by using Ant Build from outside on Command Line, such as: ant run-debug This will start our build in debug mode keep in mind though, there is a timeout for this. so, after we start that, we next go back to Eclipse With our project loaded in Eclipse, we go to Run\Debug Configurations Create a New Remote Java Application co…
upvote count: 1
answers question: http://stackoverflow.com/q/26052182
score: 1

http://stackoverflow.com/a/26069391
accepted answer of: http://stackoverflow.com/q/26069270
has comment: http://stackoverflow.com/comment/40845086
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26069270
type: Answer
has body: Take another look at your if statement: if (Letter.contains(LettersTwo)) Here you're checking to see if a single letter contains a string of letters. Logically that'll return false. But if you use it this way: if (LettersTwo.contains(Letter)) You're checking if a group of letters contains a single letter.
has comment: http://stackoverflow.com/comment/40845237
upvote count: 1

http://stackoverflow.com/comment/41001592
type: QuestionComment
has text: If the main thread keeps going, just add a state to the runnable which you can scan from time to time? Observer pattern?
comment on: http://stackoverflow.com/q/26155214
score: 0
type: Comment

ehcache
tags question: http://stackoverflow.com/q/26080241
tag name: ehcache
type: Tag
tags question: http://stackoverflow.com/q/26134827
tags question: http://stackoverflow.com/q/26041498

http://stackoverflow.com/comment/40857001
score: 0
type: Comment
type: QuestionComment
has text: I'd be surprised if _the complete reference_ didn't explain `this`.
comment on: http://stackoverflow.com/q/26076154

http://stackoverflow.com/q/26135526
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I made a custom drawer for an android application but there is a problem that the first Item's hight is bigger than all other items.. My XML code of Navigation Drawer is: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > </android.support.v4.widget.DrawerLayout> The ListView Custom adapter layout code is here: <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/icon" android:layout_width="25dp" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginBottom="10dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginTop="10dp" android:contentDescription="@string/desc_list_item_icon" android:src="@drawable/logout_icon" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@id/icon" android:textColor="@color/list_item_title" android:textSize="13sp" /> <ImageView android:id="@+id/ivAeroo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:src="@drawable/rightorangearrowicon" /> <View android:id="@+id/view1" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="#ababab" /> My Layout still making first item Large like this..
answer count: 2
upvote count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Navigation Drawer Android List Item Hight
has answer: http://stackoverflow.com/a/26135610
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26135553

http://stackoverflow.com/a/26147769
type: Answer
has comment: http://stackoverflow.com/comment/40988180
has comment: http://stackoverflow.com/comment/40988110
upvote count: 3
has body: An important thing to remember is that the javac compiler doesn't do much in the way of optimisation, nor does it give you any means of specifying where data is stored or how code should be optimised. (With a few obscure exceptions in Java 8 like @Contended) Java derives much of it's extensibility from libraries which generally operate at runtime. (There is often a build time option as well) A key thing to realise is that a Java program can generate and alter code while it is running, so in fact much of the smarts are happening at runtime. In the case of off-heap usage, you need a library which supports this functionality and this will directly, or indirectly use sun.misc.Unsafe (On most popular JVMs) This class allows you to do many things the language doesn't support, but is still really useful to have if you are a low level library builder. While off heap memory is not directly managed by the GC, you can have proxy objects e.g. ByteBuffer which have a Cleaner so that when these objects are GC-ed the off heap memory associated with it is also cleaned up. Disclaimer, I wrote most of ChronicleMap.
score: 3
accepted answer of: http://stackoverflow.com/q/26147651
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26147651

http://stackoverflow.com/comment/41024730
comment on: http://stackoverflow.com/a/26137343
type: AnswerComment
type: Comment
score: 1
has text: You could manually set this up and check how it's done in the framework (we're using TaskSchedulers to send heartbeats periodically). SockJS won't slow you down here, it'll select the best transport available (websocket) if possible. Don't forget that even if you clients support websockets, the network (HTTP proxies and others) may not be happy with persistent connections like websockets.

http://stackoverflow.com/q/26088200
has answer: http://stackoverflow.com/a/26088217
accepted answer: http://stackoverflow.com/a/26088217
has title: Creating threads without extends and implements
has answer: http://stackoverflow.com/a/53077882
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: multithreading
has body: I was going through an old project (Java) in my company where I found the author (already left), creates and runs thread without extending the Thread class or implementing the Runnable interface. One noticable thing was that the class was a singleton class. There are no usage of thread pooling, or the new concurrent package from java. Code snippet outlines given below - import java.sql.*; import org.apache.log4j.*; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; public class DataLookup { private static DataLookup _ref; private DataLookup() { } public static DataLookup getInstance() { if (_ref == null) { synchronized (DataLookup.class) { if (_ref == null) { _ref = new DataLookup(); } } return _ref; } } /* * Implementation Logic */ public void writeRecord(String a, String b, String c) { /* * Implementation Logic */ Thread writerThread = new Thread() { public void run() { /* * Implementation Logic */ } } writerThread.start(); } } How does this approach work - using threads without extending from Thread class or implementing Runnable interface? What are the advantages and disadvantages of using this approach (without extends and implements).
type: Question
possible better answer: http://stackoverflow.com/a/53077882
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/40879235
downvote count: 0
has comment: http://stackoverflow.com/comment/40879253
favorite count: 0

http://stackoverflow.com/comment/40925749
comment on: http://stackoverflow.com/q/26113814
type: QuestionComment
has text: Please show the complete stack trace. At the moment you haven't told us anything about *how* it crashes. Also, please pay more attention to your code formatting - the indentation is all over the place at the moment.
type: Comment
score: 2

http://stackoverflow.com/a/26086747
answers question: http://stackoverflow.com/q/26086702
downvote count: 0
type: Answer
has body: while ((A[j-1] &gt; v) &amp;&amp; (j &gt;= 1)) { A[j] = A[j-1]; j--; } Boolean expressions are evaluated from left to right. So when j becomes 0, A[j - 1] &gt; v is evaluated first, before j &gt;= 1. And it thus throws an exception. Simply reading the message gives you a huge hint: ArrayIndexOutOfBoundsException: -1 So you know that the problem is that you're accessing an invalid index in an array, and that this invalid index is -1. Use while ((j &gt;= 1) &amp;&amp; (A[j-1] &gt; v))
score: 2
upvote count: 2

http://stackoverflow.com/comment/40991473
score: 2
comment on: http://stackoverflow.com/q/26149569
type: Comment
type: QuestionComment
has text: I do not see any merge method call in your code.

jaxb2
tags question: http://stackoverflow.com/q/26083237
tag name: jaxb2
type: Tag

http://stackoverflow.com/comment/40961100
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26133198
has text: Thanks for this! , Other answers were all right , but my teacher expects me to use just a normal array for this project. Thanks everyone , and thank you wittakarn
type: AnswerComment

query-performance
tags question: http://stackoverflow.com/q/26186258
tag name: query-performance
type: Tag

http://stackoverflow.com/q/26057279
has answer: http://stackoverflow.com/a/26057532
upvote count: 18
has answer: http://stackoverflow.com/a/62279822
has title: Making an EditText field accept only letters and white spaces in Android
has answer: http://stackoverflow.com/a/26057433
has answer: http://stackoverflow.com/a/30718506
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/44711144
accepted answer: http://stackoverflow.com/a/26057532
tagged with: android
answer count: 10
has answer: http://stackoverflow.com/a/42298823
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45077744
has answer: http://stackoverflow.com/a/26057430
possible better answer: http://stackoverflow.com/a/45917539
type: Question
has answer: http://stackoverflow.com/a/45917539
tagged with: java
has body: I have an EditText field in my project which stands for the full name of the person.So I want only letters and spaces to be allowed in it.So I tried the following in the XML file android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " But it didn't work.Can anyone tell me how to do it?
has answer: http://stackoverflow.com/a/26057691
score: 18

http://stackoverflow.com/q/26061006
has body: My question will be seem's stupid but I make a simple code to make a Toast when I receive a SMS, but impossible to see my toast. My Android Manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.romain.assistantvocal" > <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" /> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> And here my class SMSReceiver : package com.example.romain.assistantvocal; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.telephony.gsm.SmsMessage; import android.widget.Toast; import java.util.Locale; /** * Created by romain on 26/09/2014. */ public class SMSReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context,"gg romstan",Toast.LENGTH_LONG).show(); } } Thank you in advance for your answers.
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26061385
has answer: http://stackoverflow.com/a/26061569
has answer: http://stackoverflow.com/a/26061385
tagged with: android
has comment: http://stackoverflow.com/comment/40831530
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26061569
has comment: http://stackoverflow.com/comment/40829739
type: Question
tagged with: broadcastreceiver
has title: Can't make a toast with a broadcastreceiver, never call onReceive

http://stackoverflow.com/a/26148020
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26144251
answers question: http://stackoverflow.com/q/26144251
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/103811956
has body: Actually, there is a simple method toLikeRegex that converts all * to .*. Together with catching invalid regular expressions, my custom implementation may look like this: class MyNameRepository { MongoOperations mongoOperations; // injected public Collection&lt;Name&gt; findByName(String like) { try{ Query query = new Query(); query.addCriteria(Criteria.where("name").regex(toLikeRegex(like))); return mongoOperations.find(query, Name.class); } catch(PatternSyntaxException e) { return Collections.emptyList(); } } private String toLikeRegex(String source) { return source.replaceAll("\\*", ".*"); } } and behaves the same as Spring Data repository does. Update 19 Apr 2016 There is a MongoRegexCreator class since 1.9.0.RELEASE that provides a toRegularExpression method. String regex = MongoRegexCreator.INSTANCE .toRegularExpression(userString, Part.Type.EXISTS);
type: Answer
score: 3

http://stackoverflow.com/a/49815565
score: 1
answers question: http://stackoverflow.com/q/26129697
upvote count: 1
downvote count: 0
type: Answer
has body: Moreover, if value contains JSONArray with JSONObject, retrofit doesn't encode brackets [ ] { } Map contains element: key = filter, value = [{"field":"some_field","value":"some_value","operator":"="}] And @QueryMap send http://my_server/api?filter=[{%22field%22:%22some_field%22,%22value%22:%22some_value%22,%22operator%22:%22%3D%22}] QueryMap used there because of number params in GET request and objects in filter option.

http://stackoverflow.com/a/26172776
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/41034896
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41055108
has comment: http://stackoverflow.com/comment/41063625
type: Answer
has body: You are maybe missing a jar, try adding this jar to the classpath by doing just what you did before: right-click>Properties>Java Build Path>Libraries>Add Jars Download this JAR: http://central.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar
has comment: http://stackoverflow.com/comment/41034863
accepted answer of: http://stackoverflow.com/q/26172653
answers question: http://stackoverflow.com/q/26172653
upvote count: 1

http://stackoverflow.com/q/26084212
accepted answer: http://stackoverflow.com/a/26096703
tagged with: py4j
score: 2
upvote count: 2
has title: PY4J callback server error
has comment: http://stackoverflow.com/comment/40880876
tagged with: python
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26096703
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/73048713
favorite count: 0
has comment: http://stackoverflow.com/comment/40891859
has body: I'm trying to run the example for the callback server in the PY4J website here But I'm getting the following exception: "py4j.protocol.Py4JNetworkError: An error occurred while trying to start the callback server" This is the code: Java: package py4j.examples; import java.util.ArrayList; import java.util.List; import java.util.Random; import py4j.GatewayServer; public class OperatorExample { // To prevent integer overflow private final static int MAX = 1000; public List&lt;Integer&gt; randomBinaryOperator(Operator op) { Random random = new Random(); List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); numbers.add(random.nextInt(MAX)); numbers.add(random.nextInt(MAX)); numbers.add(op.doOperation(numbers.get(0), numbers.get(1))); return numbers; } public List&lt;Integer&gt; randomTernaryOperator(Operator op) { Random random = new Random(); List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); numbers.add(random.nextInt(MAX)); numbers.add(random.nextInt(MAX)); numbers.add(random.nextInt(MAX)); numbers.add(op.doOperation(numbers.get(0), numbers.get(1), numbers.get(2))); return numbers; } public static void main(String[] args) { GatewayServer server = new GatewayServer(new OperatorExample()); server.start(); } } Interface: package py4j.examples; public interface Operator { public int doOperation(int i, int j); public int doOperation(int i, int j, int k); } Python: from py4j.java_gateway import JavaGateway class Addition(object): def doOperation(self, i, j, k = None): if k == None: return i + j else: return i + j + k class Java: implements = ['py4j.examples.Operator'] if __name__ == '__main__': gateway = JavaGateway(start_callback_server=True) operator = Addition() numbers = gateway.entry_point.randomBinaryOperator(operator) print(numbers) numbers = gateway.entry_point.randomTernaryOperator(operator) print(numbers) gateway.shutdown() As I mentioned, I'm getting this exception py4j.protocol.Py4JNetworkError: An error occurred while trying to start the call…
possible better answer: http://stackoverflow.com/a/73048713

http://stackoverflow.com/q/26127662
has body: I am currently developing an Android application which must be able to stream music from youtube and only download the audio. I have already managed to: Recover the url rtsp with youtube data API Play music using the mediaplayer class. Now, I would like to download music on my device. Is this possible to do it directly via mediaplayer? if so how? If not? would it make a another way to do it? Thank you to all.
favorite count: 0
type: UnansweredQuestion
has title: How to create an audio file from mediaplayer
tagged with: android
tagged with: youtube
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/9115681
type: Question
tagged with: android-mediaplayer
has answer: http://stackoverflow.com/a/26128372
answer count: 1
downvote count: 0
tagged with: rtsp

http://stackoverflow.com/q/26092632
downvote count: 0
possible better answer: http://stackoverflow.com/a/26096294
has answer: http://stackoverflow.com/a/26096294
has answer: http://stackoverflow.com/a/26112036
has title: java Firebase: delay exit until writes finish
favorite count: 0
upvote count: 2
tagged with: multithreading
tagged with: firebase
has body: I have a server written in Java that can receive a shut down signal while it's listening to, processing, and updating Firebase data. Since the Firebase threads are daemon threads in Java, I wanted to add some delay to the main thread to allow write operations to complete. My current idea is the latch approach: use some concurrent counter to track pending writing operations, and let the main thread exit when there are none. The counter would get updated in onComplete() callbacks, so I was wondering: In the Firebase client, when might onComplete() callbacks never get called? Is there reasonable danger of deadlock?
accepted answer: http://stackoverflow.com/a/26112036
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: concurrency
type: Question
answer count: 2

http://stackoverflow.com/q/26106551
score: 2
has answer: http://stackoverflow.com/a/26106603
has title: How to combine two Collections.sort functions
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26106661
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26106617
tagged with: sorting
favorite count: 0
has body: I have a program where i am have a list of Names, and how many people have that name. I want to put the names in alphabetical order while also putting the counts from greatest to least. If the name has the same count it puts the name in alphabetical order. I figured out how to put the names in abc order and figured out how to put the counts in greatest to least but i cant figure out how to combine the two to get list of names greatest to least and if they have the same count in alphabetical order. Collections.sort(oneName, new OneNameCompare()); for(OneName a: oneName) { System.out.println(a.toString()); } Collections.sort(oneName, new OneNameCountCompare()); for(OneName a: oneName) { System.out.println(a.toString()); }
has answer: http://stackoverflow.com/a/26106627
type: UnansweredQuestion
tagged with: collections
answer count: 4

http://stackoverflow.com/a/26175459
answers question: http://stackoverflow.com/q/26175423
has body: Yo have a typo in intent.putExtra("data", "selectedphoto");, you are passing a String not the bitmap. Change it in Intent intent = new Intent(PictureOptions.this,ShowImage.class); intent.putExtra("data", selectedphoto); startActivity(intent); removing the double quote from selectedphoto
score: 0
has comment: http://stackoverflow.com/comment/41039645
has comment: http://stackoverflow.com/comment/41039953
has comment: http://stackoverflow.com/comment/41039516
has comment: http://stackoverflow.com/comment/41039624
has comment: http://stackoverflow.com/comment/41039712
type: Answer

http://stackoverflow.com/comment/41018903
comment on: http://stackoverflow.com/q/26074939
score: 0
type: Comment
type: QuestionComment
has text: Thanks for JWS links. Can someone please provide info on _best practices around supporting both Swing and Web clients on service layer?_

http://stackoverflow.com/q/26102125
upvote count: 1
type: Question
downvote count: 0
tagged with: jsch
has answer: http://stackoverflow.com/a/26127827
tagged with: linux
has body: I'm trying to realize a bot that simulates an user that write/read on a ssh console in Java. I'm using the JSCH library to manage the ssh connection. This is the code from which I started: JSch jsch = new JSch(); Session session = jsch.getSession(username, ipAddress, port); session.setPassword(password); Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(connectionTimeoutInMillis); Channel channel = session.openChannel("shell"); InputStream is = new InputStream(); OutputStream out= new OutputStream(); channel.setInputStream(is); channel.setOutputStream(out); channel.connect(); channel.disconnect(); is.close(); out.close(); session.disconnect(); Obviously the InputStream and OutputStream in the code are wrong, I need to use something that the bot can use to send a String (a command line) and to receive a String(the result of the command execution), what type of streams should I use to obtain this? Furthermore I noticed that if I send a command and use the System.out as output stream in many cases the output is empty because (I'm almost sure about this) the Java application terminates before that the command execution has produced the result. What is the best practice to tell to JSCH channel listener "wait till the command execution has completed" and then go on? I could use a Thread.sleep(someTime) after the command execution but I don't like much it for obvious reasons.
answer count: 1
tagged with: ssh
tagged with: shell
score: 1
favorite count: 0
has title: How to create a bot that simulate an SSH shell user interaction?
accepted answer: http://stackoverflow.com/a/26127827
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40929662
comment on: http://stackoverflow.com/q/26100995
has text: i have removed try{} statement and no errors fired in debug mode, firewall ? antivirus ?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41046874
type: QuestionComment
comment on: http://stackoverflow.com/q/26179170
score: 1
has text: The method actionPerformed( ActionEvent e ) is called if the button is clicked. Each time if this occurs, you add a new MouseListener to the button. So if you have clicked the button first time, it has one MouseListener. If you have clicked the button second time, it has two MouseListener. If you have clicked the button third time, it has three MouseListener...
type: Comment

http://stackoverflow.com/q/26194160
type: Question
has answer: http://stackoverflow.com/a/26194187
answer count: 2
tagged with: class
has answer: http://stackoverflow.com/a/26194194
has body: I doing a java exercise which I had to look at the solution. The main program looks like this: import javax.swing.*; import java.util.*; public class PolarTest { public static Punkt tillPunkt(RPunkt pol) { Punkt resultat = new Punkt(); resultat.x = pol.r * Math.cos(pol.teta); resultat.y = pol.r * Math.sin(pol.teta); return resultat; } public static void main(String[] arg) { String s = JOptionPane.showInputDialog("Ange polära koordinater"); Scanner sc = new Scanner(s); RPunkt rp = new RPunkt(); rp.r = sc.nextDouble(); rp.teta = sc.nextDouble(); Punkt p = tillPunkt(rp); JOptionPane.showMessageDialog(null, "Som rektangulära koordinater (" + p.x + ", " + p.y +")"); } } and a class names RPunkt in a separate file: public class RPunkt { double r; double teta; } The thing with this code is that when I paste the code I get error saying that Punkt cannot be solve as a type. Is it because it's a method and not a class? Update: There is no class Punkt in the solution...
has comment: http://stackoverflow.com/comment/41073801
downvote count: 1
has comment: http://stackoverflow.com/comment/41073825
favorite count: 0
has comment: http://stackoverflow.com/comment/41073750
upvote count: 0
type: UnansweredQuestion
has title: object in a method?
tagged with: java
has comment: http://stackoverflow.com/comment/41073772
score: -1
tagged with: methods

http://stackoverflow.com/comment/40891149
type: QuestionComment
has text: Why is this not a legitimate question ?
comment on: http://stackoverflow.com/q/26094013
score: 0
type: Comment

http://stackoverflow.com/comment/40829541
comment on: http://stackoverflow.com/q/26061228
type: Comment
type: QuestionComment
score: 0
has text: I don't know about simple, but you seem to be describing a [Builder](http://en.wikipedia.org/wiki/Builder_pattern).

http://stackoverflow.com/q/26185964
accepted answer: http://stackoverflow.com/a/26186204
tagged with: java
type: Question
has title: "com.example restricted" Google Play error; even when changing the package name
has answer: http://stackoverflow.com/a/26186204
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
tagged with: android-gradle-plugin
downvote count: 0
score: 1
tagged with: gradle
type: AnsweredQuestion
has body: I went to publish my first android app from Android Studio. When I went to upload to Google Play, I got this error: Upload failed: You need to use a different package name because "com.example" is restricted. When I renamed the package name, it still gave me the error message. I tried making a new package and moving everything to that, but the error still persists. I've deleted any trace of the com.example package. I also made sure to change the Android Manifest.xml to the new package. The only thing that still says the old package name is the BuildConfig.java, which contains this line followed by the rest of my old package name: public static final String PACKAGE_NAME = "com.example" If someone can please help me and answer to this post, I would greatly appreciate it. I'm using Ubuntu Linux 14.04.1.

http://stackoverflow.com/a/26171377
has comment: http://stackoverflow.com/comment/41032170
type: Answer
has comment: http://stackoverflow.com/comment/41032458
answers question: http://stackoverflow.com/q/26170781
has comment: http://stackoverflow.com/comment/41032902
has comment: http://stackoverflow.com/comment/41032231
accepted answer of: http://stackoverflow.com/q/26170781
has comment: http://stackoverflow.com/comment/41032481
has body: You told it to process .java files, so it processed .java files. What did you expect? You named them in the command line: src\main\java\x\y\z\*.java. You can tell it to process .class files instead, if that's what you want it to do, or a mixture. NB there are a few other issues, and these apply to both -proc:none and -proc:only. javac -processorpath processor.jar -proc:only -processor x.y.z.MyAnnotationProcessor -verbose src\main\java\x\y\z\*.java That should be javac -processorpath processor.jar -proc:only -processor x.y.z.MyAnnotationProcessor -verbose -sourcepath src\main\java -cp src\main\java src\main\java\x\y\z\*.java or, better still, execute the command from within the src\main\java directory and omit the -sourcepath and -cp arguments. If you specified the -d option when compiling (-proc:none), you should specify the same directory in the -cp option when doing -proc:only.
has comment: http://stackoverflow.com/comment/41032426
has comment: http://stackoverflow.com/comment/41033331
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41033469
score: 0

http://stackoverflow.com/q/26086867
has comment: http://stackoverflow.com/comment/40876738
possible better answer: http://stackoverflow.com/a/26086916
has answer: http://stackoverflow.com/a/26086916
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26086912
tagged with: bufferedimage
downvote count: 1
has body: How would I resize a Java Image so that its size would be 1000 by 1000 px. It would be cool if it's like 1-3 lines of code. Thanks!
type: Question
has title: How to resize/rescale an image in Java
tagged with: resize
score: -1
tagged with: scaling
tagged with: image
answer count: 2
accepted answer: http://stackoverflow.com/a/26086912
upvote count: 0
has comment: http://stackoverflow.com/comment/40876730
linked to: http://stackoverflow.com/q/244164
favorite count: 0

http://stackoverflow.com/q/26039280
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/40793278
answer count: 2
has comment: http://stackoverflow.com/comment/40854966
linked to: http://stackoverflow.com/q/48284888
favorite count: 0
has comment: http://stackoverflow.com/comment/40789107
possible better answer: http://stackoverflow.com/a/26039988
has title: Write arabic characters with PDFBOX
linked to: http://stackoverflow.com/q/22260344
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40791487
tagged with: java
has comment: http://stackoverflow.com/comment/40789199
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/48284888
has answer: http://stackoverflow.com/a/26095763
accepted answer: http://stackoverflow.com/a/26095763
score: 5
has answer: http://stackoverflow.com/a/26039988
has comment: http://stackoverflow.com/comment/40793483
has body: Update 1 I'm trying to write some Arabic characters in a pdf document using pdfbox. As a result I get some strange characters. You can find below the code snippet I used for my test. Notice that the same code was used to print Latin characters without any problem. public static void main(String[] args) throws Exception { PDDocument document = new PDDocument(); PDPage page = new PDPage(PDPage.PAGE_SIZE_A4); document.addPage(page); PDPageContentStream stream = new PDPageContentStream(document, page,true, true); //Use of a unicode font PDFont font = PDTrueTypeFont.loadTTF(document,"C:/arialuni.ttf"); font.setFontEncoding(new WinAnsiEncoding()); stream.setFont(font, 12); stream.beginText(); stream.moveTextPositionByAmount(40, 600); stream.drawString("سي ججس ححسيب حسججسيبنم حح "); stream.endText(); stream.close(); document.save("c:\\resultpdf.pdf"); document.close(); } Thanks for your help. I tried a Unicode font downloaded from Microsoft website ,but I still have the same result. Update 2 By using the method 'drawUnicodeString' and the mehod 'loadTTF' I got form the PDFBOX-922 I was able to write arabic charactersm but they are disconnected and ordered from left-to-right. Here are the two methods 'drawUnicodeString' and 'loadTTF' public void drawUnicodeString(String text) throws IOException { COSString string = new COSString(); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); string.append(c >> 8); string.append(c & 0xff); } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); string.writePDF(buffer); appendRawCommands(buffer.toByteArray()); appendRawCommands(32); appendRawCommands(getISOBytes("Tj\n")); } public static PDType0Font loadTTF(PDDocument doc, InputStream is) throws IOException { /* Load the font which we will convert to Type0 font. */ PDTrueTypeFont pdTtf = PDTrueTypeFont.loadTTF(doc, is); TrueTypeFont ttf = pdTtf.getTTFFont(); CMAPEncodingEntry unicodeMap = null; for (CMAPEncodingEntry candidate : ttf.getCMAP().getCmaps()) { if (can…

http://stackoverflow.com/q/26143057
has comment: http://stackoverflow.com/comment/41004565
favorite count: 0
has title: Should I unit test private methods?
type: Question
has answer: http://stackoverflow.com/a/26144039
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26144384
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/7075938
tagged with: unit-testing
linked to: http://stackoverflow.com/q/34571
has answer: http://stackoverflow.com/a/26144091
type: UnansweredQuestion
has body: I know there is an ongoing debate in many posts [ 1,2 ] in this sites on whether you should test private methods directly or indirectly. What I can't seem to understand is how can I test a class where it has for example - 3 private methods that are approached by 10 different public methods. Let's say the private methods sort its specific data structures or retrieve a value from them in a special way that only relates to the class (I am not going to create an inner class in every scenario). Now, if I choose to test the private indirectly than I would have to re-write the tests for that private logic every time I test the public methods in order to fully test the method and keep the unit tests independent. (It is not always possible to create a private method in the test class that tests the mutual code ) I will than have a to write repeating code and long test methods. So how is the indirect testing eligible as a standard?
has comment: http://stackoverflow.com/comment/41023563
has comment: http://stackoverflow.com/comment/40981044

http://stackoverflow.com/a/26055041
upvote count: 3
has comment: http://stackoverflow.com/comment/40818393
has body: You do not have a database "called" orcl on the database server 10.0.32.166 with an oracle listener running on port 1521. Do lsnrctl statusfrom the console on server 10.0.32.166 and see if you have a line like Service "ORCL" has X instance(s). If you don't have that make sure the database is up and you have the correct SID and it is using the listener on port 1521.
score: 3
answers question: http://stackoverflow.com/q/26054836
downvote count: 0
has comment: http://stackoverflow.com/comment/40818607
type: Answer

http://stackoverflow.com/comment/40900342
type: AnswerComment
has text: A null reference is a reference to *nothing* (null).
type: Comment
comment on: http://stackoverflow.com/a/26099668
score: 0

http://stackoverflow.com/comment/41057180
type: Comment
comment on: http://stackoverflow.com/a/26168174
has text: thanks, I only makig a bad redirect but with a JSTL tag everything works fine
score: 0
type: AnswerComment

http://stackoverflow.com/a/26112834
has body: You should make Teacher a class representing teacher. Then, you create instances of Teacher objects outside teacher class. public class Teacher{ private String name; private String catchPhrase; private int roomNumber; public(String name, String catchPhrase, int roomNumber){ this.name = name; this.catchPhrase = catchPhrase; this.roomNumber = roomNumber; } //put setters and getters here... public String toString(){ return "Name: "+this.getName()+"\nCatch Phrase: "+this.getCatchPhrase() + "\nRoom Number: "+this.getRoomNumber(); } } Then, you can create Teacher objects. For instance, you can put them in TeacherDriver class. public class TeacherDriver{ public static void main (String[] args){ //create array of teachers (you can use list and other data structures if you want) Teacher[] myTeachers = new Teacher[]{ new Teacher("Mr. Clark", "Just do it", 225), new Teacher("Mr. Harris", "Do the essays and you will pass.", 123) }; //ask for room number input here... //mark this truE if teacher is found boolean found = false; //search the array of teachers for a match for(Teacher chosenTeacher : myTeachers) //if the room number of the teacher matches your target room number //then display teacher info and stop reading the array //note: replace &lt;your input room number&gt; with your input variable name if(chosenTeacher.getRoomNumber() == &lt;your input room number&gt;){ found = true; System.out.println(chosenTeacher.toString()); break; //stop the loop } } if(!found){ System.out.println ( "I don't have a teacher in that room." ); } } A better way to do this though is to create another class that holds collection/array of Teacher objects. Example: public class TeacherList{ List&lt;Teacher&gt; teachers; public TeacherList(){ teachers = new ArrayList&lt;&gt;(); //you can put initial entries like: teacher.add(new Teacher("Mr. Clark", "Just do it", 225)); teacher.add( new Teacher("Mr. Harris", "Do the essays and you will pass.", 123)); } public void add(Teacher e){ teachers.add(e); …
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26112121

http://stackoverflow.com/q/26066064
tagged with: authorization
has body: I am trying to use gdata to get the google contacts of a specific user. The action will be performed in a console application. Having username(email) and a password I can retrieve the data I need in case on the account level access of unchecked applications is enabled (As I understand I am using ClientLogin). I also can use the application-specific password if it is set on acount level. I know that I can use Oauth to authorize without using userId-password, but that hardly can work for me because as I understand each use will have to generate Client ID for native application inclusing CLIENT ID, CLIENT SECRET and REDIRECT URIS(please correct me if I am not right) The code I am using is: ContactsService contactsService = new ContactsService("projectName"); contactsService.setUserCredentials(email, password); URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full"); Query myQuery = new Query(feedUrl); myQuery.setMaxResults(100); ContactFeed resultFeed = contactsService.getFeed(myQuery, ContactFeed.class); Is there any way to get all contacts from the account not depending on the account settings, having userId(email) and passowrd? (Opening browser and making user to authorize or something like that may also work)
type: AnsweredQuestion
tagged with: java
type: Question
has title: Is there any way to get google contacts having password and username(email) without specific account settings?
tagged with: gdata
score: 0
has answer: http://stackoverflow.com/a/26069317
accepted answer: http://stackoverflow.com/a/26069317
answer count: 1

http://stackoverflow.com/q/26126265
has comment: http://stackoverflow.com/comment/40948366
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26126349
type: AnsweredQuestion
has title: How to compare last two letters of a string in alphabetical order in Java?
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40948287
tagged with: string
has comment: http://stackoverflow.com/comment/40948268
has answer: http://stackoverflow.com/a/26126387
has answer: http://stackoverflow.com/a/26126349
score: 0
has body: I am having a problem comparing last two alphabetic letters of a single string in alphabetical order. I know how to compare two strings alphabetically using compareTo() string function but no idea about this. This is what I have to do : Method isIncreasing() to check whether the given string is an increasing string or not. It is increasing if, while moving from Left to Right, each character in the string comes after the previous character in the alphabetical order. Example: ANT is an increasing string whereas APPLE is not.
has comment: http://stackoverflow.com/comment/40948276
possible better answer: http://stackoverflow.com/a/26126387
favorite count: 0

yammer
type: Tag
tags question: http://stackoverflow.com/q/26038298
tag name: yammer

http://stackoverflow.com/comment/41158438
type: QuestionComment
comment on: http://stackoverflow.com/q/26060209
type: Comment
score: 0
has text: Thank you all: @apangin for your suggestions. Unfortunately it did not help to solve the problem. Please see my Update 1. Any other ideas?

http://stackoverflow.com/q/26179976
has comment: http://stackoverflow.com/comment/41047714
has body: I need a simple sequence which would give me incremented integers that I later on use as part of a String. I made this sequence using postgresql command line: CREATE SEQUENCE my_seq INCREMENT BY 1 The sequence exists as I can query it from postgresql command line, But I'm trying to get the values using hibernate: Query query = session.createSQLQuery("select nextval(:sequence);"); query.setParameter("sequence", "my_seq"); Long nextVal=((BigInteger)query.uniqueResult()).longValue(); And I am getting this exception: ERROR: relation "my_seq" does not exist The sequence values do NOT represent the attribute of any entity. I only need them to store the number of logins, but I do not store the logins as entities. EDIT: I got it working by adding the scheme name to the query: String query1 = "select nextval(myscheme.my_seq)"; Query query = session.createSQLQuery(query1); I can't figure out why it needed the scheme though, as myscheme was already default and all other queries worked fine without specifying the scheme. If anyone can shed some light I shall accept its answer.
type: UnansweredQuestion
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/41047742
linked to: http://stackoverflow.com/q/6386888
tagged with: java
tagged with: hibernate
has title: hibernate cannot find sequence
has answer: http://stackoverflow.com/a/27122649
type: Question
linked to: http://stackoverflow.com/q/2737420
has comment: http://stackoverflow.com/comment/41049828
tagged with: postgresql
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26181493
has answer: http://stackoverflow.com/a/26180707

http://stackoverflow.com/q/26070580
tagged with: java
type: Question
tagged with: split
has title: How to add two numbers in the same row of a file
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26070646
has body: Hello I need to add two integers in the same row of a file, separated by tab. My file abc.txt has the following entry: 12 123 15 456 My program needs to add 12 with 123 and 15 with 456. I am able to split the two entries in a row and convert them to integer, but I don't know how to treat them as separate numbers and add them. For example, if I try to add then 12 adds with 12 and 123 adds with 123, where it should be 12+123. Here is my program: import java.io.*; public class test { public static void main(String[] args) { String s = ""; FileInputStream finp = null; InputStreamReader inpr = null; BufferedReader br = null; try { finp = new FileInputStream(args[0]); inpr = new InputStreamReader(finp); br = new BufferedReader(inpr); } catch (FileNotFoundException e) { e.printStackTrace(); } try { while (true) { s = br.readLine(); if (s == null) break; for (int i = 0; i &lt; 2; i++) { String [] addrs = s.split("\t"); int a = Integer.parseInt(addrs[i]); System.out.println(a + a); } } } catch (IOException e) { e.printStackTrace(); } } }

http://stackoverflow.com/comment/41065922
type: Comment
comment on: http://stackoverflow.com/q/26176562
type: QuestionComment
score: 1
has text: @Jongware yes dude, Wat change I need to made to make it accept PNG also??

http://stackoverflow.com/q/26112250
favorite count: 0
has title: Mult method taking 2 integer parameters and find product
has answer: http://stackoverflow.com/a/26112312
has body: I'm using Android aide. My task is to use a mult method that takes 2 integer parameters and find the product of both. public class Main { Public static void (String [ ] args) { system.out.println (mult(10,100)); system.out.println (mult (20,200)); } { static int mult(int a, int b); return a * b; } } What am I doing wrong or missing? Thanks.
type: UnansweredQuestion
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40922786
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26112323
tagged with: static-methods
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/40786704
has text: What do you mean by "different states"? You could certainly put (non-static) fields in your single-element enum. I'm not sure I see what problem you're facing... how would having public static fielsd give you *different* states?
comment on: http://stackoverflow.com/q/26038016
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/26076833
type: Answer
has body: try this : public static void main(String[] args) { long longVal=1411833674288l; String stringVal=Long.toString(longVal); System.out.println("longVal = "+longVal); System.out.println("stringVal = "+stringVal); System.out.println("back to longVal = "+Long.parseLong(stringVal)); }
score: 0
answers question: http://stackoverflow.com/q/26076542

http://stackoverflow.com/comment/41031650
comment on: http://stackoverflow.com/q/26155043
type: Comment
type: QuestionComment
has text: @Ramjet That's the problem, you can't "add" to a zipfile. You will need to open the existing zipfile and copy it's contents to a new zipfile, when done, and before closing it, you will need to add the new entries. When done, close the new zip file, delete the old one and rename it...
score: 0

http://stackoverflow.com/comment/40934202
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26117545
has text: It says invalid usage of correct parameters. Would null be a correct parameter?

http://stackoverflow.com/comment/40940596
type: Comment
has text: @KumarAbhinav i want to understand the flow of return statement with respect to this porgram
comment on: http://stackoverflow.com/q/26121506
score: 0
type: QuestionComment

http://stackoverflow.com/q/26154866
accepted answer: http://stackoverflow.com/a/26154937
type: Question
has body: I've an entity class something like: import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "exampleclass") public class ExampleEntityClass implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "ID") private Integer id; @Column(name = "name") private String name; public ExampleEntityClass() { } public ExampleEntityClass(Integer id, String name) { this.id = id; this.name = name; } public Integer getId() { return id; } public String getName() { return name; } } And in my persistence.xml file I've: <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider model.Pingpongstation <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/mydb?zeroDateTimeBehavior=convertToNull"/> <property name="javax.persistence.jdbc.user" value="root"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <property name="javax.persistence.jdbc.password" value="root"/> <property name="javax.persistence.schema-generation.database.action" value="create"/> As far as I understand, this <property name="javax.persistence.schema-generation.database.action" value="create"/> will tell the JPA provider, in this case EclipseLink, when persisting an Object of type ExampleEntityClass to create the table if it does not exist. It works fine until I delete the table and try another persist. In other words, Lets say I do: entityManager.persist(object); // It will work And then I manually delete the table exampleClass from my database and re-run: entityManager.persist(object); // After deleting the table -> It will fail Now it will generate an exception. If I restart my MySQL server and try again it will work. OR if I restart my applicat…
has title: Java JPA - Create table from entity not working on the second run
score: 0
answer count: 2
tagged with: mysql
has comment: http://stackoverflow.com/comment/41000985
has answer: http://stackoverflow.com/a/26154937
tagged with: java
has comment: http://stackoverflow.com/comment/41001030
has answer: http://stackoverflow.com/a/26154935
type: AnsweredQuestion
tagged with: eclipselink
tagged with: sql
tagged with: jpa
possible better answer: http://stackoverflow.com/a/26154935

http://stackoverflow.com/q/26112860
has answer: http://stackoverflow.com/a/26112908
has title: How to search a file?
has answer: http://stackoverflow.com/a/26112938
has body: Supposedly the user will enter their "ID #: 1203103" then after that it will automatically create a text file named 1203103.txt. How can I search the file name "1203103.txt" in the file directory? String id = scan.nextLine(); File file = new File(id+".txt"); FileWriter fileWrite = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWrite); System.out.println("Enter the ID # to search: ");
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26112928
has answer: http://stackoverflow.com/a/26112909
tagged with: java
accepted answer: http://stackoverflow.com/a/26113327
has comment: http://stackoverflow.com/comment/40923804
type: Question
has comment: http://stackoverflow.com/comment/40923831
has answer: http://stackoverflow.com/a/26112896
score: 4
upvote count: 4
downvote count: 0
answer count: 7
possible better answer: http://stackoverflow.com/a/26112908
favorite count: 0
has answer: http://stackoverflow.com/a/26113327
has answer: http://stackoverflow.com/a/26112910

http://stackoverflow.com/q/26059816
has body: i m kinda stuck in performing one to many relationship in hibernate , so needed some suggestions as to where i m going wrong Author Class package com.hibernate.arjun3; import javax.persistence.*; @Entity public class Author { private String name; @Id @GeneratedValue private int author_id; @OneToMany(cascade=CascadeType.ALL) private Book book; public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAuthor_id() { return author_id; } public void setAuthor_id(int author_id) { this.author_id = author_id; } } Book Class package com.hibernate.arjun3; import javax.persistence.*; @Entity public class Book { private String title; @Id @GeneratedValue private int author_id; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getAuthor_id() { return author_id; } public void setAuthor_id(int author_id) { this.author_id = author_id; } } My Main Class package com.hibernate.arjun3; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; public class Main { public static void main(String args[]) { Author author = new Author(); author.setName("Brian"); Book book = new Book(); book.setTitle("The Incredible Brian"); Book book2 = new Book(); book2.setTitle("Superman"); author.setBook(book); author.setBook(book2); SessionFactory factory = new AnnotationConfiguration().configure().buildSessionFactory(); Session session = factory.openSession(); session.beginTransaction(); session.save(author); session.getTransaction().commit(); session.close(); factory.close(); } } and i m getting this error Exception in thread "main" org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.hibernate.arjun3.Author.book at org.hibernate.cfg.annotations.CollectionBinder.…
score: 0
answer count: 2
has title: query regarding one to many relationship in hibernate
has answer: http://stackoverflow.com/a/26059971
accepted answer: http://stackoverflow.com/a/26059971
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26059997
has answer: http://stackoverflow.com/a/26059997
type: Question
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/26070724
tagged with: java
accepted answer: http://stackoverflow.com/a/28276624
has body: My Table schema is: desc TRNX_TXN_MAP_VALUES Name Null Type ------------------- -------- --------------- BASE_TRANSACTION_ID NOT NULL NUMBER(19) MAP_TYPE NOT NULL VARCHAR2(2) ENUM_TYPE NOT NULL VARCHAR2(30) DECIMALVALUE NUMBER(12,2) STRINGVALUE VARCHAR2(100) LONGVALUE NUMBER(19) BOOLEANVALUE NUMBER(1) DOUBLEVALUE NUMBER(38,2) CURRENCYCODE VARCHAR2(20) AMOUNT NUMBER(18,2) DOUBLEARRAY DOUBLE_VARRAY() While storing certain values I am getting following exception: It seems that some values have a very large precision and the column it gets mapped to does support it. Is this possible? I am using Oracle 11g as my Database and Spring JdbcTemple to persist things. TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [1264684185], value class [java.lang.Long], SQL type -5 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 2, parameter value [P], value class [java.lang.String], SQL type 12 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 3, parameter value [MTM], value class [java.lang.String], SQL type 12 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 4, parameter value [null], value class [null], SQL type 3 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 5, parameter value [null], value class [null], SQL type 12 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 6, parameter value [null], value class [null], SQL type -5 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 7, parameter value [null], value class [null], SQL type 4 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 8, parameter value [null], value class [null], SQL type 8 TRACE StatementCreatorUtils - Setting SQL statement parameter value: column index 9, parameter value [USD], value class [java.lang.String], SQL type 12 TRACE StatementCreator…
has comment: http://stackoverflow.com/comment/40847702
type: Question
answer count: 2
tagged with: oracle-database
tagged with: sql
possible better answer: http://stackoverflow.com/a/47384913
has answer: http://stackoverflow.com/a/47384913
has answer: http://stackoverflow.com/a/28276624
tagged with: spring-jdbc
has title: Overflow while trying to bind NaN
score: 0
tagged with: jdbctemplate
type: AnsweredQuestion

http://stackoverflow.com/comment/41031637
has text: Usually something like this would be implemented using accessor methods. Is there any reason why you need it to be done with field access? Do the actions all have the same number of `param_*` parameters?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26171132

http://stackoverflow.com/q/26130771
score: 0
has body: I need to make a boolean method that takes in a string and checks if it is a binary number. If it is binary it should return true, if it contains anything other than 0s and 1s, return false. Here is my code: public static boolean CheckInputCorrect(String input) { int len = input.length(); for(int i=0; i&lt;len; i++) if(input.charAt(i) == '1' || input.charAt(i) == '0') { continue; return true; } else { break; return false; } } I suspect a syntax error, however no matter what I try it finds an error. Any help would be greatly appreciated!
answer count: 2
has comment: http://stackoverflow.com/comment/40956997
has title: How to create boolean method using return true statement
has answer: http://stackoverflow.com/a/26130815
accepted answer: http://stackoverflow.com/a/26130815
has comment: http://stackoverflow.com/comment/40956967
type: AnsweredQuestion
tagged with: binary
tagged with: return
possible better answer: http://stackoverflow.com/a/26130817
has answer: http://stackoverflow.com/a/26130817
tagged with: methods
type: Question
tagged with: java
tagged with: boolean

http://stackoverflow.com/q/26163306
tagged with: binary
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/26163875
has answer: http://stackoverflow.com/a/26163374
tagged with: java
has body: Im here again to ask question. Earlier we have to explain our program in some instructor in my school and Thankfully I explained it well. but the problem is the codes that I used is Hashmapping but this was not yet taught to us So the professor told me that I can use switch structure instead of using Hashmapping but I dont know how i can translate it in switch method.. Can you show me if its possible to create an Switch in my program.. PS: I Know I can used binary built in.. but this is the requirements thank you my code: import java.util.*; import java.io.*; class Jasper { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader( System.in)); HashMap&lt;Character, String&gt; map = new HashMap&lt;Character, String&gt;(); map.put('0', "0000"); map.put('1', "0001"); map.put('2', "0010"); map.put('3', "0011"); map.put('4', "0100"); map.put('5', "0101"); map.put('6', "0110"); map.put('7', "0111"); map.put('8', "1000"); map.put('9', "1001"); map.put('A', "1010"); map.put('B', "1011"); map.put('C', "1100"); map.put('D', "1101"); map.put('F', "1111"); System.out.print("Input your Hex Number here : "); String userInput = input.readLine(); String x = userInput.toUpperCase(); String resultx = ""; for (int i = 0; i &lt; userInput.length(); i++) { char hexVal = x.charAt(i); String binary = map.get(hexVal); resultx = resultx + "\n" + hexVal + "-" + binary; } System.out.println("The Binary of " + x + ":" + resultx); } }
type: Question
has answer: http://stackoverflow.com/a/26163806
has title: Can I use switch structures in my Hexadecimal to Binary Converter
has answer: http://stackoverflow.com/a/26163700
has comment: http://stackoverflow.com/comment/41016711
tagged with: converters
has comment: http://stackoverflow.com/comment/41017417
answer count: 4
tagged with: hex

http://stackoverflow.com/comment/40850351
comment on: http://stackoverflow.com/q/26072238
score: 4
type: Comment
type: QuestionComment
has text: If you're inside a scheduled job, you're not responding to any HTTP request, so there is no request available. Get the data needed by the scheduled job from the request when creating and scheduling the job, not from inside the scheduled job itself.

http://stackoverflow.com/a/26057908
has body: As @Wundwin Born said before: javax.persistence.transient will make sure that Hibernate will ignore that particular field from saving it into the db and vice-versa. java.beans.transient will make sure that the particular field will be ignored by the encoders (derived from Encoder). See http://docs.oracle.com/javase/7/docs/api/java/beans/Transient.html
answers question: http://stackoverflow.com/q/26056397
type: Answer
upvote count: 11
score: 11
accepted answer of: http://stackoverflow.com/q/26056397
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26080344
has comment: http://stackoverflow.com/comment/40865092
answer count: 1
favorite count: 0
tagged with: cubic
has comment: http://stackoverflow.com/comment/40864968
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40864984
score: -3
has comment: http://stackoverflow.com/comment/40864971
upvote count: 0
has body: I need a little bit of help. I basically want to calculate the block count between two coordinates in the world, but I'm not too good at math as you can see, so If you have a solution please write it to me. This is important so please write it, I'd appreciate it! int x1 = 0, y1 = 0, z1 = 0, x2 = 0, y2 = 0, z2 = 0; x2 = x // pos x in the coord y2 = y // pos y in the coord z2 = z // pos z in the coord x1 = x; y1 = y; z1 = z; int a = Math.abs(Math.abs(x1)-(Math.abs(x2))); int b = Math.abs(Math.abs(y1)-(Math.abs(y2))); int c = Math.abs(Math.abs(z1)-(Math.abs(z2))); if(x2 != 0) int volume = a*b*c;
has answer: http://stackoverflow.com/a/26080522
tagged with: java
has title: Calculating cubic volume between 2 coordinates
type: Question
tagged with: math
tagged with: http://stackoverflow.com/tag/c
downvote count: 3

http://stackoverflow.com/q/26127598
score: 0
has comment: http://stackoverflow.com/comment/40950861
has body: I'm having an issue with my try/catch blocks. Now, my code works somewhat, however, when I enter in an invalid number ("a") for example, I have the program print out, ("please enter a valid number: "); But, I have a method that gets the object at the entered index and it's stating the local variable may not have been initialized. do { int firstNum; int secondNum; int thirdNum; System.out .println("Please enter three of the numbers you see on the left of the shape:"); try { firstNum = scan.nextInt(); secondNum = scan.nextInt(); thirdNum = scan.nextInt(); Card card = Deck.randomizedCards.get(firstNum); Card card1 = Deck.randomizedCards.get(secondNum); Card card2 = Deck.randomizedCards.get(thirdNum); if (Deck.isSet(card, card1, card2) == true) { JOptionPane.showMessageDialog(panel, "You found a set!"); Deck.completedSets.add(card); Deck.completedSets.add(card1); Deck.completedSets.add(card2); } else { JOptionPane.showMessageDialog(panel, "You didn't find a set"); } break; } catch (InputMismatchException name) { System.out .println("You have entered an invalid number, please enter a number:"); } catch (ArrayIndexOutOfBoundsException name) { System.out .println("You have entered an invalid number, please enter a number:"); } } while (true);
has comment: http://stackoverflow.com/comment/40950762
accepted answer: http://stackoverflow.com/a/26132637
linked to: http://stackoverflow.com/q/25940276
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/26127668
has answer: http://stackoverflow.com/a/26127697
has comment: http://stackoverflow.com/comment/40951118
answer count: 4
has comment: http://stackoverflow.com/comment/40951972
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40950889
tagged with: loops
has answer: http://stackoverflow.com/a/26127648
has answer: http://stackoverflow.com/a/26132637
type: Question
tagged with: try-catch
has title: Try/Catch variable can't be initialized
possible better answer: http://stackoverflow.com/a/26127648
tagged with: variables
has comment: http://stackoverflow.com/comment/40951213

http://stackoverflow.com/comment/40825073
has text: Although unlikely in this example, the subtraction could overflow. `return Integer.compare(this.getFloorNo(), floor.getFloorNo());` does not overflow.
type: Comment
score: 6
type: AnswerComment
comment on: http://stackoverflow.com/a/26058846

http://stackoverflow.com/comment/41045877
has text: you can catch each one individually in the order that they are called as long as they are not higher than the next in the inheritance hierarchy.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26179103
score: 0

http://stackoverflow.com/a/26091120
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26091119
answers question: http://stackoverflow.com/q/26091119
type: Answer
has comment: http://stackoverflow.com/comment/40927524
has comment: http://stackoverflow.com/comment/40922395
downvote count: 0
has body: (Self answer; correct if necessary!) Through experimenting, I've found that I need to use Transaction.success(...) if I want the transaction to ever run again. Transaction.abort() always stops Firebase from trying again, so I should only use it when I'm sure that the transaction cannot proceed. (e.g. if data.getValue() indicates that something is off at the data location, and it will not be corrected by any pending writes.) In my example, data.getValue() == null seems like a particularly bad case to abort(), since there may be new values pending from the earlier write. If I return Transaction.success(data) in the error cases, Firebase will make sure the consistency eventually works out. e.g. I will not accidentally end up writing null to that location, unless the value given by data.getValue() really is missing. I can do all the error checking in the Transaction.Handler.onComplete(...) method, which has a DataSnapshot parameter to check the final data at the location.
score: 3
upvote count: 3

http://stackoverflow.com/q/26085225
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/77183890
answer count: 2
tagged with: network-programming
has comment: http://stackoverflow.com/comment/136068127
has body: At Client I chunks buffer with Arrays.CopyofRange() from 1 FileEvent object: byte[] data = outputStream.toByteArray(); for (int i = 0; i &lt;= data.length; i += incommingData.length) { byte[] forSent = new byte[0x3ff]; forSent = Arrays.copyOfRange(data, i, i + 1023); DatagramPacket sendPacket = new DatagramPacket(forSent, forSent.length, ipAddress, PORT); socket.send(sendPacket); System.out.println("File sent from client : " + i); } String done = "Done"; DatagramPacket stringDone = new DatagramPacket(done.getBytes(), done.length(), ipAddress, PORT); socket.send(stringDone); And at Server: do { byte[] incomingData = new byte[1024 * 1000 * 50]; incomingPacket = new DatagramPacket(incomingData, incomingData.length); socket.receive(incomingPacket); byte[] data ; data = incomingPacket.getData(); result = Arrays.copyOfRange(data, 0, data.length); System.out.println("Da nhan:" + result.length); message = new String(incomingPacket.getData(), 0, incomingPacket.getLength()); System.out.println(message); } while ( !message.equals("Done")); after send all buffer, i send 1 String "done". And at Server i check end of file by String "done". But it not work, via UDP, how can i detect end of file transfer. Thanks!
has answer: http://stackoverflow.com/a/26085503
tagged with: udp
upvote count: 1
favorite count: 0
has title: Transfer File through UDP in Java. How to detect end of file at Server?
type: UnansweredQuestion

http://stackoverflow.com/comment/40948024
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26126029
has text: mySensorEventListener is a field with new initialized, when RouteMapActivity is created.
score: 0

http://stackoverflow.com/a/26064682
upvote count: 2
answers question: http://stackoverflow.com/q/26064591
has body: Your approach will work but it is going to get pretty messy. I would instead suggest a HashMap which allows you to associate your Strings with the Integers they map to. You can start from scratch: HashMap&lt;String, Integer&gt; myMap = new HashMap&lt;String, Integer&gt;(); myMap.put("A", 1); myMap.put("B", 1); myMap.put("C", 1); myMap.put("D", 2); // and so on Alternatively, you can keep your arrays and do this: HashMap&lt;String, Integer&gt; myMap = new HashMap&lt;String, Integer&gt;(); for(String letter : LettersOne) { //agh, please use camel case! myMap.put(letter,1); } for(String letter : LettersTwo) { //agh, please use camel case! myMap.put(letter,2); } This allows you to store and associate individual letters to numbers. Because this is a learning experience, I will let you read the documentation to determine how to get the int out.
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41051836
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26178652
has text: The vast bulk of the overhead should be in establishing the link. After that encryption should be minimal.

http://stackoverflow.com/a/26151470
answers question: http://stackoverflow.com/q/26151164
upvote count: 0
has body: http is a stateless protocol.The main messages exchanged are in XML or JSON format. You can look up JRMP here is this link http://en.wikipedia.org/wiki/Java_Remote_Method_Protocol
downvote count: 1
score: -1
type: Answer

http://stackoverflow.com/a/26190235
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41115100
type: Answer
has comment: http://stackoverflow.com/comment/41114847
upvote count: 2
has comment: http://stackoverflow.com/comment/41117474
score: 2
has comment: http://stackoverflow.com/comment/52864000
accepted answer of: http://stackoverflow.com/q/26186533
has body: channel error; protocol method: #method(reply-code=404, reply-text=NOT_FOUND - home node 'hare@mbp15Q0F1G3' of durable queue 'myqueue' in vhost '/' is down or inaccessible, class-id=50, method-id=10) It sounds like you haven't configured the queue for HA - only mirrored queues are replicated.
has comment: http://stackoverflow.com/comment/52862783
answers question: http://stackoverflow.com/q/26186533

http://stackoverflow.com/comment/40942838
score: 0
type: AnswerComment
type: Comment
has text: i don't know how to do it :(
comment on: http://stackoverflow.com/a/26122871

http://stackoverflow.com/q/26074297
has comment: http://stackoverflow.com/comment/40854957
tagged with: android
has comment: http://stackoverflow.com/comment/40854091
has answer: http://stackoverflow.com/a/26080952
type: UnansweredQuestion
tagged with: opengl-es-2.0
type: Question
tagged with: java
has body: I try to link a basic shader program with a vertex and fragment shader. Both shaders compile successfully, but if I try to link the program the linking always fails. Whats wrong, why the linking is failing? The info log is empty, but I get GL_INVALID_OPERATION error, when linking. I run the MAIN code in the "onSurfaceCreated" method from the GLSurfaceView.Renderer interface. MAIN: String vertexShaderSource = "attribute vec4 a_Position; " + "void main() " + "{ " + " gl_Position = a_Position; " + "} "; String fragmentShaderSource = "precision mediump float; " + "void main() " + "{ " + " gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);" + "} "; int vertexShaderHandle = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER); GLES20.glShaderSource(vertexShaderHandle, vertexShaderSource); ShaderHelper.compileShader(vertexShaderHandle); int fragmentShaderHandle = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER); GLES20.glShaderSource(fragmentShaderHandle, fragmentShaderSource); ShaderHelper.compileShader(fragmentShaderHandle); programHandle = GLES20.glCreateProgram(); GLES20.glAttachShader(programHandle, vertexShaderHandle); GLES20.glAttachShader(programHandle, fragmentShaderHandle); ProgramHelper.linkProgram(fragmentShaderHandle); HELPER: public static void compileShader(int shaderHandle) { GLES20.glCompileShader(shaderHandle); int[] results = new int[1]; GLES20.glGetShaderiv(shaderHandle, GLES20.GL_COMPILE_STATUS, results, 0); if(results[0] != GLES20.GL_TRUE) { String infoLog = GLES20.glGetShaderInfoLog(shaderHandle); throw new RuntimeException("Failed to compile shader!" + '\n' + infoLog); } } public static void linkProgram(int programHandle) { GLES20.glLinkProgram(programHandle); int[] results = new int[1]; GLES20.glGetProgramiv(programHandle, GLES20.GL_LINK_STATUS, results, 0); if(results[0] != GLES20.GL_TRUE) { String infoLog = GLES20.glGetProgramInfoLog(programHandle); throw new RuntimeException("Failed to link program!" + '\n' + infoLog); } } EDIT: WTF, the program links fine, if …
answer count: 1
has comment: http://stackoverflow.com/comment/40855080
has title: Java Android OpenGL ES 2.0 Can't link program
score: 0

http://stackoverflow.com/q/26176800
favorite count: 0
accepted answer: http://stackoverflow.com/a/26177281
has body: I want to execute the following query to conditionally drop a temporary table. String dropSql = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE " + tmpTblName + "';" + " EXCEPTION" + " WHEN OTHERS THEN" + " IF SQLCODE!=-942 THEN" + " RAISE;" + " END IF;" + " END"; And then execute it as a native query like this: JPA.em().createNativeQuery(dropSql) .executeUpdate(); However, JPA will not let me or rather, the oracle db won't. Apparently the ; get escaped or misinterpreted somehow. Caused by: java.sql.SQLException: ORA-06550: line 1, column 120: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; &lt;an identifier&gt; &lt;a double-quoted delimited-identifier&gt; The symbol ";" was substituted for "end-of-file" to continue. Will I have to live with using separate queries to achieve my goal or is there some trick to this?
tagged with: oracle-database
has title: Can I have multiple statements in a native query in JPA 2
upvote count: 6
score: 6
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26177281
tagged with: java
tagged with: plsql
tagged with: sql
tagged with: jpa
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26045011
type: Question
has comment: http://stackoverflow.com/comment/40812201
has comment: http://stackoverflow.com/comment/40800245
answer count: 1
tagged with: replace
score: 0
has title: Replace part of the string from reference string
tagged with: string
type: UnansweredQuestion
has body: I have a String ArrayList consisting alphabets followed by a digit as a suffix to each of the alphabet. ArrayList &lt;String&gt; baseOctave = new ArrayList(); baseOctave.add("S1"); baseOctave.add("R2"); baseOctave.add("G4"); baseOctave.add("M2"); baseOctave.add("P3"); baseOctave.add("D1"); baseOctave.add("N1"); I pass the strings from this baseOctave and few other characters as input pattern for creating an object. MyClass obj1 = new MyClass ("S1,,R2.,M2''-"); Since I frequently make use of these kind of input patterns during object instantiation, I would like to use simple characters S, R, G, M etc. Ex: MyClass obj1 = new MyClass ("S,,R.,M''-"); MyClass obj2 = new MyClass ("S1,G.,M,D1"); So the alphabets used during object creation may contain digits as suffix or it may not have digit as suffix. But inside the constructor (or in separate method), I would like to replace these simple alphabets with alphabets having suffix. The suffix is taken from the baseOctave. Ex: above two strings in obj1 and obj2 should be "S1,,R2.,M2''-" and "S1,G4.,M2,D1" I tied to do this, but could not continue the code below. Need some help for replacing please.. static void addSwaraSuffix(ArrayList&lt;String&gt; pattern) { for (int index = 0; index &lt; pattern.size(); index++) { // Get the patterns one by one from the arrayList and verify and manipulate if necessary. String str = pattern.get(index); // First see if the second character in Array List element is digit or not. // If digit, nothing should be done. //If not, replace/insert the corresponding index from master list if (Character.isDigit(str.charAt(1)) != true) { // Replace from baseOctave. str = str.replace(str.charAt(0), ?); // replace with appropriate alphabet having suffix from baseOctave. // Finally put the str back to arrayList. pattern.set(index, str); } } } Edited information is below: Thanks for the answer. I found another solution and works fine. below is the complete code that I found working. Let me know if there is …
has answer: http://stackoverflow.com/a/26045366
tagged with: java

http://stackoverflow.com/comment/41002507
has text: i have set the unique id and now above is my logcat's error
type: Comment
comment on: http://stackoverflow.com/a/26151479
score: 0
type: AnswerComment

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/26069160
type: Tag
tags question: http://stackoverflow.com/q/26061705
tags question: http://stackoverflow.com/q/26134716

http://stackoverflow.com/comment/41036921
type: Comment
comment on: http://stackoverflow.com/a/26174072
type: AnswerComment
has text: air water cannot declared as char .op should definitely use enum
score: 0

http://stackoverflow.com/comment/40789199
has text: Try to use every `Encoding` implementation from this document: http://pdfbox.apache.org/docs/1.8.6/javadocs/org/apache/pdfbox/encoding/Encoding.html
type: Comment
score: 3
comment on: http://stackoverflow.com/q/26039280
type: QuestionComment

http://stackoverflow.com/q/26156310
tagged with: awt
has answer: http://stackoverflow.com/a/26156369
favorite count: 0
tagged with: checkbox
has title: How can I limit the check box selected?
has answer: http://stackoverflow.com/a/26157150
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: limit
type: Question
has answer: http://stackoverflow.com/a/26163357
tagged with: java
answer count: 3
has body: We were told to have 10 checkboxes and the user is only allowed to check 1-3 check boxes. After the user clicks a button indicating that he/she has completed the requirements and after the computer randomly selects a checkbox. The remaining checkbox wil be delared as a winner. This is a gaming program by the way. I'm using Swing and AWT.
downvote count: 0
score: 1

http://stackoverflow.com/q/26162628
has body: I want to fill rectangle with color. I used these code but not working. PdfContentByte canvas = writer.getDirectContent(); canvas.rectangle(50, 600, 500, 40); canvas.setColorFill(BaseColor.GRAY); //canvas.setRGBColorFill(20, 50, 30); //canvas.setCMYKColorFill(0, 0, 0, 75); canvas.setColorStroke(BaseColor.LIGHT_GRAY); canvas.stroke(); Anyone has idea how to fill it ?
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/54853873
score: 1
has answer: http://stackoverflow.com/a/54853873
tagged with: java
accepted answer: http://stackoverflow.com/a/26162897
tagged with: itext
upvote count: 1
has comment: http://stackoverflow.com/comment/41016059
type: Question
has title: iText PDF Rectangle fill with color
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26162897

http://stackoverflow.com/q/26169616
answer count: 1
has title: How to access MouseEvent getX()/getY() from JPopupMenu?
has comment: http://stackoverflow.com/comment/41033213
accepted answer: http://stackoverflow.com/a/26170978
has comment: http://stackoverflow.com/comment/41037037
type: AnsweredQuestion
tagged with: jpopupmenu
tagged with: java
tagged with: swing
type: Question
tagged with: actionlistener
has body: I have a popupmenu like this final JPopupMenu contextMenu = new JPopupMenu(); final JMenuItem addTask = new JMenuItem("Add Task"); Then i add a MouseListener: component.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { contextMenu.show(e.getComponent(), e.getX(), e.getY()); } } } In my Actionlistener for the MenuItem i would like to access the x/y-data from my MouseEvent. Is this possible without saving them in an extra variable? i would like to get something like this: addTask.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { //System.out.println(Mouse.getX()+", "+Mouse.getY()); } });
has answer: http://stackoverflow.com/a/26170978
tagged with: mouseevent
score: 0

http://stackoverflow.com/a/26089730
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26086235
has comment: http://stackoverflow.com/comment/40891494
answers question: http://stackoverflow.com/q/26086235
type: Answer
has body: See my answer to your other question regarding overlaying WARs. As for the SVN bits, you should probably keep your produced artifacts in a Maven repo instead (setting the versions correctly), and keep only the sources in SVN. Still, what you explained is probably also doable using the SCM plugin. You can use the assembly plugin to create a zip, and Antrun plugin to move files around.
has comment: http://stackoverflow.com/comment/40891423
score: 0

http://stackoverflow.com/comment/40897714
type: AnswerComment
score: 0
type: Comment
has text: @TapaSave: I have no idea what "android version иудщц 16" is. You are correct that notification actions are relatively new. However, what you want is not supported, and so you will need to limit yourself to responding to a single action for the whole `Notification` (`setContentIntent()` on your `Builder`) for earlier Android versions.
comment on: http://stackoverflow.com/a/26087822

http://stackoverflow.com/a/26208410
type: Answer
score: 2
downvote count: 0
has body: The ??Something_en_US?? strings appear when using Thymeleaf message expressions (#{...}) and Message Resolver cannot resolve the message code found within that expression. So for example, #{foo} would require a line in the messages properties file with something like: foo = Some message or text to display here Message resolution varies depending on whether or not Thymeleaf is configured with or without the Spring dialect. References: Message Resolvers in http://www.thymeleaf.org/doc/usingthymeleaf.html#message-resolvers MessageSource throughout http://www.thymeleaf.org/doc/thymeleafspring.html#spring-mvc-configuration
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26072397
answers question: http://stackoverflow.com/q/26072397

http://stackoverflow.com/comment/40920291
score: 0
comment on: http://stackoverflow.com/q/26109076
type: QuestionComment
type: Comment
has text: Since you are using `SupportMapFragment` make sure support library is properly added.

http://stackoverflow.com/q/26159126
upvote count: 1
has body: I would like to detect an empty SWT CTabFolder after closing some tabs. My first approach was via an CTabFolder2Adapter listener and its close method. But this gets called before a tab is closed. So, it is not sufficient because tabs can be prevented from closing afterwards. Another approach would be to add a dispose listener to each CTabItem which triggers a check for an empty folder. Do you know of any cleaner way how to do this?
favorite count: 0
tagged with: tabs
answer count: 0
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/41012828
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41011366
has comment: http://stackoverflow.com/comment/41011493
downvote count: 0
has comment: http://stackoverflow.com/comment/41016863
has title: CTabFolder: detect empty folder

http://stackoverflow.com/comment/40943545
has text: I made a mistake, had members instead of member. Now it’s working perfectly.
type: AnswerComment
comment on: http://stackoverflow.com/a/26120480
score: 0
type: Comment

http://stackoverflow.com/comment/70414699
type: AnswerComment
has text: What do I do if I need it to be static?
comment on: http://stackoverflow.com/a/26046107
type: Comment
score: 0

http://stackoverflow.com/a/26128451
has comment: http://stackoverflow.com/comment/40952705
score: 1
has body: I read "uses [the] method" to mean "calls the method". That said, testing for sortedness before sorting seems somewhat pointless, so it might be worth double-checking with whoever gave you that assignment. One issue with your previous method is that it doesn't return anything. You'll need to do something about that to make it useful.
upvote count: 1
has comment: http://stackoverflow.com/comment/40952629
answers question: http://stackoverflow.com/q/26128370
has comment: http://stackoverflow.com/comment/40952764
type: Answer
has comment: http://stackoverflow.com/comment/40952585
downvote count: 0

http://stackoverflow.com/comment/41074314
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26194144
has text: I have rolled back your massive edits... as they make the current answers useless. If you still are having problems with your code, and the other advice listed like adding debugging steps, then ask a separate question that narrows down the new problems you have, and include the relevant output
score: 0

http://stackoverflow.com/q/26057177
upvote count: 2
tagged with: hashcode
accepted answer: http://stackoverflow.com/a/26059121
tagged with: java
has comment: http://stackoverflow.com/comment/40823066
tagged with: mysql
has comment: http://stackoverflow.com/comment/40821913
has comment: http://stackoverflow.com/comment/40823279
type: Question
has comment: http://stackoverflow.com/comment/40821954
has title: Duplicate records in SQL
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26059121
favorite count: 0
has comment: http://stackoverflow.com/comment/40822113
has body: Checking duplicate records by the calculating the hashcode of the table row: I am uploading excel file into mysql database through user interface before actually inserting the records i have to identify the duplicate records against the records already present in the main table (number of records can be 2500000) and i have to do it as fast as possible. My solution to this is I am adding one more field in the table say Hashcode and at the time of insertion of records i will calculate the hashcode for each row and at the time of checking the duplicate rows I will match only the hashcode field.If the hashcode exists in the main table then the record is duplicate else it is unique. Is there any other way to do this in a more faster manner as i am unaware of mysql database capabilities Thanks!
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/26073757
tagged with: constructor
accepted answer: http://stackoverflow.com/a/26073903
has title: Extending an Abstract Class
type: AnsweredQuestion
score: 2
has body: I am having trouble with abstract classes at the moment. I am told I need to: "Make an abstract class called "Sprite", which stores an (x,y) position, and a reference to an Image. The constructor of your Sprite class should take 2 int parameters (to specify the initial x and y position), and a string which is the name of the file to load the image from, and it should load the image (instead of the Turtle class loading the image). It will need a getter function for the image. Make an abstract method in your Sprite class named "public void update(Graphics g)". This function should have no body. The purpose of this is to ensure that any class which inherits from this class implements an update function." I think I understand how to make an abstract class, as I have done. I also think I did okay on the parameters in the constructor of the Sprite class. However, I've never loaded images in Java and I'm not sure how to extend/implement the abstract class functions. Is what I have done correct? And how exactly do I call that abstract class from the Turtle constructor so that the variables get set correctly? Modified, still having trouble : class Turtle extends Sprite { private int x; private int y; private static int dest_x; private static int dest_y; private String image; // private Sprite sprite; Turtle() { // super(); super(x, y, image); image = "turtle.png"; } Updated Sprite Class import java.awt.Graphics; import javax.imageio.ImageIO; import java.awt.Image; import java.io.File; import java.io.IOException; public abstract class Sprite { int x; int y; String imageName; Image image; Sprite(){} public Sprite(int x1, int y1, String im) { //Store variables imageName = im; x1 = x; y1 = y; try { image = ImageIO.read(new File(imageName)); } catch (IOException ioe) { System.out.println("Unable to load image file."); } } public abstract void update(Graphics g); public Image getImage() { return image; } } Here are some samples of the code: import java.awt.Graphics; import java.aw…
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40852725
tagged with: abstract-class
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26073903
favorite count: 0
has comment: http://stackoverflow.com/comment/40865433

http://stackoverflow.com/q/26160407
has comment: http://stackoverflow.com/comment/41020538
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41039863
type: Question
has body: I’m trying to convert a PDF into an image. ImageView iv = convertBufferedImage(page.convertToImage()); The convertBufferedImage method looks like: private ImageView convertBufferedImage(BufferedImage bf) { WritableImage wr = null; if (bf != null) { wr = new WritableImage(bf.getWidth(), bf.getHeight()); PixelWriter pw = wr.getPixelWriter(); for (int x = 0; x &lt; bf.getWidth(); x++) { for (int y = 0; y &lt; bf.getHeight(); y++) { pw.setArgb(x, y, bf.getRGB(x, y)); } } } return new ImageView(wr); For some PDF documents it works fine. With the following document I don’t get the hole page with its containing text. The image shows the PDF with missing text. If I try to get native text with: PDFTextStripper pdfStripper = new PDFTextStripper(); pdfStripper.setSortByPosition(true); pdfAsText = pdfStripper.getText(document); It works fine and I can print it to the console. I also get these information out of PDFBox: Okt 02, 2014 1:29:58 PM org.apache.pdfbox.util.PDFStreamEngine processOperator Information: unsupported/disabled operation: i I hope anybody can help.
has title: PDFBox Extract Image with Text
tagged with: pdfbox
score: 0
has comment: http://stackoverflow.com/comment/41011349
has comment: http://stackoverflow.com/comment/41011530
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24237313

http://stackoverflow.com/a/26055577
has body: the problem was that the compile 'org.jdom:jdom:1.1' line added the jdom 1.0 library as-well, manually adding both jars solved the issue
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26049034

http://stackoverflow.com/comment/41032924
has text: Thanks, I am very new to LWJGL so I don't know exactly how to use it.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26171583

proguard
tags question: http://stackoverflow.com/q/26175379
tag name: proguard
tags question: http://stackoverflow.com/q/26081934
tags question: http://stackoverflow.com/q/26106601
tags question: http://stackoverflow.com/q/26183842
tags question: http://stackoverflow.com/q/26036617
type: Tag
tags question: http://stackoverflow.com/q/26183906

http://stackoverflow.com/comment/40810348
score: 0
type: Comment
type: QuestionComment
has text: That's kind of what it seemed like looking through Guice/Spring, wasn't sure if there were additional shared components that really tied it all together and made it easy to just plugin. Thanks for the answer.
comment on: http://stackoverflow.com/q/26049975

http://stackoverflow.com/comment/40907618
score: 0
comment on: http://stackoverflow.com/q/26103580
has text: 1) You can, but you need to surround it with `{ }` which will represent initialization block 2) What is the point? What such variable would even represent? If it should be field available from outside of this class (you said it is `public`) then do you really want to create it only when method will be invoked? What should happen if someone would like to access `k` before invoking `method` (methods code wasn't executed so `k` wasn't created yet)? What should happen when someone would want to access `k` but `method` would be invoked more than once (which `k` should be then returned)?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26176548
tagged with: spring-data
type: AnsweredQuestion
has title: Spring Data mongodb date range query
has answer: http://stackoverflow.com/a/26189466
score: 1
tagged with: java
type: Question
tagged with: mongodb
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41041522
has comment: http://stackoverflow.com/comment/41041661
downvote count: 0
has body: I am using spring data with mongodb to create an application. I have this object: public class Room { private String name; private List&lt;Date&gt; occupied; } I want using mongodbTemplate preferably to get the list of room that are not occupied for a date range. So for example if i have a start date 10/10/2014 and end date 15/10/2014 I want to get the list of rooms that do not have in the list occupied the dates 10,11,12,13,14,15 for October 2014. Does anyone have any idea on this? Update: I have found a way to do this by using this query: query.addCriteria(Criteria.where("occupiedDates") .ne(from).andOperator( Criteria.where("occupiedDates").ne(to)) ); the problem is that I can not dynamically add the andOperator. I would prefer inside the criteria to add a list of dates if possible. An example document is (only one record exists in mongo this one) : Room(bedcount=1, bedtype1=1, bedtype2=0, bedtype3=0, bedtype4=0, filetype=null, noofrooms=0, occupancy=0, photo=null, rateid=1, roomname=null, roomno=888, status=null, roomTypeID=26060747427845848211948325568, occupiedDates=[Sun Aug 10 00:00:00 EEST 2014, Mon Aug 11 00:00:00 EEST 2014, Tue Aug 12 00:00:00 EEST 2014, Wed Aug 13 00:00:00 EEST 2014], attributes={}) And this is the code of how the wyeru is built: SimpleDateFormat dateFormat = new SimpleDateFormat("dd-M-yyyy hh:mm:ss"); Date to = null; Date from = null; try { to = dateFormat.parse("12-08-2014 00:00:00"); from = dateFormat.parse("10-08-2014 00:00:00"); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } DBObject c1 = new BasicDBObject("occupied", null); DBObject c2 = BasicDBObjectBuilder.start() .push("occupied").push("$not") .push("$elemMatch").add("$gte", from).add("$lte", to).get(); Criteria c = Criteria.where("$or").is(Arrays.asList(c1, c2)); Query query = new Query().addCriteria(c); List&lt;Room&gt; rooms = mongoTemplate.find(query, Room.class); This query is sent to mongodb { "$or" : [ { "occupied" : null } , { "occu…
favorite count: 0
possible better answer: http://stackoverflow.com/a/26189466
has answer: http://stackoverflow.com/a/26239371
accepted answer: http://stackoverflow.com/a/26239371

http://stackoverflow.com/comment/40865770
type: AnswerComment
has text: quick thinking: can't you just use only 1 loop and reuse it to validate both row and column? Note 2: won't work, this code is for javascript, not java.
type: Comment
comment on: http://stackoverflow.com/a/26080783
score: 0

http://stackoverflow.com/q/26056131
answer count: 2
has answer: http://stackoverflow.com/a/26056262
has comment: http://stackoverflow.com/comment/40820145
has answer: http://stackoverflow.com/a/26062281
has body: I am writing a small framework, that will get the classes loaded in the jvm and invoke its methods. Method arguments has been generated based on formal parameter names. I am trying to get its name by using reflection. import java.lang.reflect.*; public class Test { public static void main(String[] args) { Method[] methods = Test.class.getMethods(); for(Method method : methods) { Type[] params = method.getGenericParameterTypes(); for(Type param : params) { System.out.println(param); } } } } I know its possible in jdk8 http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Executable.html#getParameters-- How to get this in jdk6 or 7?. Because, most of our servers are running with jdk6.
has title: Get parameter names in a method using reflection
downvote count: 0
has comment: http://stackoverflow.com/comment/40820197
favorite count: 0
has comment: http://stackoverflow.com/comment/40820045
type: UnansweredQuestion
score: 3
tagged with: reflection
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40820081
type: Question

http://stackoverflow.com/comment/41005229
comment on: http://stackoverflow.com/q/26156760
score: 0
type: Comment
type: QuestionComment
has text: But it is true for following row: **List<Set<?>> list = new ArrayList<Set<?>>();** and this row compiles good

http://stackoverflow.com/comment/40967128
score: 1
comment on: http://stackoverflow.com/q/26136020
has text: There is a close vote giving reason `unclear what is asking`, I am not sure that voter at least read the question. Since there is nothing can't understand in this question who has vote permission to close the questions. That kind of careless behavior harm the reputation of the `stackOverFlow`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26078344
has body: i want to use google speech api, i've found this https://github.com/gillesdemey/google-speech-v2/ where everything is explained well, but and im trying to rewrite it into java. File filetosend = new File(path); byte[] bytearray = Files.readAllBytes(filetosend); URL url = new URL("https://www.google.com/speech-api/v2/recognize?output="+outputtype+"&amp;lang="+lang+"&amp;key="+key); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //method conn.setRequestMethod("POST"); //header conn.setRequestProperty("Content-Type", "audio/x-flac; rate=44100"); now im lost... i guess i need to add the bytearray into the request. in the example its line --data-binary @audio/good-morning-google.flac \ but httpurlconnection class has no method for attaching binary data.
has answer: http://stackoverflow.com/a/34778630
tagged with: binary-data
tagged with: httpurlconnection
favorite count: 0
tagged with: google-api
upvote count: 4
has title: Sending binary data with HttpURLConnection
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26078466
downvote count: 0
accepted answer: http://stackoverflow.com/a/26078466
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26078645
possible better answer: http://stackoverflow.com/a/34778630
score: 4
tagged with: post
answer count: 3

http://stackoverflow.com/q/26135658
favorite count: 0
has body: I have textfield that containing a value and that value should be Right alignment. When i run the application it display the text left alignment but i set the Right alignment. and problem with 3rd textfield. After clicking the update button it works fine. So may i know why it is behave different. Code: import java.io.File; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; public class TextFieldAlignment extends Application { TextField rText; File file; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { rText = new TextField("updated right1 updated right2 updated right3 updated right4"); rText.setAlignment(Pos.CENTER_RIGHT); Button btn = new Button("update"); btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent t) { rText.setText("updated right1 updated right2 updated right3 updated right4"); // applyWorkaround(); } }); final Label labelFile = new Label(); Button btn2 = new Button(); btn2.setText("Open FileChooser'"); btn2.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { FileChooser fileChooser = new FileChooser(); //Set extension filter FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("AVI files (*.exml)", "*.exml"); fileChooser.getExtensionFilters().add(extFilter); //Show open file dialog file = fileChooser.showOpenDialog(null); // rText.setText(file.getPath()); } }); VBox root = new VBox(); root.getChildren().addAll(rText, btn, btn2); stage.setScene(new Scene(root, 200, 300)); stage.show(); } }
has comment: http://stackoverflow.com/comment/41111150
type: UnansweredQuestion
tagged with: javafx
upvote count: 1
has title: TextField right alignment issue javafx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40975012
type: Question
tagged with: javafx-8
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41105783
has answer: http://stackoverflow.com/a/26138100

http://stackoverflow.com/a/26176286
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26176043
has body: In the if clause you're first checking whether vo.getName() contains your string (Gagal Berbayar) but then inside the block that executes if the if evaluates to true, you work with a different expression name instead of vo.getName(). There is no guarantee that name contains your string so this may fail. You can fix that like this. if (vo.getName().indexOf("(Gagal Berbayar)") &gt; 0) { name = vo.getName().substring(0, vo.getName().indexOf(" (Gagal Berbayar)")) + " (Gagal Berbayar)"; System.out.println("Hasilnya 1: "+name); } However what if someone just enters (Gagal Berbayar) without a space in front of it? Then your if statement evaluates to true but the indexOf inside the block returns -1 because it can't find (Gagal Berbayar) (with a space in front of it). So you should change that too: String GAGAL = " (Gagal Berbayar)"; if (vo.getName().indexOf(GAGAL) &gt; 0) { name = vo.getName().substring(0, vo.getName().indexOf(GAGAL)) + GAGAL; System.out.println("Hasilnya 1: "+name); } else { if (name.indexOf(GAGAL) &gt; 0 ) { name = name.substring(0, name.indexOf(GAGAL)); System.out.println("Hasilnya2 : "+name); } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40950438
comment on: http://stackoverflow.com/q/26127267
score: 0
type: Comment
type: QuestionComment
has text: Your ffprobe process may be waiting for standard input. The easiest way to fix this is by calling `redirectInput(ProcessBuilder.Redirect.INHERIT)` on your ProcessBuilder before starting the process.

http://stackoverflow.com/q/26120634
accepted answer: http://stackoverflow.com/a/26120774
has comment: http://stackoverflow.com/comment/40937644
type: Question
has comment: http://stackoverflow.com/comment/40937878
tagged with: multifile-uploader
downvote count: 0
tagged with: javascript
tagged with: jquery
tagged with: ajax
has title: how to send multipart/form-data request in ajax
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26120774
has body: The below function wont work. i want to upload multiple files &amp; request submit by ajax.here content type occur "text/plain;charset=UTF-8" i want to change content type="multipart/form-data" the following functions shown below.plz give any suggestions function importNow(serverURL, parameters) { document.body.style.cursor = "wait"; $.ajax({ url: serverURL, data: parameters, processData: false, contentType: false, type: "POST", cache: false, dataType: "text", success: function(data) { if ($.trim(data) === "Success") { updateStatusMessage("success", "Import scenario successfully"); } else { updateStatusMessage("failure", $.trim(data)); } document.body.style.cursor = "default"; }, async: false }); } function importScenario() { var serverURL = homeURL + "/runapp"; var parameters = "requestType=Import&amp;subRequestType=importScenario&amp;userName=" + userName ; refButton = '&lt;form id="importForm" class="userInputForm" enctype="multipart/form-data"&gt;' + '&lt;input id="file" name="file" type="file" /&gt;' + '&lt;/form&gt;'; document.getElementById("popupDiv").innerHTML = refButton; $("#popupDiv").dialog({ title: "Import Scenario", draggable: true, bgiframe: true, modal: true, width: 500, heigth: 100, show: {effect: 'blind', duration: 500}, hide: {effect: 'fade', duration: 1000}, zIndex: 1000, buttons: { 'Upload': function() { if ($("#importForm").valid()) { parameters; importNow(serverURL, parameters); $(this).dialog("close"); } }, 'Cancel': function() { $(this).dialog("close"); } } }); }
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/q/26174003
has comment: http://stackoverflow.com/comment/41037283
tagged with: servlets
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41038331
has body: Name: Password: Email Id: Language: Hindi English French after submitting the form the following error occur HTTP Status 405 - HTTP method GET is not supported by this URL here is my java class. i have defined only post method and called post method in html form public class RegisterServlet extends HttpServlet { private static final long serialVersionUID = 1L; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String n = request.getParameter("userName"); String p = request.getParameter("password"); String e = request.getParameter("email"); String c = request.getParameter("language"); try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); Connection con = DriverManager.getConnection("jdbc:ucanaccess://D:/eclipse/register.accdb","",""); PreparedStatement ps = con.prepareStatement("insert into USERDETAILS values(?,?,?,?)"); ps.setString(1, n); ps.setString(2, p); ps.setString(3, e); ps.setString(4, c); int i= ps.executeUpdate(); if (i > 0) { out.print("You are successfully registered..."); } } //... not relevant here } } web.xml SimpleServletProject RegisterServlet org.venkatesh.Servlet.RegisterServlet RegisterServlet /RegisterServletPath
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41037693
linked to: http://stackoverflow.com/q/22783879
has comment: http://stackoverflow.com/comment/41037233
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41036917
type: Question
has title: HTTP method GET is not supported by this URL
has comment: http://stackoverflow.com/comment/41036811
has answer: http://stackoverflow.com/a/26174314

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/26045333
tags question: http://stackoverflow.com/q/26037762

http://stackoverflow.com/comment/40896076
type: Comment
comment on: http://stackoverflow.com/q/26097424
type: QuestionComment
score: 1
has text: What do *you* think?

variables
tag name: variables
tags question: http://stackoverflow.com/q/26069465
tags question: http://stackoverflow.com/q/26150272
tags question: http://stackoverflow.com/q/26106078
tags question: http://stackoverflow.com/q/26081084
tags question: http://stackoverflow.com/q/26165328
tags question: http://stackoverflow.com/q/26051076
type: Tag
tags question: http://stackoverflow.com/q/26187972
tags question: http://stackoverflow.com/q/26132591
tags question: http://stackoverflow.com/q/26127598
tags question: http://stackoverflow.com/q/26166361
tags question: http://stackoverflow.com/q/26085322
tags question: http://stackoverflow.com/q/26172632
tags question: http://stackoverflow.com/q/26183252

http://stackoverflow.com/a/26147678
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/40988641
has comment: http://stackoverflow.com/comment/40988731
accepted answer of: http://stackoverflow.com/q/26147127
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26147127
upvote count: 3
has body: System.exit() everything will be cleaned up JFrame.dispose() vs System.exit() logoutItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { f.dispose(); // northInformation.removeAll(); // init(); LoginWindow login = new LoginWindow(); } });

http://stackoverflow.com/comment/40963242
comment on: http://stackoverflow.com/q/26134420
has text: you are also only reading the first 1024 chars. You should loop around until `read` == -1
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41037344
comment on: http://stackoverflow.com/a/26174322
score: 0
type: AnswerComment
type: Comment
has text: I think he would still get the message about either invalid syntax (SQLite checks for the proper constraint syntax), or from trying to create an already existing table.

http://stackoverflow.com/a/26094107
answers question: http://stackoverflow.com/q/26092098
score: 0
has body: You can even see your error in your question with the highlighting: public class while looping { } A class name may not contain any blank character. Also it is usual to start class names with a capital letter. Please rename your class to public class WhileLooping { } and also rename your .java file accordingly.
type: Answer

http://stackoverflow.com/q/26103613
has answer: http://stackoverflow.com/a/26103733
answer count: 2
upvote count: 1
tagged with: enums
has comment: http://stackoverflow.com/comment/40907478
has body: I have been given the task of printing a chessboard I have constructed to the console. The board must be bordered with 'a' to 'h' across the top and 1-8 vertically down the left. Each initial should line up with a letter and a number so for example, a black rook ("bR") should be placed at a 8 (and should be initialized as [0][0] in the array). Excluding the obvious problems with inefficiency (should use a char array for the top char labels) why does the nested for loop in the printBoard method fail to print the initials to the console in the correct places? public class Virtual_Chessboard { public enum Chessmen{ WHITE_KING, WHITE_QUEEN, WHITE_ROOK, WHITE_BISHOP, WHITE_KNIGHT, WHITE_PAWN, BLACK_KING, BLACK_QUEEN, BLACK_ROOK, BLACK_BISHOP, BLACK_KNIGHT, BLACK_PAWN, EMPTY } public static Chessmen[][] chessboard = new Chessmen[8][8]; public static void createBoard(){ int rows = 8; int columns = 8; for(int y=0;y&lt;rows;y++){ for(int x=0;x&lt;columns;x++){ if((y==0 &amp;&amp; x==0) || (x==7 &amp;&amp; y==0) ){ chessboard[x][y] = Chessmen.BLACK_ROOK; } else if((x==1 &amp;&amp; y==0)||(x==6 &amp;&amp; y==0)){ chessboard[x][y] = Chessmen.BLACK_KNIGHT; } else if((x==2 &amp;&amp; y==0)||(x==5 &amp;&amp; y==0)){ chessboard[x][y] = Chessmen.BLACK_BISHOP; } else if(x==3 &amp;&amp; y==0){ chessboard[x][y] = Chessmen.BLACK_KING; } else if(x==4 &amp;&amp; y==0){ chessboard[x][y] = Chessmen.BLACK_QUEEN; } else if((x==0 &amp;&amp; y==7)||(x==7 &amp;&amp; y==7)){ chessboard[x][y]= Chessmen.WHITE_ROOK; } else if((x==1 &amp;&amp; y==7)||(x==6 &amp;&amp; y==7)){ chessboard[x][y] = Chessmen.WHITE_KNIGHT; } else if((x==2 &amp;&amp; y==7)||(x==5 &amp;&amp; y==7)){ chessboard[x][y] = Chessmen.WHITE_BISHOP; } else if(x==3 &amp;&amp; y==7){ chessboard[x][y] = Chessmen.WHITE_KING; } else if(x==4 &amp;&amp; y==7){ chessboard[x][y] = Chessmen.WHITE_QUEEN; } else if(y==1){ chessboard[x][y] = Chessmen.BLACK_PAWN; } else if(y==6){ chessboard[x][y] = Chessmen.WHITE_PAWN; } else{ chessboard[x][y] = Ch…
has comment: http://stackoverflow.com/comment/40907301
tagged with: nested-loops
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26103653
has comment: http://stackoverflow.com/comment/40907352
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40907280
type: Question
linked to: http://stackoverflow.com/q/26101144
has title: Why is the switch statement failing to print the strings as desired? (Java)
has comment: http://stackoverflow.com/comment/40907525
tagged with: chess

http://stackoverflow.com/a/28376146
answers question: http://stackoverflow.com/q/26147471
has comment: http://stackoverflow.com/comment/45095129
has comment: http://stackoverflow.com/comment/45093431
has body: Two answers: If you want to set which internal frame overlaps the other, use the setComponentZOrder(Component comp, int index) function. e.g. JDesktopPane desktopPane = new JDesktopPane(); contentPane.add(desktopPane); JInternalFrame internalFrame = new JInternalFrame("New JInternalFrame"); desktopPane.add(internalFrame); desktopPane.setComponentZOrder(internalFrame, 0); Place the setComponentZOrder function in the JInternalFrame component listener. internalFrame.addComponentListener(new ComponentAdapter() { @Override public void componentMoved(ComponentEvent e) { desktopPane.setComponentZOrder(internalFrame, 0); } }); 2. If you want them to strictly not overlap, place them in separate jframes.
score: 0
type: Answer

http://stackoverflow.com/a/26078776
upvote count: 1
score: -1
has body: you need to parse it. i recommend GSON library to do so. but as i see your string is NOT JSON. json should be key : value and not key=value as your string
has comment: http://stackoverflow.com/comment/40861852
type: Answer
answers question: http://stackoverflow.com/q/26078735
downvote count: 2

http://stackoverflow.com/a/26133010
type: Answer
has comment: http://stackoverflow.com/comment/40974254
has comment: http://stackoverflow.com/comment/40972257
accepted answer of: http://stackoverflow.com/q/26132953
answers question: http://stackoverflow.com/q/26132953
score: 0
type: AcceptedAnswer
has body: Sencha is a mobile app development framework based on HTML5 and query. So the controls and views are basically designed for mobile screens. But it does not stop you to display the same content on normal desktop browsers. Although what looks great on mobile may not look that good on a browser and vice versa. Do I need to create separate applications for web app and mobile app? Not really, everything can be same, views middleware and even backend. If you can design a UI that may look both on mobile and desktop then you are good. For the web app I need to load a separate set of files whereas for the mobile app it is different. If the application is one then can I do this? As I said above, except UI nothing should be a concern. If you want different look and feel for web and mobile then just create different HTML files for the said purposes. But you can use the same backend logic. Also, all the java files which I am using for the getting the list data, should be in same code base or separate? Generally dynamic web applications fetches the data from backend servers using ajax/http service calls. You may manage the code in a single project or can divide it in logically smaller projects for better management. Maven should be a good choice to manage your projects.

http://stackoverflow.com/q/26110931
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26128920
tagged with: java
accepted answer: http://stackoverflow.com/a/26111054
has comment: http://stackoverflow.com/comment/40920707
has body: For my assignment I am using JOptionPane to ask the user to enter 3 sides of a triangle. The program is then suppose to use JOptionPane to tell them the type of triangle (equilateral, right, acute, obtuse, and isosceles but isosceles triangles are also either right, obtuse or acute) it is and to calculate the area. When it is equilateral it comes back telling me that it is equilateral but it also tells me it is isosceles 3 times. Even though I only have the isosceles JOptionPane with the other types of triangles. My other problem is that when it is right, acute, or obtuse it skips the JOptionPane telling me what type it is and just tells me it is isosceles. package assignment.ii; import javax.swing.JOptionPane; import java.lang.*; public class AssignmentII { public static void main(String[] args) { int a = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter a side of the triangle ")); int b = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter a side of the triangle ")); int c = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter a side of the triangle ")); double s = (.5*(a+b+c)); if(a==b){ if (b==c) JOptionPane.showMessageDialog(null, "The triangle is a equilateral triangle"); }else if (((a*a)+(b*b)) == (c*c)) { JOptionPane.showMessageDialog(null, "The triangle is a right triangle"); if (a==b) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); if (b==c) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); if (a==c) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); }else if (((a*a)+(b*b))&lt;(c*c)){ JOptionPane.showMessageDialog(null, "The triangle is an obtuse triangle"); if (a==b) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); if (b==c) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); if (a==c) JOptionPane.showMessageDialog(null, "The triangle is a Isosceles triangle"); }else if (((a*a)+(b*b)…
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26111054
downvote count: 0
has title: JOptionPane in if statements
favorite count: 0
has answer: http://stackoverflow.com/a/26128920
has comment: http://stackoverflow.com/comment/40952978
has comment: http://stackoverflow.com/comment/40920641
tagged with: joptionpane
score: 1
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/40977813
type: QuestionComment
comment on: http://stackoverflow.com/q/26128843
score: 0
has text: I can change the log level, but most of our uses are at the info level. I can see in the Console that there ARE comments from the classes that call myUtils.getLogger, but there isn't an appropriate file. The Root logger is within the element. Our configuration has other Loggers that I didn't think were related.
type: Comment

http://stackoverflow.com/comment/40986907
score: 0
type: Comment
has text: @Opal Thanks, it's good to know that someone else has seen something similar. Unfortunately, in my case copying the methods won't work because the database library is looking for SLF4J functionality that was added in a later version.
type: QuestionComment
comment on: http://stackoverflow.com/q/26147205

http://stackoverflow.com/comment/41005806
type: QuestionComment
comment on: http://stackoverflow.com/q/26156760
has text: @bjlee72 agree with you it is point of my question
score: 0
type: Comment

http://stackoverflow.com/a/26192409
answers question: http://stackoverflow.com/q/26192332
downvote count: 0
type: Answer
score: 1
has body: Java arrays, even arrays of primitives, are Objects. As a consequence, if you don't pass a copy (using your method, or one of the Arrays.copyOf() methods) then changes to the original reference will modify your Object's reference.
upvote count: 1

http://stackoverflow.com/a/51456246
upvote count: 3
type: Answer
downvote count: 0
has body: You should use DecimalFormat: val df: DecimalFormat = DecimalFormat("#,##0.000") df.decimalFormatSymbols = DecimalFormatSymbols(Locale.getDefault()) df.format(BigDecimal(123456,78)); //will output 123.456,78 - depending on Locale
score: 3
answers question: http://stackoverflow.com/q/26101918

http://stackoverflow.com/comment/40907623
type: Comment
has text: Thank you Piotr, But I tried this and also tried providing a complete path to properties file. It still gives the same error. More suggestions are welcome.
score: 0
comment on: http://stackoverflow.com/a/26077873
type: AnswerComment

http://stackoverflow.com/q/26127128
has comment: http://stackoverflow.com/comment/40949965
type: Question
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/26127184
has answer: http://stackoverflow.com/a/26127189
has answer: http://stackoverflow.com/a/26127184
has answer: http://stackoverflow.com/a/26127205
answer count: 4
has answer: http://stackoverflow.com/a/26127191
favorite count: 0
has title: Optimizing Java Array Copy
upvote count: 1
has body: So for my research group I am attempting to convert some old C++ code to Java and am running into an issue where in the C++ code it does the following: method(array+i, other parameters) Now I know that Java does not support pointer arithmetic, so I got around this by copying the subarray from array+i to the end of array into a new array, but this causes the code to run horribly slow (I.e. 100x slower than the C++ version). Is there a way to get around this? I saw someone mention a built-in method on here, but is that any faster?
accepted answer: http://stackoverflow.com/a/26127189
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40950243
has comment: http://stackoverflow.com/comment/40949911
score: 1
tagged with: java

http://stackoverflow.com/comment/50229101
score: 0
type: AnswerComment
type: Comment
has text: I would like to point out that as far as Unicode goes, this is actually incorrect. Case-insensitive matching in Unicode must be done by comparing the case-folded version of the strings (as opposed to uppercase, lowercase, and titlecase version).
comment on: http://stackoverflow.com/a/26217892

http://stackoverflow.com/comment/40985598
type: AnswerComment
comment on: http://stackoverflow.com/a/26146567
type: Comment
has text: isn' this what he's doing?
score: 0

abstract-class
tags question: http://stackoverflow.com/q/26151748
type: Tag
tags question: http://stackoverflow.com/q/26121170
tags question: http://stackoverflow.com/q/26125721
tag name: abstract-class
tags question: http://stackoverflow.com/q/26073757
tags question: http://stackoverflow.com/q/26121610
tags question: http://stackoverflow.com/q/26108259

http://stackoverflow.com/comment/41276810
has text: I'm closing this question because it was due to a limitation of the Axis 1 implemantation inside the application on which I work.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26061820

biginteger
tags question: http://stackoverflow.com/q/26186277
tag name: biginteger
type: Tag
tags question: http://stackoverflow.com/q/26104221
tags question: http://stackoverflow.com/q/26064370

http://stackoverflow.com/comment/41071724
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26175340
has text: Hugo G. what that i got when i try to deploy application org.xml.sax.SAXParseException; lineNumber: 71; columnNumber: 65; cvc-complex-type.3.2.2: Attribute 'ignoreDefaultModelOnRedirect' is not allowed to appear in element 'mvc:annotation-driven'.
score: 0

http://stackoverflow.com/comment/40979999
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26143604
has text: Java has a `Semaphore` class. You could attempt to do the same thing.
type: Comment

http://stackoverflow.com/q/26162200
accepted answer: http://stackoverflow.com/a/26162237
has body: package cheapoplanner; import java.util.Scanner; public class Travel extends CheapoPlanner { protected int passenger; protected double trainRate = 0.15; protected boolean hasCar; protected int carParkingFee = 30; protected int milesToAirport; protected double carRate = 0.30; protected double flightRate = 0.10; protected int milesFlying; protected double coachRate = 0.50; protected int milesToDestination; protected String startLetter; protected String endLetter; Scanner sc = new Scanner(System.in); protected void lengthChecker(String startLetter, String endLetter) { } protected boolean lettersDoMatch() { if (startLetter.toLowerCase() == endLetter.toLowerCase()) { return true; } else { return false; } } protected void greeting() { System.out.print("What is your first airport? (Choose A, B, C, D, or E): "); startLetter = sc.nextLine(); System.out.print("What is your destination? (Choose A, B, C, D, or E): "); endLetter = sc.nextLine(); if (lettersDoMatch() == true) { System.out.println("letters can't match"); greeting(); } System.out.println("code past last pt."); } } In my main method, I called the greeting() method. The goal is to validate that the airport and destination are not the same letter. This is done in the lettersDoMatch() method. Whatever value gets returned, in greeting() I do a logic compare. If it's true (which it shouldn't be), I print out a warning and it should go back to the beginning of the greeting function. Otherwise, I'm expecting that that block of code gets skipped. I'm confused though, because when I run my code, when I type in two letters that are the same, it doesn't go to the beginning of greeting() method again. What happens is that I go straight to "code past last pt". Is my issue something in the greeting() method? Or something in the lettersDoMatch() method? Or a combo of things?
has comment: http://stackoverflow.com/comment/41014600
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: Java not handling logic like I'm expecting
has answer: http://stackoverflow.com/a/26162237
score: -1
linked to: http://stackoverflow.com/q/513832
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41014581
tagged with: logic

http://stackoverflow.com/comment/40865646
has text: Scroll up to the top of the `String` javadoc and you'll see: "A String represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character class for more information). Index values refer to char code units, so a supplementary character uses two positions in a String."
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26080643
score: 0

http://stackoverflow.com/q/26169424
tagged with: maven
upvote count: 1
has title: Can run a Maven project within IntelliJ but not from Terminal
type: AnsweredQuestion
tagged with: java
has body: I have created a console application in IntelliJ that utilizes Maven. From within IntelliJ I can compile and run the app with no issues ... From terminal however i execute the following commands (in the same dir with pom.xml) mvn Install -U java -classpath target/myApp-2.0-SNAPSHOT.jar MainClass The install command seems to build the jar file without any issue. The second command gives me the following error Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonParseException In my pom.xml my dependencies are as follows joda-time joda-time 2.3 org.codehaus.jackson jackson-mapper-asl 1.5.0 It seems to me that its not pulling in the Jackson Dependencies but im not sure what im missing here.
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26169466
answer count: 2
tagged with: intellij-idea
score: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26169466
has answer: http://stackoverflow.com/a/26169691
accepted answer: http://stackoverflow.com/a/26169691

http://stackoverflow.com/comment/41053174
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26182808
has text: Technically correct - I'd like to recommend using a task/dependency/build management system such as Gradle - this will make things much easier in the future.
score: 0

http://stackoverflow.com/comment/41037408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26174317
score: 0
has text: @jasonfungsing You're in good company with M. Deinum ;-)

http://stackoverflow.com/q/26163466
upvote count: 4
tagged with: arrays
downvote count: 0
favorite count: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/26163627
has answer: http://stackoverflow.com/a/26163691
answer count: 4
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26163623
has answer: http://stackoverflow.com/a/26163599
type: Question
has body: With the following Java examples: int[] array1 = new int[]; // Incorrect, since no size is given int[] array2 = new int[2]; // Correct int[][][] array3 = new int[][][]; // Incorrect, since no size is given int[][][] array4 = new int[2][2][2]; // Correct int[][][] array5 = new int[2][][]; // Correct (why is this correct?) So, my question is, why is assigning only the first size of a multidimensional array sufficient enough? I thought you always had to assign a size, even to each individual array-part of a multidimensional array, but today I found out that array5 is also a correct way for Java. Now I'm just wondering why. Can someone give some examples of why this works for multidimensional arrays and/or the reasoning behind it? Also, I guess that the following applies as well then: int[][][] array6 = new int[][2][]; // Incorrect int[][][] array7 = new int[][][2]; // Incorrect int[][][] array8 = new int[][2][2]; // Incorrect int[][][] array9 = new int[2][2][]; // Correct int[][][] array10 = new int[2][][2]; // Incorrect?? (Or is this correct?) I'm a bit puzzled now and would like some clarification if someone knows it. EDIT / SEMI-SOLUTION: Ok, I found out why the first part works: int[][] array = new int[2][]; array[0] = new int[5]; array[1] = new int[3]; // So now I have an array with the following options within the array-index bounds: // [0][0]; [0][1]; [0][2]; [0][3]; [0][4]; [1][0]; [1][1]; [1][2] // It basically means I can have different sized inner arrays The only thing left to answer is if: int[][][] array10 = new int[2][][2]; // Incorrect?? (Or is this correct?) is valid or not.
tagged with: instantiation
accepted answer: http://stackoverflow.com/a/26163627
has title: Java multidimensional array - Why is only defining the first size enough?
tagged with: java
possible better answer: http://stackoverflow.com/a/26163599

http://stackoverflow.com/q/26052994
tagged with: equation
tagged with: output
type: Question
has comment: http://stackoverflow.com/comment/40848269
tagged with: java
has title: Another way to output this?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26053604
has body: I was wondering if there was a way to get a certain output. For my code, I am using the Newton Raphson method to solve the three equations. I have to display the root of it at the certain iteration. As you can you see from the code, I have the output as "The root is ROOT after COUNTER iterations." Right now, I type in the root and the counter into the code AFTER I get the answer from running the program. Is there a way I can have an output like " "The root is " + root " after " + counter + " iterations." "? In other words, how can I have the program find the root and print it, instead of me having to type it in manually along with the counter? public static void main(String[] args) { //x^3 + x^2 + 1 //2x^3 - 2x^2 - 2 //3x^3 + 3x^2 + 3 newrap1(); newrap2(); newrap3(); } public static double func1(double x) { double f1; f1 = Math.pow(x, 3) + Math.pow(x, 2) + 1; return f1; } public static double func2(double x) { double f2; f2 = 2*Math.pow(x, 3) - 2*Math.pow(x, 2) - 2; return f2; } public static double func3(double x) { double f3; f3 = 3*Math.pow(x, 3) + 3*Math.pow(x, 2) + 3; return f3; } public static double der1(double x) { double d1; d1 = 3*Math.pow(x, 2) + 2*x; return d1; } public static double der2(double x) { double d2; d2 = 6*Math.pow(x, 2) - 4*x; return d2; } public static double der3(double x) { double d3; d3 = 9*Math.pow(x, 2) + 6*x; return d3; } public static void newrap1() { double x = 100; for (int i = 0; i &lt; 30; i++) { double diff; diff = func1(x)/der1(x); if (diff == 0) return; x -= diff; System.out.println(Math.floor(x * 1e6) / 1e6); } System.out.println("The root is -1.465572 after 20 iterations."); System.out.println(); } public static void newrap2() { double x = 100; for (int i = 0; i &lt; 30; i++) { double diff; diff = func2(x)/der2(x); if (diff == 0) return; x -= diff; System.out.println(Math.floor(x * 1e6) / 1e6); } System.out.println("The root is 1.465571 after 15 iterations."); System.out.println(); } public static void newrap3() { double x =…
has comment: http://stackoverflow.com/comment/40814937
has comment: http://stackoverflow.com/comment/40814733
type: AnsweredQuestion
tagged with: root
has comment: http://stackoverflow.com/comment/40848422
accepted answer: http://stackoverflow.com/a/26053604

http://stackoverflow.com/q/26051595
answer count: 0
has comment: http://stackoverflow.com/comment/40812232
score: 0
has title: Loop in a dynamic shuffling list
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40832400
tagged with: graph-algorithm
tagged with: sorting
has body: Here is the case: Given two lists [A,B,C,D] and [Ob,Od,Oa,Oc] (Object O has a parameter A,B,C or D) The first listed was sorted according to a specific condition (if A was a product, it's the cheapest and D the most expensive). We want to do a 2-for loops this way: List products = [A,B,C,D]; List shops = [Ob,Od,Oa,Oc]; int k=0; for(Object i : products) for(Object o : shops) // 1st loop i is A, and o is Ob consume(A,Ob) // We are reducing number of A depending on Ob requirement k++; // 1st loop k = 0; For Ob, we know that a B is better than an A. So, being in the first loop, I would like to switch between A and B, so my list becomes [B,A,C,D]. List products = [B,A,C,D]; // during the first loop, this list was shuffled. List shops = [Ob,Od,Oa,Oc]; int k=0; for(Object i : products) for(Object o : shops) // 2nd loop i is B, and o is Od --&gt; B because we shifted consume(A,Ob) // We are reducing number of A depending on Ob requirement k++; // 2nd loop k = 1; At the last loop, we should have [B,D,A,C]. Of course, doing this in a parallelised system with one thread per combination of list [A,B,C,D], and then returning the optimal solution is doable, but difficult. Is there anyway in Java to shuffle the list on which we are iterating?
type: UnansweredQuestion

http://stackoverflow.com/comment/41405596
score: 0
type: Comment
has text: Implement viewpager [onPageChangeListener](http://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener.html)
type: AnswerComment
comment on: http://stackoverflow.com/a/26182612

http://stackoverflow.com/a/26142554
answers question: http://stackoverflow.com/q/26141855
score: 0
has body: For second part (select), use following code: String sql = "SELECT name,contact number from contactlist WHERE name like ? OR contact ?"; PreparedStatement stmt = conn.prepareStatement(sql); stmt.setString(1, "%&lt;anything&gt;%"); stmt.setString(2, "contact");
type: Answer

http://stackoverflow.com/q/26079112
score: 0
has answer: http://stackoverflow.com/a/26079406
tagged with: profiles
tagged with: automated-tests
answer count: 1
has comment: http://stackoverflow.com/comment/40863823
has comment: http://stackoverflow.com/comment/40863839
tagged with: inheritance
has title: Maven profiles are not inherited in child modules
accepted answer: http://stackoverflow.com/a/26079406
has comment: http://stackoverflow.com/comment/40863446
has comment: http://stackoverflow.com/comment/40863798
has body: I'm trying to separate different kinds of tests (unit, integration, acceptance) by using maven profiles. This is the part of the main pom file: <build.profile.id>dev</build.profile.id> <skip.unit.tests>false</skip.unit.tests> <skip.integration.tests>true</skip.integration.tests> <skip.acceptance.tests>true</skip.acceptance.tests> dev integration-test <build.profile.id>integration-test</build.profile.id> <skip.unit.tests>true</skip.unit.tests> <skip.integration.tests>false</skip.integration.tests> <skip.acceptance.tests>true</skip.acceptance.tests> acceptance-test <build.profile.id>acceptance-test</build.profile.id> <skip.unit.tests>true</skip.unit.tests> <skip.integration.tests>true</skip.integration.tests> <skip.acceptance.tests>false</skip.acceptance.tests> org.apache.maven.plugins maven-surefire-plugin 2.17 ${skip.unit.tests} **/*UnitTests.java org.apache.maven.plugins maven-failsafe-plugin 2.17 integration-tests integration-test verify ${skip.integration.tests} **/*IntegrationTests.java acceptance-tests integration-test verify ${skip.acceptance.tests} **/*AcceptanceTests.java </plugins> As you can see I'm using the profile information to run certain types of tests based on the profile that is used. Default profile is dev and it will only run unit tests. They can be executed like this: mvn clean test For integration and acceptance tests I use failsafe plugin: Example of running integartion tests would be: mvn clean verify -P integration-test This works fine when I run it from the main pom module, but it doesn't work when running it from the child module. Tests are just ignored. Looking at the effective pom for child module I don't see the profiles. Am I doing something wrong or is this is expected behavior from maven? If profile inheritance (needs to cascade to deepest modules in the hierarchy) can't be achieved this way how can it be done? Update: This is the project hierarchy project directory --main module --commons module --administration ----domain ----data …
has comment: http://stackoverflow.com/comment/40863674
has comment: http://stackoverflow.com/comment/40863790
type: AnsweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40863395
type: Question
has comment: http://stackoverflow.com/comment/40863133
tagged with: java
linked to: http://stackoverflow.com/q/3695394
has comment: http://stackoverflow.com/comment/40863083
has comment: http://stackoverflow.com/comment/40863200

http://stackoverflow.com/q/26156297
tagged with: sorting
has body: I want to sort my object by many criteria but in different event/method. example, there 2 options: 1 . Sort by name 2. Sort by Hit Point public class MonsterArray implements Comparable&lt;Monster&gt;{ ...... public int compareTo(Monster m) { //what must i code here } } can i use the compare to? or must using another sort. please help me :)
tagged with: comparable
has title: Sorting multiplecriteria using Comparator<> java
score: 0
has comment: http://stackoverflow.com/comment/41003646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41003648
has comment: http://stackoverflow.com/comment/41004586
linked to: http://stackoverflow.com/q/1421322
answer count: 0
tagged with: java
type: Question
tagged with: arrays

http://stackoverflow.com/q/26107696
has comment: http://stackoverflow.com/comment/40915064
tagged with: java
has title: Android/Java: detect if device has a BACK Camera
possible better answer: http://stackoverflow.com/a/26107759
type: Question
score: 9
upvote count: 9
tagged with: camera
has comment: http://stackoverflow.com/comment/40915353
has answer: http://stackoverflow.com/a/40020052
accepted answer: http://stackoverflow.com/a/26107947
has answer: http://stackoverflow.com/a/57974578
downvote count: 0
has answer: http://stackoverflow.com/a/26107759
has answer: http://stackoverflow.com/a/26107947
favorite count: 0
has body: How do I detect if the device has a camera on the BACK? This is my code to detect if the device has a Flashlight: if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH) || (_camera.getParameters().getSupportedFlashModes() != null)) hasFlashlight = true; else hasFlashlight = false; But it is TRUE even if the device only has a Front Camera without the flashlight.
has comment: http://stackoverflow.com/comment/40915486
tagged with: android
linked to: http://stackoverflow.com/q/14399333
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/40893921
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26095173
has text: @user2315641 You can use layout inflaters, as I explained in my answer below. That way you would be able use xml-based layouts.
type: AnswerComment

runtime-error
tags question: http://stackoverflow.com/q/26170234
tags question: http://stackoverflow.com/q/26181815
tag name: runtime-error
type: Tag
tags question: http://stackoverflow.com/q/26145841

http://stackoverflow.com/a/26089703
type: Answer
score: 3
downvote count: 0
has body: You don't have a recursion termination condition, in this case i'd assume you want to check if the start and end counters for the array are the same. Check the code below. class StackOv { public static void main(String[] args) { int arraySize = 10; int[] numsToSum = new int[arraySize]; for (int i = 0; i &lt; arraySize; i++) { numsToSum[i] = i * 3; System.out.println(numsToSum[i]); } int sum3 = sumArray3(numsToSum, 0, arraySize - 1); System.out.println(sum3); } public static int sumArray3(int [] array, int start, int end) { int results = 0; if(start == end) return array[start]; int mid = (start + end)/2; if(array.length &gt; 0) { results += sumArray3(array, start, mid) + sumArray3(array, mid +1, end); } return results; } }
accepted answer of: http://stackoverflow.com/q/26089597
upvote count: 3
answers question: http://stackoverflow.com/q/26089597
type: AcceptedAnswer

http://stackoverflow.com/comment/112757619
has text: Note: Starters should ideally be a parent POM, not a dependency
comment on: http://stackoverflow.com/a/63572052
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26150304
type: Question
has comment: http://stackoverflow.com/comment/40997014
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41006773
upvote count: 1
has body: i get some exceptions when i start the tomcat server. i am getting this error when starting my tomcat server with my application. I don't really understand it but if i "clean" in eclipse a few times or if i stop start the tomcat server a few times it somehow works, but then it happens over again if i stop. a copy of the console: Okt 01, 2014 8:55:39 PM org.apache.catalina.core.AprLifecycleListener init INFORMATION: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/server:/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386:/usr/lib/jvm/jdk1.8.0_20/jre/../lib/i386:/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/client:/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib Okt 01, 2014 8:55:40 PM org.apache.coyote.AbstractProtocol init INFORMATION: Initializing ProtocolHandler ["http-bio-8080"] Okt 01, 2014 8:55:40 PM org.apache.coyote.AbstractProtocol init INFORMATION: Initializing ProtocolHandler ["ajp-bio-8009"] Okt 01, 2014 8:55:40 PM org.apache.catalina.startup.Catalina load INFORMATION: Initialization processed in 1384 ms Okt 01, 2014 8:55:40 PM org.apache.catalina.core.StandardService startInternal INFORMATION: Starting service Catalina Okt 01, 2014 8:55:40 PM org.apache.catalina.core.StandardEngine startInternal INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.55 Okt 01, 2014 8:55:40 PM org.apache.catalina.core.ContainerBase startInternal SCHWERWIEGEND: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jee]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) this a copy of my web.xml. i added some servlet and context-parameters into the web.xml: <?xml version="1.0" encoding="UTF-8"?> WebApplication Example index.jsp contextConfigLocation /WEBF-INF/appli…
has comment: http://stackoverflow.com/comment/58738394
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/40997025
tagged with: catalina
downvote count: 0
answer count: 0
score: 1
tagged with: java
tagged with: tomcat7
has title: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]

http://stackoverflow.com/comment/40845600
type: Comment
has text: Unless you use a predefined arch-type, you'll have to do it by hand. IntelliJ is really good at this, because it has code hinting when you edit the POM file to show you jars it knows about so it can save you time searching the internet. Eclipse only supports arch-types. I recommend getting IntelliJ, the community edition supports this for free. http://www.jetbrains.com/idea/download/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26069633

http://stackoverflow.com/comment/40867257
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26051709
has text: `String accountNum = Reader.nextLine();` is getting user input.. i edited my response above check it out.

http://stackoverflow.com/q/26122281
has title: How to stop auto-refreshing of SBT modules upon opening project in IDEA?
type: Question
score: 3
tagged with: sbt
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/26131346
answer count: 1
downvote count: 0
favorite count: 0
has body: We have several Play 2 applications and modules and I'm having trouble integrating IntelliJ IDEA 13 into my development process. I have an empty project based on the common parent of the apps and I have imported each app as a module using the import existing SBT project option. My problem is that every time I launch the project, IntelliJ causes SBT to completely rebuild all 9 modules at the same time. Since they all depend on one sbt.lock file being available, it's usually the case that 8 of the apps are waiting at any one time, and it takes ~15 minutes for the refreshing to finish. As it spawns an sbt process for each module, my VM's 5GB of RAM and 5GB of swap space are entirely filled, causing further slowdown. This is completely unacceptable. I'm going back to Eclipse if I can't solve this problem, event if IntelliJ IDEA is better suited to my development otherwise. How can I disable these automatic rebuilds at startup, or at least serialize them?
type: AnsweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/26131346
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/40917653
type: Comment
has text: For sure, it's [toString()](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#toString()) - if you move it into your answer make sure you @owlstead me (I'll remove the downvote and turn it into an upvote, the rest of the answer seems sound)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26068509

http://stackoverflow.com/q/26044881
tagged with: gson
tagged with: date
upvote count: 47
has answer: http://stackoverflow.com/a/73763988
downvote count: 0
has answer: http://stackoverflow.com/a/33329220
favorite count: 0
score: 47
accepted answer: http://stackoverflow.com/a/26046107
answer count: 5
type: AnsweredQuestion
tagged with: utc
has answer: http://stackoverflow.com/a/38896001
possible better answer: http://stackoverflow.com/a/26045021
has body: I can't seem to get gson to convert a Date to UTC time in java.... Here is my code... Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create(); //This is the format I want, which according to the ISO8601 standard - Z specifies UTC - 'Zulu' time Date now=new Date(); System.out.println(now); System.out.println(now.getTimezoneOffset()); System.out.println(gson.toJson(now)); Here is my Output Thu Sep 25 18:21:42 BST 2014 // Time now - in British Summer Time -60 // As expected : offset is 1hour from UTC "2014-09-25T18:21:42.026Z" // Uhhhh this is not UTC ??? Its still BST !! The gson result I want and what I was expecting "2014-09-25T17:21:42.026Z" I can clearly just subtract 1hr before the call toJson but this seems to be a hack. How can I configure gson to always convert to UTC ?
type: Question
has answer: http://stackoverflow.com/a/26045021
has answer: http://stackoverflow.com/a/26046107
has title: Java Date to UTC using gson
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/40873612
comment on: http://stackoverflow.com/a/26084986
has text: @mafso : `And the question clearly asks for the complexity depending on n.`. I don't think so. I think the OP wants to know how much he can reduce the complexity of his algorithm by storing the results of the first execution and then only performing lookups. As I understand it, what's important here is the complexity of the algorithm, but we have no information at all about it. It would be great the OP provides more information as requested...
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/26191497
upvote count: 1
has comment: http://stackoverflow.com/comment/41076244
has comment: http://stackoverflow.com/comment/41072480
has body: Your code seems to be correct. The problem is about managing you package imports / exports. This typically happens when there are two instances of the class MyService.class. Take a look into the bundle offering the service as well as the one using the service. If you have no separate API bundle then the bundle offering the service should contain the MyService.class and export the package it is in. The bundle using the service should NOT contain the MyService.class and import the package it is in. Also make sure that the packages of MyService.class is in a separate package from the impl and the using class - I think it should be the case already as your package name sounds like an API package name.
has comment: http://stackoverflow.com/comment/41069957
score: 1
accepted answer of: http://stackoverflow.com/q/26190987
has comment: http://stackoverflow.com/comment/41069419
answers question: http://stackoverflow.com/q/26190987
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41006522
type: Comment
has text: If you just use plain JDBC in your dao, then there is no second transaction. Both methods `updateRecord()` and `saveRecord()` are called in the `single` transaction and that transaction should be rolledback on your exception.
comment on: http://stackoverflow.com/q/26151636
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41058627
has text: I totally disagree. AtomicInteger is not an Integer at all. It extends number only to allow it to be used in numeric operations. You can not suggest anyone to use AtomicInteger in place of Integer (consider performance of AtomicInteger for example).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26185595

http://stackoverflow.com/comment/41041006
comment on: http://stackoverflow.com/q/26176373
score: 1
has text: The asnwer is: No. You have to serialize the class if you want your field values to be preserved.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/50865230
comment on: http://stackoverflow.com/a/26100818
score: 0
type: AnswerComment
has text: This is incorrect. The array reference is constant, the strings are immutable .... but the array can be trivially changed. It isn't constant ... according to the normal meaning of the word.
type: Comment

http://stackoverflow.com/q/26177506
type: AnsweredQuestion
upvote count: 9
has answer: http://stackoverflow.com/a/26177581
tagged with: java
score: 9
type: Question
linked to: http://stackoverflow.com/q/8941678
has answer: http://stackoverflow.com/a/26177744
downvote count: 0
has comment: http://stackoverflow.com/comment/41063732
has body: Suppose an upper triangular matrix of integers is given. What's the best way of storing this in Java? The naive 2d int array is obviously not efficient. The solution I came up with was moved to the answers section.
tagged with: sparse-matrix
has comment: http://stackoverflow.com/comment/41063454
favorite count: 0
has comment: http://stackoverflow.com/comment/41064886
has answer: http://stackoverflow.com/a/26188923
has title: What is the best data structure for representing an upper triangular matrix in Java?
possible better answer: http://stackoverflow.com/a/26177744
accepted answer: http://stackoverflow.com/a/26188923
answer count: 4
has answer: http://stackoverflow.com/a/26177549

http://stackoverflow.com/comment/40886574
comment on: http://stackoverflow.com/q/26091915
type: Comment
type: QuestionComment
has text: I've given the answer below.
score: 0

http://stackoverflow.com/comment/41062998
has text: @nem Good catch, I'd just use `System.out.println(Arrays.toString(names));`
type: QuestionComment
comment on: http://stackoverflow.com/q/26187855
score: 0
type: Comment

http://stackoverflow.com/comment/42364720
has text: I would love to have a followup on this. We're hitting the exact same problem: our code suddenly stopped working, and we get the exact same exception and callstack. I don't know what changed since it last worked. Maybe another package has been updated? Did you end up finding what the cause of the problem was?
comment on: http://stackoverflow.com/q/26187341
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40840584
has text: when you call `read = recorder.read(data, 0, bufferSize);`, if you look at the doc, `read` is number of actually read bytes. The rest are not overwritten and can be 0s, or previously inserted data.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26066516
type: Comment

http://stackoverflow.com/q/26110164
tagged with: oracle-database
answer count: 1
score: 0
tagged with: java
has title: Get parent-child relationship between tables through application
has body: I have a java application which uses Carbanadoto interact with Oracle Database. I want to know the dependency graph (where dependency is a foreign-key constraint) of all the tables to do further processing through the application. As an example: Table A defines dependency over Table B and Table C (means Table A has foreign key constraint on Table B and Table C). Table B defines dependency over Table C and Table D. I want something like this (it will be a 2-D graph in real scenario). Table A=&gt;Table B=&gt;Table C=&gt;Table D This given an idea that rows in Table D are to be deleted first before deleting corresponding rows in Table A, B and C. All the entity classes implement a common interface (Storable) and dependencies are annotated with @Join. Loading all the classes and using extensive reflection seems like one way to do this. &gt;&gt;Load all classes. &gt;&gt;Create 2D matrix (adjacency matrix) and populate it by going through each class and extracting/processing @Join annotation. &gt;&gt;Put 0/1 at suitable position. &gt;&gt;Final matrix will be showing the dependencies. &gt;&gt;Perform any topological operation. Is there any better way? PS: Additional Info: Just to give you an idea, further processing will create an snapshot of data (in XML/JSON) format as per the dependency. Dependency graph is required to delete the records in proper order. Thanks!
tagged with: database
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26119109
type: Question

http://stackoverflow.com/q/26119121
tagged with: mongodb
score: 0
has answer: http://stackoverflow.com/a/26123221
answer count: 1
type: UnansweredQuestion
tagged with: crud
has body: I have to write DAO layer for Mongo DB. I found that this isn't so easy. My implementation is straightforward: delete document with the same key => and save updated it again How possible to do it for List of elements? For example JSON representation is next: "airItinerary" : { "originDestinationOptions" : { "originDestinationOption" : [ { "flightSegment" : [ { "departureAirport" : { "locationCode" : "DUB", "codeContext" : "IATA" }, "arrivalAirport" : { "locationCode" : "CDG", "codeContext" : "IATA" }, Here is my code: @Override public void update(MODEL model) { try { Field keyField1 = getKeyField(model); String fieldValue = getKeyFieldValue(keyField1, model); BasicDBObject query = createQuery(keyField1.getName(), fieldValue); DBCursor cursor = dbCollection.find(query); if (cursor.hasNext()) { DBObject dbObject = getDbObject(model); dbCollection.update(query, dbObject); } else { throw new RuntimeException(String.format("Data status %s isn't presented at %s with value %s", keyField1.getName(), dbCollection.getFullName(), fieldValue)); } } catch (IOException e) { Log.getInstance().log(e.getCause()); } } private Field getKeyField(MODEL model) { Field keyField = null; for (Field field : model.getClass().getDeclaredFields()) { if (field.isAnnotationPresent(KeyField.class)) { keyField = field; } } if (keyField == null) { throw new RuntimeException(String.format("Couldn't find KeyField annotation at class '%s'", model.getClass().getName())); } return keyField; } private String getKeyFieldValue(Field keyField, Object model) { String result = null; try { if(keyField.isAnnotationPresent(KeyField.class)) { keyField.setAccessible(true); result = keyField.get(model).toString(); } if(result == null || result.equals("")) { throw new NullPointerException(); } } catch(NullPointerException e) { throw new RuntimeException("KeyField property is empty"); }catch (Exception e) { throw new RuntimeException(String.format("Couldn't find KeyField annotation at class '%s'", model.getClass().get…
tagged with: java
type: Question
has title: How to update value at Mongo DB?

http://stackoverflow.com/a/26128025
has comment: http://stackoverflow.com/comment/40951577
has comment: http://stackoverflow.com/comment/40951686
type: Answer
has comment: http://stackoverflow.com/comment/40951752
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40951633
has comment: http://stackoverflow.com/comment/40951624
has body: One possible alternative is to keep a type in all ArtObjects // Pseudocode class ArtObject { Enum artType = { Painting, Engraving } } class Painting implements ArtObject { Painting() { artType = Painting } } public void printAllPaintingsInfo() { for(int i = 0; i &lt; artObjects.size(); i++) { if(artObjects.artType == Painting) { System.out.println(artObjects.get(i)); } } } Another might be to keep a separate Collection for all Painting objects in addition to the artObjects collection.
answers question: http://stackoverflow.com/q/26127934
has comment: http://stackoverflow.com/comment/40951656
downvote count: 0

http://stackoverflow.com/q/26152547
upvote count: 1
has comment: http://stackoverflow.com/comment/40997191
has comment: http://stackoverflow.com/comment/40996861
has answer: http://stackoverflow.com/a/26167693
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I am trying to create an app that displays a circle everytime I click a button. I have the layout looking great but when i click the button(circle) to display a circle on the screen nothing happens. I'm not confident that my draw circle class is being called correctly in my main activity. Here is my code below. package com.example.randomcircles; import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; public class DisplayRandomCircles extends Activity { DrawCircle c; Canvas d; @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_display_random_circles); Button btn1 = (Button) findViewById(R.id.btn1); Button btn2 = (Button) findViewById(R.id.btn2); c = new DrawCircle(getApplicationContext()); d = new Canvas(); FrameLayout f1 = (FrameLayout) findViewById(R.id.frame); } @SuppressLint("WrongCall") public void doit(View v) { switch (v.getId()) { case (R.id.btn1): c.onDraw(d); break; case (R.id.btn2): break; } } } Here is my DrawCircle class package com.example.randomcircles; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.view.View; public class DrawCircle extends View { public DrawCircle(Context con) { super(con); } @Override protected void onDraw(Canvas c) { super.onDraw(c); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setAntiAlias(true); p.setStyle(Paint.Style.STROKE); p.setStrokeWidth(100); p.setColor(Color.RED); p.setStyle(Paint.Style.FILL); c.drawCircle(75, 75, 100, p); } } And my layout xml
downvote count: 0
has comment: http://stackoverflow.com/comment/40996961
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40998809
score: 1
tagged with: java
type: Question
tagged with: canvas
answer count: 1
has title: Drawing Circles using Canvas and Framelayout android

http://stackoverflow.com/comment/40816160
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26040340
has text: You can try this for start: http://stackoverflow.com/questions/283679/how-can-i-call-net-code-from-java
score: 0

mysql
tags question: http://stackoverflow.com/q/26097515
tags question: http://stackoverflow.com/q/26157334
tags question: http://stackoverflow.com/q/26037870
tags question: http://stackoverflow.com/q/26166616
tags question: http://stackoverflow.com/q/26174807
tags question: http://stackoverflow.com/q/26170716
tags question: http://stackoverflow.com/q/26065928
tags question: http://stackoverflow.com/q/26118271
tags question: http://stackoverflow.com/q/26100379
tags question: http://stackoverflow.com/q/26096830
tags question: http://stackoverflow.com/q/26097173
tags question: http://stackoverflow.com/q/26178724
tags question: http://stackoverflow.com/q/26045124
tags question: http://stackoverflow.com/q/26143031
tag name: mysql
tags question: http://stackoverflow.com/q/26154091
tags question: http://stackoverflow.com/q/26184979
tags question: http://stackoverflow.com/q/26073745
tags question: http://stackoverflow.com/q/26133818
tags question: http://stackoverflow.com/q/26084349
tags question: http://stackoverflow.com/q/26189180
tags question: http://stackoverflow.com/q/26104872
tags question: http://stackoverflow.com/q/26055493
tags question: http://stackoverflow.com/q/26059534
tags question: http://stackoverflow.com/q/26123772
tags question: http://stackoverflow.com/q/26122006
tags question: http://stackoverflow.com/q/26120089
tags question: http://stackoverflow.com/q/26166083
tags question: http://stackoverflow.com/q/26173513
tags question: http://stackoverflow.com/q/26098003
tags question: http://stackoverflow.com/q/26052929
tags question: http://stackoverflow.com/q/26045472
tags question: http://stackoverflow.com/q/26064864
tags question: http://stackoverflow.com/q/26034749
tags question: http://stackoverflow.com/q/26185863
tags question: http://stackoverflow.com/q/26192225
tags question: http://stackoverflow.com/q/26165370
tags question: http://stackoverflow.com/q/26062115
tags question: http://stackoverflow.com/q/26141855
tags question: http://stackoverflow.com/q/26122103
tags question: http://stackoverflow.com/q/26183339
tags question: http://stackoverflow.com/q/26175326
tags question: http://stackoverflow.com/q/26105835
tags question: http://stackoverflow.com/q/26062900
tags question: http://stackoverflow.com/q/26073398
tags question: http://stackoverflow.com/q/26157397
tags question: http://stackoverflow.com/q/26119357
tags question: http://stackoverflow.com/q/26073604
tags question: http://stackoverflow.com/q/26186258
tags question: http://stackoverflow.com/q/26182515
tags question: http://stackoverflow.com/q/26146905
tags question: http://stackoverflow.com/q/26097206
tags question: http://stackoverflow.com/q/26092118
tags question: http://stackoverflow.com/q/26120771
tags question: http://stackoverflow.com/q/26084368
tags question: http://stackoverflow.com/q/26085972
type: Tag
tags question: http://stackoverflow.com/q/26087023
tags question: http://stackoverflow.com/q/26042058
tags question: http://stackoverflow.com/q/26046234
tags question: http://stackoverflow.com/q/26058456
tags question: http://stackoverflow.com/q/26174111
tags question: http://stackoverflow.com/q/26046377
tags question: http://stackoverflow.com/q/26171897
tags question: http://stackoverflow.com/q/26154866
tags question: http://stackoverflow.com/q/26139453
tags question: http://stackoverflow.com/q/26096227
tags question: http://stackoverflow.com/q/26083167
tags question: http://stackoverflow.com/q/26122732
tags question: http://stackoverflow.com/q/26075804
tags question: http://stackoverflow.com/q/26042526
tags question: http://stackoverflow.com/q/26160528
tags question: http://stackoverflow.com/q/26141479
tags question: http://stackoverflow.com/q/26064853
tags question: http://stackoverflow.com/q/26178887
tags question: http://stackoverflow.com/q/26097977
tags question: http://stackoverflow.com/q/26172645
tags question: http://stackoverflow.com/q/26057177
tags question: http://stackoverflow.com/q/26073280
tags question: http://stackoverflow.com/q/26092714

http://stackoverflow.com/comment/40952353
has text: @Compass that's really funny .@nem knows that
score: 1
comment on: http://stackoverflow.com/q/26128308
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26160725
type: AnsweredQuestion
has body: I have a file with over 1000 names it also include the sex and how many people have the name. example Sarah F 2000 I am trying to print the first 10 lines that was created from my for loop, but for some reason what i tried is only printing the last line 10 times. import java.util.*; import java.io.*; import java.util.Collections; public class NameYear { private String year; ArrayList&lt;OneName&gt; oneName = new ArrayList&lt;OneName&gt;(); public NameYear(String year) { String line = ""; String Top = ""; Scanner sc = null; try { sc = new Scanner(new File ("/home/mathcs/courses/cs225/koch/names/yob"+year+".txt")); } catch (Exception e) { System.out.println("Error Year should be between 1880 and 2013 not "+ year); System.exit(1); } while(sc.hasNextLine()) { // read a line from the input file via sc into line line = sc.nextLine(); StringTokenizer stk = new StringTokenizer(line, ","); String name = stk.nextToken(); char sex = stk.nextToken().charAt(0); int count = Integer.parseInt(stk.nextToken()); OneName list = new OneName(name, sex, count); oneName.add(list); } for (int i = 0 ; i &lt; 10; i++) { System.out.println(descending()); } public String descending() { String x = ""; Collections.sort(oneName, new OneNameCountCompare()); for(OneName b: oneName) { x = b.toString(); } return x; OneName file public class OneName { private String Name; private char Sex; private int Count; public OneName(String name, char sex, int count) { Name = name; Sex = sex; Count = count; } public String getName() { return Name; } public char getSex() { return Sex; } public int getCount() { return Count; } public void setName(String name) { if (name.length() &lt; 1) { throw new NullPointerException("Baby name is missing"); } Name = name; } private char M; private char F; public void setSex(char sex) { if( sex != M) { if(sex != F) { throw new IllegalArgumentException("Sex has to be M or F"); } } Sex = sex; } public void setCount(int count) { if(count &lt; 0) { throw new IllegalArgumentException…
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26160871
downvote count: 1
has comment: http://stackoverflow.com/comment/41011598
type: Question
has comment: http://stackoverflow.com/comment/41011733
has comment: http://stackoverflow.com/comment/41011833
has comment: http://stackoverflow.com/comment/41011759
tagged with: class
score: 0
answer count: 2
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/26160871
has title: How to print the first 10 lines from an enhanced for loop
favorite count: 0
has answer: http://stackoverflow.com/a/26160987
has comment: http://stackoverflow.com/comment/41011632
has comment: http://stackoverflow.com/comment/41011650
possible better answer: http://stackoverflow.com/a/26160987

http://stackoverflow.com/q/26104880
has title: Connecting to web server with java socket class
has comment: http://stackoverflow.com/comment/40909677
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/26105104
tagged with: java
tagged with: http
has comment: http://stackoverflow.com/comment/40909801
type: Question
has comment: http://stackoverflow.com/comment/40909785
has body: I am trying to create a simple web proxy app using Java(without using the HTTPUrlConnection class). I have so far managed to successfully have my server listen on port 10000, and then accept a client connection when I enter a URL into my browser. I now require my proxy to forward the HTTP request from the browser to the actual web server(the URL which I typed into the browser). However, I am getting a java.net.UnknownHostException: when attempting to create a socket connection between my proxy and the web server. Does anyone know what may be causing this issue? Below is the output showing the error aswell as the complete code aswell. Any help is very much appreciated! Starting the socket server at port:10000 Listening..... Socket[addr=/127.0.0.1,port=64099,localport=10000]has connected URL IS http://www.hotmail.com Can't connect java.net.UnknownHostException: http://www.hotmail.com import java.net.*; import java.io.*; public class Proxy { private ServerSocket serverSocket; private int port; public Proxy(int port) { this.port = port; } public static void main(String[] args) { int port = 10000; try { // initialize the proxy Proxy proxy = new Proxy(port); proxy.start(); } catch (IOException e) { e.printStackTrace(); } } public void start() throws IOException { System.out.println("Starting the socket server at port:" + port); serverSocket = new ServerSocket(port); //Listen for client connection System.out.println("Listening....."); Socket client = serverSocket.accept(); //A client has connected to this server verifyClient(client); } private void verifyClient(Socket client) throws IOException { System.out.println(client + "has connected"); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); //Parse the HTTP request from the browser and find the URL String request; while ((request = in.readLine()) != null) { if (request.contains("http://")){ StringBuilder sb = new StringBuilder(request); sb.delete(0,4); sb.delete(sb.length()-9,sb.length…
tagged with: webserver
has comment: http://stackoverflow.com/comment/40909818
score: 0
answer count: 1

http://stackoverflow.com/comment/40861036
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26078252
has text: I understand. So then this means that if I got rid of the scanner input on the yesorno variable the subsequent if statement should not run? This leads to my next question however, would I have to re-input the scanner function if the user inputs n?

http://stackoverflow.com/comment/105202449
has text: Is your answer right? Don't you need to change the value of k in case your pivot is smaller than the k? because in the remaining set of elements, you won't be looking for kth smallest element now, instead you'll be looking for ```k - pivot``` smallest element?
type: AnswerComment
comment on: http://stackoverflow.com/a/26079755
score: 0
type: Comment

http://stackoverflow.com/q/26154066
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40999627
tagged with: speech-recognition
favorite count: 0
linked to: http://stackoverflow.com/q/769523
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40999691
has title: Exception in java speech recognition
downvote count: 0
has comment: http://stackoverflow.com/comment/40999700
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40999733
has answer: http://stackoverflow.com/a/26154127
type: Question
has body: I am facing some exception in the following code : import java.io.FileReader; import java.io.IOException; import java.util.Locale; import javax.speech.AudioException; import javax.speech.Central; import javax.speech.EngineException; import javax.speech.EngineModeDesc; import javax.speech.EngineStateError; import javax.speech.recognition.GrammarException; import javax.speech.recognition.Recognizer; import javax.speech.recognition.Result; import javax.speech.recognition.ResultAdapter; import javax.speech.recognition.ResultEvent; import javax.speech.recognition.ResultToken; import javax.speech.recognition.RuleGrammar; public class HelloWorld extends ResultAdapter { static Recognizer rec; // Receives RESULT_ACCEPTED event: print it, clean up, exit @Override public void resultAccepted(ResultEvent e) { Result r = (Result) (e.getSource()); ResultToken tokens[] = r.getBestTokens(); for (int i = 0; i &lt; tokens.length; i++) { System.out.print(tokens[i].getSpokenText() + " "); } System.out.println(); try { // Deallocate the recognizer and exit rec.deallocate(); } catch (EngineException | EngineStateError ex) { System.out.println(ex.toString()); } System.exit(0); } public static void main(String args[]) { try { // Create a recognizer that supports English. rec = Central.createRecognizer( new EngineModeDesc(Locale.ENGLISH)); // Start up the recognizer rec.allocate(); // Load the grammar from a file, and enable it FileReader reader = new FileReader(args[0]); RuleGrammar gram = rec.loadJSGF(reader); gram.setEnabled(true); // Add the listener to get results rec.addResultListener(new HelloWorld()); // Commit the grammar rec.commitChanges(); // Request focus and start listening rec.requestFocus(); rec.resume(); } catch (IllegalArgumentException | EngineException | SecurityException | GrammarException | IOException | AudioException e) { e.printStackTrace(); } } } Exception:- Exception in thread "main" java.lang.NullPointerException at Demo5.HelloWorld.main(HelloWorld.java:55) Java R…
has comment: http://stackoverflow.com/comment/40999680
has comment: http://stackoverflow.com/comment/40999572

http://stackoverflow.com/a/44415322
upvote count: 0
type: Answer
has body: The time complexity of Dijkstra's algorithm using an Adjacency list is With Adjacency List and Priority queue: O((v+e) log v). If the graph is dense, then e will be v^2. (Fo example, a complete graph has (n(n/1)/2) = O(v^2) edges, so e &gt;&gt; v.) For denser graphs, we can use a Fibonacci Heap instead of a priority queue. With Adjacency List and Fibonacci Heap: TC will be O( e + v log v) since in denser graph e ~ v^2 TC will be O(v^2 + v log v) ~ O(v^2)
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/26083674

http://stackoverflow.com/comment/40889751
type: AnswerComment
comment on: http://stackoverflow.com/a/26091051
score: 0
type: Comment
has text: thanks very much, can i do same with size constraints ,because my application not working properly however scrolling is ok now

http://stackoverflow.com/a/26041094
answers question: http://stackoverflow.com/q/26040865
has comment: http://stackoverflow.com/comment/40792940
has comment: http://stackoverflow.com/comment/40793381
score: 1
has body: Looks like you don't understand AMQP protocol a bit. Producer sends message to the Exchange via routingKey. You must bind the queue to that Exchange with that routingKey. Of course, you can have several bindings for the same queue with different Exchanges and different routingKeys. But anyway it will be the same queue. So, your listener should be configured to receive messages only from that queue. Because for him it doesn't matter how messages are appeared in the queue. Sorry, if I didn't understand your question properly... UPDATE I want is that the second constructor argument &lt;constructor-arg ref="exampleMessageConverter" /&gt; needs to be different for every routing key. You can't do that from SimpleMessageListenerContainer, You can achieve the desired routing logic somewhere downstream in your target exampleMessageEventHandler, the MessageProperties of Spring AMQP Message has properties getReceivedExchange() and getReceivedRoutingKey()
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/35277322
has comment: http://stackoverflow.com/comment/58274727
type: Answer
has body: I have successfully used both the JTDS driver and the Microsoft driver (JDBC4). I have not tried the SQLWorkbenchJ, as I mostly use SQuirreL to test the drivers.
score: 0
has comment: http://stackoverflow.com/comment/59277986
answers question: http://stackoverflow.com/q/26063765

http://stackoverflow.com/q/26040840
answer count: 3
has comment: http://stackoverflow.com/comment/40792470
has answer: http://stackoverflow.com/a/26062354
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26041076
type: Question
has answer: http://stackoverflow.com/a/26041076
has answer: http://stackoverflow.com/a/26041144
has comment: http://stackoverflow.com/comment/40795522
accepted answer: http://stackoverflow.com/a/26062354
has title: XML transformation using XSLT in Java program
has comment: http://stackoverflow.com/comment/40792173
has body: I am trying to transform my XML file using XSLT in java application. Below is my code but it is giving error for classNot found. I tried to resolve this but the method is not in use after jdk 5. Can you please give me better approach to transform XML using XSLT in java program. Below is my code : import java.io.File; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; class Transform { public static void main(String[] args) throws TransformerException { String stylesheetPathname = "C:/abc.xml"; String inputPathname = "C:/scripts/transform.xslt"; String outputPathname = "C:/abc_transformed.xml"; TransformerFactory factory = TransformerFactory.newInstance(); Source stylesheetSource = new StreamSource(new File(stylesheetPathname).getAbsoluteFile()); Transformer transformer = factory.newTransformer(stylesheetSource); Source inputSource = new StreamSource(new File(inputPathname).getAbsoluteFile()); Result outputResult = new StreamResult(new File(outputPathname).getAbsoluteFile()); transformer.transform(inputSource, outputResult); } } Error : Exception in thread "main" javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:107) at Transform.main(Transform.java:18) Caused by: java.lang.ClassNotFoundException:org.apache.xalan.processor.TransformerFactoryImpl 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$AppClassLoa…

http://stackoverflow.com/q/26171893
has comment: http://stackoverflow.com/comment/41032925
tagged with: java
has comment: http://stackoverflow.com/comment/41032964
has title: Arrays Group Counter
type: Question
has body: Given a provided array, determine how many groups of a specified size exist. For the array [1,1,1,2,2,2,3,3,3,4,5,6,7] there are 7 groups with at least one, 3 groups with at least 2, and 3 groups with at least 3. A group is a series of same values. 1 1 1 is a group of 3, but it also is a group of 1 and 2. To count as a group, all values must be the same. 1 1 1 is a group of 3 because there are 3 1s in a row. I'm just curious, how would this be done?
answer count: 2
tagged with: arrays
tagged with: counter
accepted answer: http://stackoverflow.com/a/26195869
score: 0
possible better answer: http://stackoverflow.com/a/26172182
has answer: http://stackoverflow.com/a/26172182
has answer: http://stackoverflow.com/a/26195869
type: AnsweredQuestion

http://stackoverflow.com/comment/41043220
has text: Ok :) Here it its - JPA fits as DAO layer, which is sth separete from controller, thus naming something `ClientsJpaController` is very confusing. Also manually beginning/ commiting transactions is very verbose and error prone - better stick with CMT (_Container Managed Transactions_). (you may take a look [this post](http://www.adam-bien.com/roller/abien/entry/don_t_use_jpa_s)).
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26175870
type: Comment

http://stackoverflow.com/comment/40951155
type: Comment
has text: @getlost You really should read the tutorials on Threading and Swing concurrency. What happened when you wrote a little example program to test it out?
comment on: http://stackoverflow.com/a/26127544
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41049022
has text: So basically, you attempted to use the function `PDJpeg` with a PNG image?
type: QuestionComment
comment on: http://stackoverflow.com/q/26176562
type: Comment
score: 3

http://stackoverflow.com/a/26041413
type: Answer
has comment: http://stackoverflow.com/comment/40793510
has body: First I would say that your example doesn't seem bad at all. It's a little verbose, and arguable not as cohesive as separating them into different methods but it looks fairly normal to me. I think a neater approach might be to use overloading instead. I can't speak for the difference in speed but from a maintenance and extensibility stance it will be easier to deal with in future. public void searchFile(SimpleFile targetFile , String searchStr) { // SimpleFile generalized behavior. if (targetPage instanceof HtmlFile) searchFile((HtmlFile)targetFile, searchStr); else if (targetPage instanceof TextFile) searchFile((TextFile)targetFile, searchStr); else if (targetPage instanceof XmlFile) searchFile((XmlFile)targetFile, searchStr); else if (targetPage instanceof ShellScriptFile) searchFile((ShellScriptFile)targetFile, searchStr); else System.out.println("Subtype not recognised"); } public void searchFile(HtmlFile targetFile , String searchStr) { // HtmlFile specific behavior } public void searchFile(TextFile targetFile , String searchStr) { // TextFile specific behavior } public void searchFile(XmlFile targetFile , String searchStr) { // XmlFile specific behavior } public void searchFile(ShellScriptFile targetFile , String searchStr) { // ShellScript specific behavior } In the event of a new subclass of SimpleFile, it will default to the SimpleFile version of the method. In the event that the type is not known at compile time (as brought up in the comments) the most general searchFile() method can be used to check and redistribute the object accordingly. Edit: As a note on the performance impact of multiple use of instanceof, the consensus appears to be that it's irrelevant, and that the use of modern instanceof is pretty fast anyway.
has comment: http://stackoverflow.com/comment/44179064
upvote count: 3
has comment: http://stackoverflow.com/comment/40798068
has comment: http://stackoverflow.com/comment/44179147
has comment: http://stackoverflow.com/comment/40793380
accepted answer of: http://stackoverflow.com/q/26041317
has comment: http://stackoverflow.com/comment/44180713
answers question: http://stackoverflow.com/q/26041317
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40793482
score: 3

http://stackoverflow.com/comment/40943865
has text: it's lable .important when you want a break or continue
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26123933
score: 5

http://stackoverflow.com/comment/40842476
type: AnswerComment
comment on: http://stackoverflow.com/a/26067855
score: 0
type: Comment
has text: OK, got it. But then what is the right way to call method `carPrice()` from `Car` class?

http://stackoverflow.com/a/26067991
score: 2
has body: Second part would technically be better because it saves some possibly unnecessary object creation and thus helps the Garbage Collector. This is related to what is know as Lazy Instantiation which means instantiating objects in memory only if we need them. Logically, however, both of these are the same. Here is a good read about Lazy Instantiation
answers question: http://stackoverflow.com/q/26067929
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/26109774
type: AcceptedAnswer
downvote count: 0
has body: You have a mistake in options 2 and 3. Look at this reduced loop code: do { if(studentPresidents.equalsIgnoreCase(firstHalf.top())) { firstHalf.pop(); // pops firstHalf } }while(!presidents.isEmpty()); // tests presidents This is why copy and paste programming is bad. It is prone to errors.
type: Answer
accepted answer of: http://stackoverflow.com/q/26109593
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26109593

http://stackoverflow.com/comment/40897398
comment on: http://stackoverflow.com/q/26098003
has text: I use Spring sts to implement Spring data jpa **hibenate** mysql
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26173823
type: Answer
has body: I believe GridCacheAtlomicLong or GridCacheAtomicSequence are the best options for this task.
has comment: http://stackoverflow.com/comment/41060475
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41048809
has comment: http://stackoverflow.com/comment/41044366
has comment: http://stackoverflow.com/comment/41053197
answers question: http://stackoverflow.com/q/26166604
accepted answer of: http://stackoverflow.com/q/26166604
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26192629
has comment: http://stackoverflow.com/comment/41073747
has body: Have a look at Spring docs about how to use the @ComponentScan - you should give it param, which is the package you want Spring to scan. package com.satisfeet; @Configuration @ComponentScan("com.satisfeet") @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
answers question: http://stackoverflow.com/q/26191230
type: Answer
score: 0

http://stackoverflow.com/comment/40865745
score: 0
type: Comment
type: QuestionComment
has text: Looking through your code, I can see that there's more issues than just the keylistener. You aren't drawing correctly, you haven't added your listeners correctly, you are mixing AWT and Swing components... I'm sorry, but you're not really at a point where we can help you
comment on: http://stackoverflow.com/q/26080637

http://stackoverflow.com/comment/40890143
type: Comment
type: QuestionComment
has text: Show us how you are reloading the view
comment on: http://stackoverflow.com/q/26093330
score: 0

http://stackoverflow.com/q/26182009
has comment: http://stackoverflow.com/comment/41051796
score: 1
has comment: http://stackoverflow.com/comment/41167584
possible better answer: http://stackoverflow.com/a/26244204
has comment: http://stackoverflow.com/comment/41051834
tagged with: multithreading
answer count: 2
has title: Special case of double checked locking?
accepted answer: http://stackoverflow.com/a/26182094
upvote count: 1
has comment: http://stackoverflow.com/comment/41051703
tagged with: java
has comment: http://stackoverflow.com/comment/41167702
type: AnsweredQuestion
has body: So I have this code where lockMap is a ConcurrentHashMap //Creation of locks Lock getLock(String key) { Lock lock = lockMap.get(key); if (lock == null) { synchronized (lockMap) { lock = lockMap.get(key); if (lock == null) { lock = new ReentrantLock(); lockMap.put(key, lock); } } } return lock; } During a code review someone mentioned that this is a typical case of DCL, because, since the compiler can reorder events, it is possible that the lock is not yet fully initialized when inserted in the map, then the next thread requesting the same lock could potentially not yet be fully initialized. Now, the problem I have with this is that this problem is a common problem with multi threaded applications: get something from a map and if not there create and add. Is this really a case of a DCL? If so, how do you solve it. (easy and dumb way we used is to create a pool of locks and when one is extracted from the pool a new one is inserted) If so again, is it fixed in java8
downvote count: 0
has answer: http://stackoverflow.com/a/26182094
favorite count: 0
tagged with: double-checked-locking
has comment: http://stackoverflow.com/comment/41167647
has answer: http://stackoverflow.com/a/26244204
type: Question
has comment: http://stackoverflow.com/comment/41051623

http://stackoverflow.com/a/26071888
has comment: http://stackoverflow.com/comment/40859130
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26071567
answers question: http://stackoverflow.com/q/26071567
type: Answer
has body: It is not good practice to add a dummy method to the superclass that will only be used by one subclass. This will lead to confusion and misunderstanding if someone else (or you in the future) will work on the code and add a new type of question that will inherit from your superclass Question. You can add objects to your list like so: ArrayList&lt;Question&gt; list = new ArrayList&lt;Question&gt;(); MultipleChoice multipleChoiceQ1 = new MultipleChoice(); multipleChoiceQ1.addChoice("abc"); MultipleChoice multipleChoiceQ2 = new MultipleChoice(); multipleChoiceQ2.addChoice("xyz"); list.add(multipleChoiceQ1); list.add(multipleChoiceQ2); Using this method, you can add other Objects to the list that are subclasses of Questionlike so: TrueAndFalse trueAndFalse1 = new TrueAndFalse(); //do something here TrueAndFalse trueAndFalse2 = new TrueAndFalse(); //do something here list.add(trueAndFalse1); list.add(trueAndFalse2); Then when accessing the list use instanceof to check for the data type. For example: for (Question question : list) { if (question instanceof MultipleChoice) { MultipleChoice multipleChoice = (MultipleChoice) question; multipleChoice.doSomething(); } else if (question instanceof TrueAndFalse) { TrueAndFalse trueAndFalse = (TrueAndFalse) question; trueAndFalse.doSomethingElse(); } }
upvote count: 2

http://stackoverflow.com/q/26177320
has comment: http://stackoverflow.com/comment/41042714
tagged with: eclipse
type: Question
answer count: 2
has body: I am having difficulties trying to execute my maven cucumber-JVM project through command line, the project works fine through eclipse environment, but im making a really silly mistake. Can some one point out what could it be, I will be attaching images of the error below, cucumber.api.cli.Main <includePluginDependencies>true</includePluginDependencies> --format junit:target/cucumber-junit-report/allcukes.xml --format pretty --format html:target/cucumber-html-report --tags @kings --glue com/Science_Ware/Bilal/KingsPostLogin/ src/test/resources Above is my pom.xml file and my class directories , where I feel error could be. My feature files are in src/test/resources and my step class path is com.Science_Ware.Bilal.KingsPostLogin and my Classname is also KingsPostLogin. C:\Users\********\My Documents\EclipseWork\Science-Ware>mvn exec:java [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Science-Ware 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ Science-Ware --- [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6. Feature: Login and clicking on Content Containers In Order to Work in Microsoft I want to log in and verify content containers @kings Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki ngsPostLogin/kingspostlogin.feature:7←[0m ←[36mGiven ←[0m←[36mI am logged into system on "Mozilla"←[0m ←[36mAnd ←[0m←[36mI click on "<Content_Container>"←[0m ←[36mThen ←[0m←[36mProcess should be "<Expected_Result>"←[0m Examples: @kings Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki ngsPostLogin/kingspostlogin.feature:15←[0m ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m ←[33mAnd ←[0m←[33mI click on "OrderCentre"←[0m ←[33mThen ←[0m←[33mProcess should be "OrderCentreTitle"←[0…
tagged with: cucumber-jvm
has comment: http://stackoverflow.com/comment/41042829
has title: cucumber maven through command line
tagged with: command-line
has answer: http://stackoverflow.com/a/78321048
score: 0
type: UnansweredQuestion
tagged with: maven
tagged with: java
has comment: http://stackoverflow.com/comment/83179521
has answer: http://stackoverflow.com/a/26178740

http://stackoverflow.com/a/26096454
type: Answer
answers question: http://stackoverflow.com/q/26095954
has comment: http://stackoverflow.com/comment/40900652
accepted answer of: http://stackoverflow.com/q/26095954
downvote count: 0
has body: It seems like a listener is the thing that you might be looking for. You need to make the class that you've decided should handle input implements KeyListener and then override one or more of the following methods to get your desired behavior. On top of this, you need to make sure that your program won't exit on the first run through, so a game loop is needed. There is a more complete example on how to write a KeyListener in the Java docs. If you want pacman to keep going in a direction, you could set a currentDirection variable that moves him each frame in the direction needed, that's set when you press the key. public void keyTyped(KeyEvent e) { displayInfo(e, "KEY TYPED: "); } /** Handle the key-pressed event from the text field. */ public void keyPressed(KeyEvent e) { displayInfo(e, "KEY PRESSED: "); } /** Handle the key-released event from the text field. */ public void keyReleased(KeyEvent e) { displayInfo(e, "KEY RELEASED: "); }
has comment: http://stackoverflow.com/comment/40894639
score: 2
has comment: http://stackoverflow.com/comment/40900810
upvote count: 2
has comment: http://stackoverflow.com/comment/40900764
has comment: http://stackoverflow.com/comment/40894686
has comment: http://stackoverflow.com/comment/40900886
has comment: http://stackoverflow.com/comment/40894605
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40901126
has comment: http://stackoverflow.com/comment/40902856
has comment: http://stackoverflow.com/comment/40900635
has comment: http://stackoverflow.com/comment/40900851

http://stackoverflow.com/comment/40932045
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26112951
type: Comment
has text: Yeah I made the changes. But I am confused as how should my form block look in jsp when I use ajax. Because now I am using one button and two form tags ` Search `

jodatime
tags question: http://stackoverflow.com/q/26090453
tags question: http://stackoverflow.com/q/26121670
tags question: http://stackoverflow.com/q/26096929
type: Tag
tag name: jodatime
tags question: http://stackoverflow.com/q/26137042
tags question: http://stackoverflow.com/q/26141695
tags question: http://stackoverflow.com/q/26162702
tags question: http://stackoverflow.com/q/26136000
tags question: http://stackoverflow.com/q/26117886
tags question: http://stackoverflow.com/q/26102295
tags question: http://stackoverflow.com/q/26135440
tags question: http://stackoverflow.com/q/26108748

http://stackoverflow.com/q/26185484
favorite count: 0
upvote count: 2
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: UnansweredQuestion
has body: I have read the previously asked questions but none of them helped me. My class is: Class A{ String name; JSONArray phone; ..... } I am using Rest client to send request and request is like: {"name":"abc","phone":[{"no":"1234","type":"landline"},{"no":"4321","type","office"}]} Now schema of this request is valid but when I send request my application throws an exception like: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY I am mapping request to class as: Gson gson=new Gson(); A para = null; try{ para = gson.fromJson(json, A.class); }catch(Exception e){ e.printStackTrace(); return false; } Could someone explain that why my array in the request is not getting mapped with the array in class A?
score: 2
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/26185995
has title: Gson throwing exception "Expected BEGIN_OBJECT but was BEGIN_ARRAY"

http://stackoverflow.com/comment/40806735
type: Comment
type: QuestionComment
has text: I want to match an array of the contents of the <seg> elements. in the example you can could say that seg 1,2,3 are acutaly one post. So I would like to combine them all in one post. I would like to know if anybody has an idea of how to deal with that...
score: 0
comment on: http://stackoverflow.com/q/26048524

http://stackoverflow.com/comment/40970681
has text: sorry, i have just updated my question. Method beforeAdvice() don't have Exception
comment on: http://stackoverflow.com/a/26138482
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40811519
type: Comment
has text: Thank you for your prompt response. Unfortunately the issue still persist, and I am receiving the same error. It has been rewritten as such ParseAnalytics.trackAppOpened(getAcitivty().getIntent()); // inform the Parse Cloud that it is ready for notifications PushService.setDefaultPushCallback(getActivity().getApplicationContext(), getActivity()); ParseInstallation.getCurrentInstallation().saveInBackground();
comment on: http://stackoverflow.com/a/26051179
type: AnswerComment
score: 0

pi
tags question: http://stackoverflow.com/q/26042373
tag name: pi
type: Tag

http://stackoverflow.com/q/26050487
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26054024
tagged with: java
type: Question
has title: Make the player move forward (facing towards its front) in LibGDX
tagged with: libgdx
score: 0
has body: I am currently working on a game in LibGDX. You may have seen another post. I have solved that problem, but now, I am facing the fact that I can't seem to move my player towards (it always moves up instead of pointing towards its front). I have tried everything, from using Box2D to answers I found online that suggested to use trig functions. Has anyone managed to do this before?
answer count: 1

http://stackoverflow.com/comment/40966027
type: Comment
comment on: http://stackoverflow.com/a/26136009
score: 0
type: AnswerComment
has text: You can leave the mode as 0 to get the default of `MODE_PRIVATE`.

http://stackoverflow.com/q/26034483
tagged with: client
tagged with: asynchttpclient
has answer: http://stackoverflow.com/a/26036918
has title: Async Http Client - How to use
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26036918
has body: I am using the sample code from https://github.com/AsyncHttpClient/async-http-client and I'm trying to create a GET request: package asyncHttpClient; import com.ning.http.client.*; import java.util.concurrent.Future; public class AsyncHttpClientExchange { public static void main(String[] args) throws Exception { AsyncHttpClient client = new AsyncHttpClient(); Future&lt;Response&gt; f = client.prepareGet("http://www.ning.com/").execute(); Response r = f.get(); System.out.println(r); client.close(); } } When I try to launch it from my eclipse I get this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at com.ning.http.client.AsyncHttpClient.&lt;clinit&gt;(AsyncHttpClient.java:152) at asyncHttpClient.AsyncHttpClientExchange.main(AsyncHttpClientExchange.java:10) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more Is a problem with my eclipse or with the code? What can I do? Thanks a lot.
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: exception

http://stackoverflow.com/a/26219084
has comment: http://stackoverflow.com/comment/41130625
accepted answer of: http://stackoverflow.com/q/26067335
answers question: http://stackoverflow.com/q/26067335
has comment: http://stackoverflow.com/comment/41174489
type: AcceptedAnswer
downvote count: 0
has body: If you are using the AddThis android SDK, then you must provide the SDK with the share url/title/description yourself. String myUrl = "http://www.example.com"; AddThis.shareItem(this, "twitter", myUrl,"Title","Description"); In this example, you know that myUrl was shared, because that is what you told the API to share.
has comment: http://stackoverflow.com/comment/41130471
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41051834
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26182009
has text: Also what do you mean "is it fixed in java 8"? This has nothing to do with the version of java.

http://stackoverflow.com/a/26106341
has comment: http://stackoverflow.com/comment/40912520
answers question: http://stackoverflow.com/q/26106179
has body: You are trying to access /demo, but as I see in your Controller, there is no such URI Template. You have root "/", "/user" and "/test".
has comment: http://stackoverflow.com/comment/40913458
score: 0
type: Answer

http://stackoverflow.com/q/26055970
answer count: 1
has body: I have created a custom DefaultMutableTreeNode.Now I want to perform Drag and drop on the tree it is working fine but I want to remove the node after being dropped. But the thing is I can insert node into model but can't remove from model. public class ORDnd extends TransferHandler { ObjectNode sourceNode; ObjectNode destinationParent; @Override public int getSourceActions(JComponent c) { return MOVE; } @Override protected Transferable createTransferable(JComponent source) { return new TransferableNode((ObjectNode) ((JTree) source).getSelectionPath().getLastPathComponent(), DataFlavors.ORDataFlavor); } @Override public boolean canImport(TransferHandler.TransferSupport support) { if (!support.isDrop()) { return false; } try { if (support.isDataFlavorSupported(DataFlavors.ORDataFlavor)) { sourceNode = (ObjectNode) support.getTransferable().getTransferData(DataFlavors.ORDataFlavor); } else { return false; } } catch (UnsupportedFlavorException | IOException ex) { Logger.getLogger(ReusableDnd.class.getName()).log(Level.SEVERE, null, ex); } JTree.DropLocation dropLocation = (JTree.DropLocation) support.getDropLocation(); TreePath path = dropLocation.getPath(); if (path == null) { return false; } destinationParent = (ObjectNode) path.getLastPathComponent(); return (destinationParent.isRoot() &amp;&amp; sourceNode.isPage()) || (destinationParent.isPage() &amp;&amp; sourceNode.isObject()); } @Override public boolean importData(TransferHandler.TransferSupport support) { if (!canImport(support)) { return false; } JTree tree = (JTree) support.getComponent(); DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); if (destinationParent.getNode(sourceNode.getText()) == null) { /** if (support.getSourceDropActions() == MOVE) { model.removeNodeFromParent(sourceNode);//Not removing the node from the model } **/ if (support.isDrop() &amp;&amp; support.getDropAction() == MOVE) { model.removeNodeFromParent(sourceNode);//Working bcoz changed getSourceDropActions to getDropAction } …
has title: JTree node not removed from DefaultTreeModel
type: AnsweredQuestion
tagged with: defaulttreemodel
tagged with: java
accepted answer: http://stackoverflow.com/a/27377191
type: Question
tagged with: jtree
has answer: http://stackoverflow.com/a/27377191
score: 0

http://stackoverflow.com/comment/40932621
type: AnswerComment
has text: @Velthune as `>>>` isn't a valid operator in C++, I'm curious how `((byte) ((258374 >>> 8) & 0xFF));` even *compiles*, much less gives you a result of `0xFFFFFFF1`.
type: Comment
comment on: http://stackoverflow.com/a/26117668
score: 0

http://stackoverflow.com/q/26178475
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41044672
type: Question
has comment: http://stackoverflow.com/comment/41045015
score: 0
has title: How to save and load objects in Java? I have tried, but it keeps throwing the IOexception
has comment: http://stackoverflow.com/comment/41044739
tagged with: serialization
type: UnansweredQuestion
has body: public class DriverClass implements Serializable { CafeManager cafe = new CafeManager(); - Creates the object public static void main(String args[]) throws FileNotFoundException, IOException, ClassNotFoundException{ CafeManager newcafe; newcafe = load(); - Calls the load module SystemMenu menu = new SystemMenu(); menu.displaymenu(); - Running of the menu newcafe = new CafeManager(newcafe.getMenuItems(),newcafe.getOrders()); - Once the user exits the menu, file should be saved save(newcafe); } public static void save(CafeManager newcafe) throws FileNotFoundException, IOException{ try{ FileOutputStream fileOut = new FileOutputStream("system.dat"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(newcafe); } catch (FileNotFoundException fe){ System.out.println("File Not found."); } catch (IOException ie){ System.out.println("File Crappy" + ie.getMessage()); //Output: File Crappycafesys.Order } } public static CafeManager load() throws FileNotFoundException, IOException, ClassNotFoundException{ CafeManager curcafe = new CafeManager(); FileInputStream fileIn = new FileInputStream("system.dat"); ObjectInputStream in = new ObjectInputStream(fileIn); try{ curcafe = (CafeManager) in.readObject(); } catch(ClassCastException | ClassNotFoundException ce){ // } catch (FileNotFoundException fe){ System.out.println("File Not found."); } catch (IOException ie){ System.out.println("File Crappy" + ie.getMessage()); //Output: File Crappy writing aborted; java.io.NotSerializableException: cafesys.Order } return curcafe; } I'm not sure why IOException is caught. As I have created the file and run it through the ObjectOutputStream. The exception message is: java.io.NotSerializableException: cafesys.Order

http://stackoverflow.com/a/26179592
score: 2
has body: These lines: CarFeatures.add(AirConditioner); //Error: Package CarFeatures does not exists CarFeatures.add(ClimateControl); //Error: Package CarFeatures does not exists CarFeatures.add(AntiLockBrakes); //Error: Package CarFeatures does not exists need to be inside a method or a static initializer. Perhaps add a constructor or a main method and place the code there. You should also use camelCase for variable names. So carFeatures would be the right choice.
has comment: http://stackoverflow.com/comment/41046988
downvote count: 0
answers question: http://stackoverflow.com/q/26179511
upvote count: 2
type: Answer

http://stackoverflow.com/q/26165885
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26166202
has comment: http://stackoverflow.com/comment/41021887
type: Question
possible better answer: http://stackoverflow.com/a/26165970
has answer: http://stackoverflow.com/a/26165976
has answer: http://stackoverflow.com/a/26165970
tagged with: java
has comment: http://stackoverflow.com/comment/41022339
has title: Trying to remove numbers bigger than my target number
accepted answer: http://stackoverflow.com/a/26165976
has body: I'm trying to fill an array with numbers from a file and I can't seem to figure out how to remove numbers larger than my target "D". Here is the code where I'm having the problem public static void populateMatrix(int[] s){ File input = new File("set2.txt"); int value; try{ Scanner inf = new Scanner(input); for(int i = 0; i &lt; s.length ; i++){ value = inf.nextInt(); if(value &gt; D){ //Don't know what to add here. }//if else{ s[i] = value; }//else }//for }//try catch(IOException e){ e.printStackTrace(); } }//PopulateMatrix
score: 0
answer count: 3

http://stackoverflow.com/a/26065592
downvote count: 0
has body: I guess some of the devices have missing library files. The same happened to me with opencl.so. In that particular case I found the opencl.so file on the device and had to do a symlink opencl.so.1 to that particular apps appdata.(In the appdata folder in the root directory).
score: 1
has comment: http://stackoverflow.com/comment/61286780
answers question: http://stackoverflow.com/q/26065114
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40996421
comment on: http://stackoverflow.com/q/26144132
score: 1
has text: The difference is undoubtedly because java7 (Https)URLConn, like (all? major?) browsers, sends Server Name Indication (SNI) but java6 didn't, as your debug-output confirms. A named-vhost server needs SNI to specify the desired host and thus certificate, and without SNI must do some default, which is apparently wrong in your case, but I don't know enough httpd to say exactly where to look.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26167404
has body: mh2.replaceAll(".html$1"); isn't modifying mh2 in place. Try using the result as in mh2 = mh2.replaceAll(".html$1"); In general though, don't use regular expressions to parse HTML. Here's a sampling of the ways this can fail: foo foo foo foo foo "y">"x" <!-- text node contains '>' --> I'm sure you can think of many more.
type: Answer
has comment: http://stackoverflow.com/comment/41024573
accepted answer of: http://stackoverflow.com/q/26167320
answers question: http://stackoverflow.com/q/26167320
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26067089
has comment: http://stackoverflow.com/comment/40841148
has comment: http://stackoverflow.com/comment/40840961
score: 0
has body: No. Just learn JFrame, and you will learn a lot more Java. I honestly recommend you learn it, it's really helpful.
has comment: http://stackoverflow.com/comment/40841047
type: Answer
answers question: http://stackoverflow.com/q/26067024

http://stackoverflow.com/a/26043653
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26043509
upvote count: 1
has body: Yes, you can write a general purpose comparator using reflection. Once you have the field name you can retrieve the field value using reflection. After you do that you can use the fact that all the basic value holding classes in java (things like Boolean, Integer, String, uuid, date etc) are comparable, cast the values you got using reflection to Comparable, and compare them

http://stackoverflow.com/comment/41032867
score: 0
type: AnswerComment
has text: This is the answer. The result of the ``convertGrade`` method is never used anywhere. Be sure to put this within the ``for`` loop. Also, you might want to skip over the first 3 elements of the array in the ``convertGrade`` method, since the name might also contain an H, D, C, P or F.
type: Comment
comment on: http://stackoverflow.com/a/26171861

http://stackoverflow.com/a/26077873
answers question: http://stackoverflow.com/q/26068658
has comment: http://stackoverflow.com/comment/40912491
score: 0
type: Answer
has body: If you store your project.properties file within build/ant/ directory ant is not aware to search it there. Additionally, instead of taskdef use: &lt;property file="build/ant/project.properties"/&gt; Worked on my local machine. Here is detailed documentation: http://ant.apache.org/manual/Tasks/property.html
has comment: http://stackoverflow.com/comment/40907623

http://stackoverflow.com/q/26059239
has title: Compare two string values and return its index in java
has answer: http://stackoverflow.com/a/26060480
tagged with: substring
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26059548
tagged with: compare
has comment: http://stackoverflow.com/comment/40825833
possible better answer: http://stackoverflow.com/a/26059941
tagged with: string
has answer: http://stackoverflow.com/a/26059941
has comment: http://stackoverflow.com/comment/40825947
has comment: http://stackoverflow.com/comment/40826785
has comment: http://stackoverflow.com/comment/40826842
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26059548
tagged with: java
has body: I have two strings containing some hex values. String One = "f9 d4 62 aa f9 d4 62 aa 74 10 99 8b"; String Two = "3c 9c a7 e2 3c 9c a7 e2 b1 58 f9 d4"; Please note that the spaces in between the hex is generated by function that is converting binary to hex.Furthermore, the hex values are treated in pairs eg, f9 d4 is regarded as one pair. My question is - how can I return the index (in this case, substring value) of two similar pair in the two strings? The above example has f9 d4 in index 1 while the other String has it on index 6. So i want my output as (1,6) and (3,6). Any help or suggestion would be appreciated.
has comment: http://stackoverflow.com/comment/40825805
type: Question

http://stackoverflow.com/a/26096837
answers question: http://stackoverflow.com/q/26058903
type: Answer
accepted answer of: http://stackoverflow.com/q/26058903
has body: I found a solution for the problem, so I post it here for future reference. If you have MainProject containing SubProject, and you want to load SubProject's fxml to your MainProject, you need to load the SubProject's fxml from the .jar file of the SubProject. The code above seems like loading SubProject's fxml from your src file, not .jar file, and that is causing the problem. To load fxml file from jar file, just use Class.getResource() instead of the above code. for example, FXMLLoader loader = new FXMLLoader(new File("D:/SubProjAddress/SubProject.fxml").toURI().toURL()); Parent root = (Parent)loader.load(); becomes Parent root = FXMLLoader.load(getClass().getResource("/subpackage/SubProject.fxml")); Using this, I could deploy my application containing multiple projects without any problem.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40836568
has text: No, because `length` is a special attribute of the array, not a method, so you won't incur method call overhead. See this answer - http://stackoverflow.com/questions/9297899/arrays-length-property
comment on: http://stackoverflow.com/a/26064707
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/71802904
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26068583
has text: @S200 the correct string to get content-desc is `contentDescription`. See my answer below. Why `name` works too is because it [falls back](https://github.com/appium/appium-android-bootstrap/blob/master/bootstrap/src/io/appium/android/bootstrap/AndroidElement.java#L185) to `contentDescription` if `text` is empty
type: AnswerComment

http://stackoverflow.com/comment/40883605
has text: @RichardK yes that's a way to go, I just realized I forgot to add two parameters to the `compare` function, fixed it :D
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26083347
type: Comment

http://stackoverflow.com/a/26047915
has comment: http://stackoverflow.com/comment/40805600
type: Answer
answers question: http://stackoverflow.com/q/26047789
has comment: http://stackoverflow.com/comment/40805739
score: 7
has comment: http://stackoverflow.com/comment/40805578
upvote count: 7
has body: If what you really want is to rotate it (sounds a bit like it). Use Collections.rotate(): Collections.rotate(Arrays.asList(array), 1); Where 1 is the number of steps (distance) If you don't want to convert the array to a list you could do the rotate manually with simple methods like this (for example) Going left: void rotateArrayLeftByOne(int array[]) { // get last index of array int lastIndex = array.length - 1; // save first element int oldFirst = array[0]; // copy the elements from right to left for (int i = 0; i &lt; lastIndex; i++) array[i] = array[i + 1]; // put the first element last array[lastIndex] = oldFirst; } and going right: void rotateArrayRightByOne(int array[]) { // get last index of array int lastIndex = array.length - 1; // save last element int oldLast = array[lastIndex]; // copy the elements from left to right for (int i = lastIndex; i != 0; i--) array[i] = array[i - 1]; // put the last element first array[0] = oldLast; }
has comment: http://stackoverflow.com/comment/40806107
has comment: http://stackoverflow.com/comment/40806310
has comment: http://stackoverflow.com/comment/40806238
downvote count: 0

http://stackoverflow.com/q/26141432
tagged with: jax-ws
type: Question
has title: Java Web Service(SOAP) Message format generic (name/value properties) nodes vs specific nodes
tagged with: webservices-client
has body: Need a suggestion on Java Web Service(SOAP) Message format. Thinking of two message formats. Could you please share your thoughts on these approaches. What would you recommend? 1) Specific Message Format Specifying the message nodes with the actual names of the data attributes like User first name , last name, ssn .... etc. see the sample below Pros: Message xsd will have the actual data types for the data to be propagated. This ensures the data is valid. Cons: Changes to the message format will lead to the xsd change which in turn lead to multiple versions of the service. this would cost the maintenance of the different versions of the service. 2) Generic Message Format Specifying the message nodes with the name value pairs. See the example message below. Pros: Additional data can be sent with additional properties wihtout changing the message format. Single version of the message can be maintained easily. Cons: Data is not typed and can not be validated. Service implementation needs to hard code the property names, parse the data, validate the data. Handling data with multiple values would be with some separator like comma(,). Handling the formatted data for the dates, time, currency data ... etc would be expensive. Specific Format Message <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:myTestServiceOperation xmlns:ns1="http://xmlns.myenterprise.com/myenterprise/myTestWebService/types/"> John Smith <SSN>123-34-567</PersonNumber> <DateOfBirth>09/01/1980</DataOfBirth> Master of Science <Institute>ABC</Institure> 2 Years <EmploymentInfo> <JobTile>Administrator</JobTitle> XYZ Corp <EmploymentInfo> </ns1:myTestServiceOperation> </soap:Body> </soap:Envelope> Generic Format Message <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:myTestServiceOperation xmlns:ns1="http://xmlns.myenterprise.com/myenterprise/myTestWebService/types/"> <Property name="FirstName" value="John"/> <Property name="LastN…
answer count: 1
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has answer: http://stackoverflow.com/a/26145877
score: 0
tagged with: java

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/26189167

http://stackoverflow.com/comment/41069676
has text: do you think that their program will execute?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26191811

http://stackoverflow.com/q/26054554
tagged with: elasticsearch
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26055114
score: 1
tagged with: java
type: Question
tagged with: indexing
has title: Elastic Search - Sort - Switch between integer fields on 0 condition
has answer: http://stackoverflow.com/a/26055114
tagged with: lucene
upvote count: 1
has body: Say I have two double datatype fields called priority1 and priority2. We need to sort on priority1, but when priority1 is 0 then choose priority2 field. Example - Document 1 - priority1 : 8.5, priority2 : 9.0 Document 2 - priority1 : 5.5, priority2 : 6.0 Document 3 - priority1 : 0, priority2 : 9.0 Document 4 - priority1 : 8.0, priority2 : 8.5 Document 5 - priority1 : 0, priority2 : 7.5 Documents should be sorted in order - Document 2 (5.5) Document 5 (7.5) Document 4 (8.0) Document 1 (8.5) Document 3 (9.0)
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26082968
linked to: http://stackoverflow.com/q/13218504
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40869741
accepted answer: http://stackoverflow.com/a/26082985
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26082994
duplicate of: http://stackoverflow.com/q/13218504
score: 0
has answer: http://stackoverflow.com/a/26082985
possible better answer: http://stackoverflow.com/a/26082993
tagged with: string
has answer: http://stackoverflow.com/a/26082993
has comment: http://stackoverflow.com/comment/40869746
has title: String split dosen't work in Java
has body: I have a text file containing lines of Strings. which separates String using '$@' symbols. (xxxx $@ yyyy $@ zzzz) I want to separate these string. so I tried following code String string = "xxx $@ yyyy $@ zzzz"; String[] parts = string.split("$@"); but it does not work. Any how I create test project and pus '-' insted of '$@' and it works fine. so how can I separate those Strings? any Suggestions??
answer count: 4
has answer: http://stackoverflow.com/a/26082995

http://stackoverflow.com/q/26152018
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26247592
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/41025446
has comment: http://stackoverflow.com/comment/41027779
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm very new to Spring and web development in general, so please bear with me if the question seems confused or incomplete... I'm currently working on a Spring project in which there is a bean I'll call 'requestContext' which holds some commonly used data. This bean is request-scoped, and it appears to get populated by a servelet filter (a child of GenericFilterBean). I'm trying to access the info held by this bean from another bean (i'll call UserBean) in the preHandle method of a HandlerInterceptor. In UserBean I use @AutoWired to access the bean as below: @Autowired private RequestContext requestContext; Then in one of UserBeans methods I try to access the necessary data. The problem is that the request context contains all null values. I thought there might be some lifecycle issue, being unfamiliar with filters, but using some breakpoints I can see that the filter is executed before the handlerInterceptor, and I can see the request context data being set. That being the case I would expect to at least be able to access it in the preHandle method of the interceptor if not the others. The rest of the application (including filter, handler interceptor) is all existing/known working code, so I don't think I have any setup issues up to the point where I'm trying to use that bean. There's just some problem with either my expectations, or with how I'm trying to access it. UPDATE: I found one example of a class that actually consumes the requestContext. It's another filter (but implements Filter directly vs extending GenericFilterBean). This filter calls SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this) in its init() method. I noticed that if I make this call just before trying to access requestContext, then it is instantiated with the values I expect (also notice that if I do it in a default constructor it does not work). Something tells me this is not the rights solution in my case, but hopefully this sheds some light on the issue. Trying to read…
tagged with: spring-bean
has answer: http://stackoverflow.com/a/26247592
upvote count: 3
has title: accessing a request-scoped bean in HandlerIntercaptor
linked to: http://stackoverflow.com/q/7201728
tagged with: servlet-filters
tagged with: spring-mvc

http://stackoverflow.com/comment/40846399
has text: read the error message, you need to run it from the directory where you put the app.yaml file
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26069943

http://stackoverflow.com/comment/40966044
has text: Actually my code is the same. I found that example and I followed it.
comment on: http://stackoverflow.com/q/26109412
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41061534
type: Comment
type: AnswerComment
has text: thanks for your help(+1) but I do not understand "You have no POJO where this exists. You'd need something like" so what is my Ad class?
score: 0
comment on: http://stackoverflow.com/a/26187114

http://stackoverflow.com/q/26109577
has answer: http://stackoverflow.com/a/26109626
type: AnsweredQuestion
downvote count: 0
has body: i have a fun project where i need to change the content of a text area inside a iteration. Its a character, a "projectile", moving trought a string. The string is updated and sent to the textArea inside the iteration, and the iteration stops when the character reaches a wall. But my textArea only updates (visually) when i leave the iteration. While im inside it, textArea freezes, as if its waiting for the iteration, even with Thread.sleep() inside it. I made an MVCE exemplifing the problem bellow, notice the text only shows after the iteration, i want it to apper in every step of the while. public class GUIProblem extends JFrame{ public GUIProblem() { setSize(640, 480); JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.CENTER); final JTextArea textArea = new JTextArea(); textArea.setRows(10); textArea.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { int i = 0; while(i &lt; 10){ textArea.setText("this text only appears after the iteration, i want it to appear in each step of the iteration!"); System.out.println("iterating..." + i++); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } } }); textArea.setColumns(30); panel.add(textArea); } /** * */ private static final long serialVersionUID = 1L; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GUIProblem gui = new GUIProblem( ); gui.setVisible(true); } }); JOptionPane.showMessageDialog(null, "Click the textArea!"); } }
score: 1
tagged with: java
has title: Updating textArea inside iteration
tagged with: swing
type: Question
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/26109626
tagged with: iteration
favorite count: 0

http://stackoverflow.com/comment/41004660
type: Comment
comment on: http://stackoverflow.com/a/26144091
score: 0
has text: Striving to test every method will force you to design better (smaller, simpler more focused units not relying on complex states or modifying state in a hard to document and understand manner). In order to actually write the test for a method that is otherwise private (without reflection) it is a common practice to change the visibility of the method to package-visible.
type: AnswerComment

http://stackoverflow.com/a/26056716
answers question: http://stackoverflow.com/q/26056485
upvote count: 26
has comment: http://stackoverflow.com/comment/120383125
score: 26
downvote count: 0
type: Answer
has body: You would need the following Java libraries and associated JAR files for the program to work. POI v3.8 iText v5.3.4 Try this Example to convert XLS to PDF The complete Java code that accepts Excel spreadsheet data as an input and transforms that to a PDF table data is provided below: import java.io.FileInputStream; import java.io.*; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.ss.usermodel.*; import java.util.Iterator; import com.itextpdf.text.*; import com.itextpdf.text.pdf.*; public class excel2pdf { public static void main(String[] args) throws Exception{ FileInputStream input_document = new FileInputStream(new File("C:\\excel_to_pdf.xls")); // Read workbook into HSSFWorkbook HSSFWorkbook my_xls_workbook = new HSSFWorkbook(input_document); // Read worksheet into HSSFSheet HSSFSheet my_worksheet = my_xls_workbook.getSheetAt(0); // To iterate over the rows Iterator&lt;Row&gt; rowIterator = my_worksheet.iterator(); //We will create output PDF document objects at this point Document iText_xls_2_pdf = new Document(); PdfWriter.getInstance(iText_xls_2_pdf, new FileOutputStream("Excel2PDF_Output.pdf")); iText_xls_2_pdf.open(); //we have two columns in the Excel sheet, so we create a PDF table with two columns //Note: There are ways to make this dynamic in nature, if you want to. PdfPTable my_table = new PdfPTable(2); //We will use the object below to dynamically add new data to the table PdfPCell table_cell; //Loop through rows. while(rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); //Fetch CELL switch(cell.getCellType()) { //Identify CELL type //you need to add more code here based on //your requirement / transformations case Cell.CELL_TYPE_STRING: //Push the data from Excel to PDF Cell table_cell=new PdfPCell(new Phrase(cell.getStringCellValue())); //feel free to move …

http://stackoverflow.com/q/26111050
answer count: 2
upvote count: 9
downvote count: 0
has title: Spring-Boot : How can I add tomcat connectors to bind to controller
has comment: http://stackoverflow.com/comment/40929529
has body: In the Spring-Boot documentation, there is a section that describe how to enable multiple connectors for tomcat (http://docs.spring.io/spring-boot/docs/1.1.7.RELEASE/reference/htmlsingle/#howto-enable-multiple-connectors-in-tomcat). But is there a way to simply add connectors to the existing one (the web and the management connectors)? And to bind them to some mvc controllers? What I want to do is to create some web services that are accessible on a different ports.
favorite count: 0
has answer: http://stackoverflow.com/a/41218468
has answer: http://stackoverflow.com/a/26143953
linked to: http://stackoverflow.com/q/54308472
tagged with: spring
possible better answer: http://stackoverflow.com/a/41218468
linked to: http://stackoverflow.com/q/73988873
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
has comment: http://stackoverflow.com/comment/40939803
accepted answer: http://stackoverflow.com/a/26143953
type: Question
score: 9

http://stackoverflow.com/a/26124125
downvote count: 0
type: Answer
score: 4
has body: See LinkedHashMap. This Map implementation maintains keys in the order in which they were inserted (basically). That said, this may not meet your specific needs, I'd read the documentation. It's simple enough to extend an existing implementation to provide even more control, though.
answers question: http://stackoverflow.com/q/26124071
upvote count: 4

http://stackoverflow.com/q/26054823
tagged with: java
has body: Now I just count number of Thursdays in period from 1st to last date. Is there one line solutions using Java 8 Date &amp; Time API? I've tried: date.range(WeekFields.ISO.weekOfMonth()).getMaximum(); but it gives incorrect result, for example for March,5,2014 it returns 5 while March has only 4 weeks according to ISO8601.
type: Question
tagged with: java-time
tagged with: iso8601
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26058417
has title: Java 8 Date & Time API: How to get count of ISO8601 weeks in given month?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26058417

http://stackoverflow.com/comment/40919202
comment on: http://stackoverflow.com/q/26110125
type: Comment
type: QuestionComment
has text: Have you considered saving cents as an int?
score: 2

http://stackoverflow.com/comment/40975074
type: Comment
comment on: http://stackoverflow.com/a/26141039
score: 0
type: AnswerComment
has text: +1 - I hadn't considered the interaction with arrays. Only the type declaration itself.

http://stackoverflow.com/q/26193079
has comment: http://stackoverflow.com/comment/41071848
has comment: http://stackoverflow.com/comment/41072068
has comment: http://stackoverflow.com/comment/41072109
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41072333
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26194759
has body: Hello this is not my main code but its close enought to show my problem . i need to create UI delay (twice) - one after the other i couldnt make it with handler.postDelay alone. so i have tried making it with Threading . What i want to do is let t2 start only after t1 ends. can anyone help me out ? final Handler handler1 = new Handler(); final Handler handler2 = new Handler(); synchronized(this) { Thread t1= new Thread(new Runnable() { public void run() { handler1.postDelayed(new Runnable() { @Override public void run() { // Do something after 3s = 3000ms imgB1.setBackgroundColor(Color.RED); notifyAll(); } }, 3000); } }); Thread t2= new Thread(new Runnable() { public void run() { handler2.postDelayed(new Runnable() { @Override public void run() { // Do something after 3s = 3000ms imgB1.setBackgroundColor(Color.YELLOW); } }, 3000); } }); t1.start(); while (t1.isAlive() ) { try { wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } t2.start(); }
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26195487
answer count: 2
tagged with: handler
downvote count: 0
tagged with: wait
has title: Android Java Handler, Thread synchronized block (notifyall & Wait )
accepted answer: http://stackoverflow.com/a/26194759
possible better answer: http://stackoverflow.com/a/26195487
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/40985001
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26146290
score: 5
has text: Appears to be a [Sorting network](http://en.wikipedia.org/wiki/Sorting_network).

http://stackoverflow.com/comment/78669606
comment on: http://stackoverflow.com/a/26142347
type: Comment
has text: I prefer `deleteAllInBatch` over `deleteAll` because I had the issue that I got an "Unique index or primary key violation" after a `repo.deleteAll(); repo.save(..someList..);` call. (saving the same list two times but I was expecting that all entities are deleted)
type: AnswerComment
score: 0

http://stackoverflow.com/a/26186036
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: Maybe this page can help you Android, getting resource ID from string? public static int getResId(String variableName, Class&lt;?&gt; c) { try { Field idField = c.getDeclaredField(variableName); return idField.getInt(idField); } catch (Exception e) { e.printStackTrace(); return -1; }
answers question: http://stackoverflow.com/q/26185853

http://stackoverflow.com/comment/40806020
type: Comment
comment on: http://stackoverflow.com/a/26046939
has text: If you have a hard-dependency on a specific version and wish to avoid a conflict, consider class relocation so that your specific version has a different name than the other. For example, the maven-share plugin offers relocation: https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40966528
type: AnswerComment
comment on: http://stackoverflow.com/a/26135110
score: 0
type: Comment
has text: JBI link - example cant download OSGI - need Jboss Fuse ... it isnt free :(

http://stackoverflow.com/q/26161447
tagged with: split
has comment: http://stackoverflow.com/comment/41013097
tagged with: arrays
has title: Splitting a line from a textfile into two separate Arrays
has comment: http://stackoverflow.com/comment/41022875
accepted answer: http://stackoverflow.com/a/26161552
upvote count: 1
answer count: 1
tagged with: string
favorite count: 0
linked to: http://stackoverflow.com/q/3481828
has body: I must apologize in advance if this question has been answered, I have not been able to find an answer to this problem on the forum thus far. I am working on a Project Euler Problem, Problem 54 to be exact, and I am required to read in 1000 lines of data, each line contains two randomly generated Poker hands, the first half of the line being Player 1's hand, the second being Player 2's. Below is an example of the layout of the document: 8CTSKC9H4S 7D2S5D3SAC 5CAD5DAC9C 7C5H8DTDKS 3H7H6SKCJS QHTDJC2D8S TH8H5CQSTC 9H4DJCKSJS What I have done thus far is manually make two documents copying the second "Hand" from each line and adding that to the new document. However I did that twice and came up with two different results, so I think I am making an error somewhere with all the copying. Below is an example of the the above function I used: ArrayList&lt;String&gt; player1 = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; player2 = new ArrayList&lt;String&gt;(); String file1 = "FilePath1"; String file2 = "FilePath2"; Scanner input1 = new Scanner(new File(file1)); while(input1.hasNext()) { player1.add(input1.nextLine()); } Scanner input2 = new Scanner(new File(file2)); while(input2.hasNext()) { player2.add(input2.nextLine()); } input1.close(); input2.close(); What I would like to know is how could I read only the first hand into an ArrayList, and then only the second hand into another one. Without having to create two separate documents and risk compromising the data. I am not sure how I would be able to use the Split function here if that is the way to go. I am fairly new to programming, I am trying to teach myself, so I apologize if this is a overly simple problem. Thank you very much in advance
has answer: http://stackoverflow.com/a/26161552
has comment: http://stackoverflow.com/comment/41022247
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: file
type: Question

http://stackoverflow.com/comment/47209649
comment on: http://stackoverflow.com/q/26168970
type: Comment
score: 0
has text: @RaphMclee No, i dediced to drop JMDNS in favor of my own multicast solution.
type: QuestionComment

http://stackoverflow.com/a/26172197
answers question: http://stackoverflow.com/q/26172161
type: Answer
score: 0
has body: int[] getIntArraySize8() { return new int[8]; } The new int[8] part is the part that returns an array and you're storing it a variable for no reason. Also please mark the language and do research before posting, its obvious when its a homework question.

http://stackoverflow.com/a/26079213
has body: As far as I can see your error is that you declare x as int[] but pass it to a method that is expecting Integer[]. This will not be autoboxed! EDIT : To make it clearer ... class WrapperDemo { static void Convert(Integer []ob,int n) { // &lt;-- type Integer[] versus int[] x=new int [20]; // &lt;-- type int[] which is NOT equal to Integer[] // and will NOT be autoboxed to Integer[] // ... WrapperDemo.Convert(x,n); // You give type int[] to a method that is expecting Integer[] And as a side-note: for(int i=0;i&lt;n;i++) { x[i]=sc.nextInt(); WrapperDemo.Convert(x,n); // &lt;- You call the convertion in each iteration. } You call the convertion in each iteration of the filling loop. So most of the entries will be null. You might want to change that to: for(int i=0;i&lt;n;i++) { x[i]=sc.nextInt(); } WrapperDemo.Convert(x,n);
has comment: http://stackoverflow.com/comment/40909800
has comment: http://stackoverflow.com/comment/40871395
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26077233
has comment: http://stackoverflow.com/comment/40874314

http://stackoverflow.com/a/26191002
answers question: http://stackoverflow.com/q/26190980
type: Answer
has comment: http://stackoverflow.com/comment/41071066
has body: You always set the current found value. But you should set the previous found values + current found value. tf1.setText(String.valueOf(original)); But more performant would be to use a stringbuilder object and append the result each time and set this value to the textfield outside the loop. public void actionPerformed(ActionEvent e) { StringBuilder s = new StringBuilder (); for(int n=0;n&lt;10000;n++) { int sum=0; int number=n; int original=number; while(number&gt;0) { int r=number%10; sum+=r*r*r; number=number/10; } if(sum==original) { s.append(original + " "); } } tf1.setText (stringBuilder.toString ()); }
has comment: http://stackoverflow.com/comment/41068457
score: 0
has comment: http://stackoverflow.com/comment/41068439
has comment: http://stackoverflow.com/comment/41071291

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/26055695
tags question: http://stackoverflow.com/q/26073855
tags question: http://stackoverflow.com/q/26193428
type: Tag

http://stackoverflow.com/comment/41355722
type: Comment
comment on: http://stackoverflow.com/a/26222122
type: AnswerComment
has text: i try to implement multithreading only on independent tasks, i may not be the best programmer or better than you :) but i posses knowledge about these things. And i'm not being stubborn, i have full confidence in my apps. On interdependent tasks i use threadpools. :). I will try to publish my code under GPL license. LOLz you are really underestimating me.
score: 0

http://stackoverflow.com/comment/40969386
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26137784
score: 0
has text: @Mobility I thought StringTokenizer used regular expressions also.

http://stackoverflow.com/a/26158575
has body: All that follows only have sense in a web application, but as the question has spring-mvc tag ... Assuming you have a way to get the database name from the connected username and do not access database until user is logged and session is established, you could simply put all the stuff in session scope. Just add a scope annotation to relevant beans : @Scope(value=WebApplicationContext.SCOPE_SESSION, proxyMode=ScopedProxyMode.INTERFACES) to use a JDP proxy provided you bind the bean through interface (should be the case at least for DataSource and SessionFactory, and also for the transaction manager if normaly used). If it breaks because you need to use classes, use proxyMode=ScopedProxyMode.TARGET_CLASS. That way, you can even bind the session factory in a (singleton bean) Dao, and thanks to scoped proxy, each user will use its own. The delicate part is to write the getUrl() method, because it will have to return the correct url. But you can also use a session scoped bean to store the url and store the url at login time.
answers question: http://stackoverflow.com/q/26157804
score: 0
type: Answer

http://stackoverflow.com/q/26044918
type: AnsweredQuestion
upvote count: 0
tagged with: annotations
downvote count: 1
has title: Hibernate criteria java annotation
has comment: http://stackoverflow.com/comment/40801260
type: Question
has body: Im new at Hibernate and i have a problem that i can't solve, i take a look at similar questions but i haven't luck... I have a table (lets call it T1) and another table (lets call it T2). T1 have a relation with T2 and T2 same with T1, so they have a many to many relation so i created a bridge table (lets call it T1_T2). T1.id &lt;----> T1_T2.T1id &lt;----> T2.id T2.id &lt;----> T1_T2.T2id &lt;----> T1.id My question is the next: How i should build my java clases (T1, T1_T2, T2) and make a query with criteria, only giving one id (of any of the 2 tables) as a parameter? Hope anyone can help me, thanks!
tagged with: many-to-many
tagged with: criteria
tagged with: java
tagged with: hibernate
score: -1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40799887
has answer: http://stackoverflow.com/a/26045073
accepted answer: http://stackoverflow.com/a/26045073

http://stackoverflow.com/q/26048052
favorite count: 0
has comment: http://stackoverflow.com/comment/40805956
has comment: http://stackoverflow.com/comment/40806643
has comment: http://stackoverflow.com/comment/40806556
upvote count: 1
has comment: http://stackoverflow.com/comment/40806283
has title: Use an ArrayList in Java on JSP Page
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40807368
has comment: http://stackoverflow.com/comment/40806018
has answer: http://stackoverflow.com/a/26049234
tagged with: java
has comment: http://stackoverflow.com/comment/40806595
has answer: http://stackoverflow.com/a/26049992
has comment: http://stackoverflow.com/comment/40806746
downvote count: 1
has comment: http://stackoverflow.com/comment/40806029
type: Question
possible better answer: http://stackoverflow.com/a/26049234
answer count: 2
has body: I am trying to pass an ArrayList that I have created to a JSP page but I am having a difficult time attempting to do this. Here is what I have so far. Java Class: public class Main { private ArrayList<Employee> employees = new ArrayList<Employee>(); public Main (){ try{ BufferedReader br = new BufferedReader(new FileReader("lang.txt")); String line; String[] employee; Employee employeeObject; br.readLine(); while ((line = br.readLine()) != null) { employee = line.split(","); employeeObject = new Employee (employee[0], employee[1], employee[2], employee[3], employee[4], employee[5], employee[6]); employees.add(employeeObject); } br.close(); } catch(IOException e){ } } /** * @return the employees */ public ArrayList<Employee> getEmployees() { return employees; } /** * @param employees the employees to set */ public void setEmployees(ArrayList<Employee> employees) { this.employees = employees; } } JSP Page: <%@page import="lab3final.beans.Employee"%> <%@page import="java.util.ArrayList"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <jsp:useBean id="employee" scope="session" class="lab3final.beans.Main"/> Table Data Data in text file in table format <c:forEach items="${employee.employees}" var="item"> ${item} </c:forEach> It would be great if someone could give me some idea on what I am doing wrong. I am not able to read the ArrayList I created on my JSP page. UPDATE: I figured out the problem was that I had to give the full path to my text file lang.txt otherwise it would be searching for the file in some other directory which was not my main project directory. I guess this is the default location for searching for files when I try to read files using a FileReader in the constructor of a class. Right now I can print out all the employees using ${employee.employees} and it will print out all the employees using the toString() method I have defined in the employees class. I am still trying to figure out how I can use the loop function in JSP so I can loop thro…
has comment: http://stackoverflow.com/comment/40807612
tagged with: jsp
has comment: http://stackoverflow.com/comment/40806028
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/40806440
accepted answer: http://stackoverflow.com/a/26049992
has comment: http://stackoverflow.com/comment/40807142
has comment: http://stackoverflow.com/comment/40805933
has comment: http://stackoverflow.com/comment/40805887

http://stackoverflow.com/q/26108292
answer count: 0
tagged with: java
type: Question
tagged with: nashorn
linked to: http://stackoverflow.com/q/4037252
tagged with: javascript
has comment: http://stackoverflow.com/comment/40916231
downvote count: 0
has comment: http://stackoverflow.com/comment/40916834
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: The yield keyword in JavaScript would be pretty handy for certain scripting tasks in Java 8's Nashorn engine. Given the bleeding-edge-ness of yield (it's in ES6), it's probably not included in Nashorn, but I was curious if there's something similar available.
has title: Does Nashorn have an equivalent of "yield"?
score: 2

http://stackoverflow.com/comment/40982929
type: QuestionComment
comment on: http://stackoverflow.com/q/26140018
type: Comment
has text: You may need to send the URL of your question directly to the maintainers of the R extension to get their attention here; I don't think they monitor Stack Overflow.
score: 0

http://stackoverflow.com/comment/41033393
type: Comment
type: QuestionComment
has text: you'll have to iterate through the whole set of keys and check (with regex or simply splitting the string) which ones have the last part in uppercase.
comment on: http://stackoverflow.com/q/26172131
score: 0

http://stackoverflow.com/comment/40963734
score: 0
type: AnswerComment
type: Comment
has text: Thank you. I changed setText to append. But when the output shows, my fields are not separated. For example, firstname: marylastname:scottaddress:new york. It does not have a newspace or enter.
comment on: http://stackoverflow.com/a/26134678

http://stackoverflow.com/q/26048660
has comment: http://stackoverflow.com/comment/40807169
has body: import java.util.Scanner; public class CoinCounter { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Enter the number of toonies: "); int t = keyboard.nextInt(); System.out.print("Enter the number of loonies: "); int l = keyboard.nextInt(); System.out.print("Enter the number of quarters: "); int q = keyboard.nextInt(); System.out.print("Enter the number of dimes: "); int d = keyboard.nextInt(); System.out.print("Enter the number of nickels: "); int n = keyboard.nextInt(); int coinCounter = total(t,l,q,d,n); System.out.println("The total value of the coins is " + coinCounter + " cents"); finalMessage; static int total(int t , int l , int q , int d , int n) { return t*200 + l*100 + q*25 + d*10 + n*5; }//total of coins static String finalMessage( ); { System.out.print("Cole Coin Counter Company, 2014"); }//final message }//main }//coinCounter
has comment: http://stackoverflow.com/comment/40808065
type: Question
has comment: http://stackoverflow.com/comment/40808114
tagged with: java
has answer: http://stackoverflow.com/a/26049058
upvote count: 2
answer count: 2
has title: Getting told to place ; in my method
has comment: http://stackoverflow.com/comment/40833577
downvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/40807630
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26049065
score: -4

http://stackoverflow.com/a/26131870
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26131849
score: 5
upvote count: 5
has body: When running a Java class, you don't supply the filename of the class, you supply the classname. If you specify DataEntry.java, the interpreter will think you are trying to load the class java in the package DataEntry, which of course doesn't exist. Instead of this: java DataEntry.java Do this: java DataEntry

http://stackoverflow.com/a/26128604
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26128548
score: 6
answers question: http://stackoverflow.com/q/26128548
type: AcceptedAnswer
downvote count: 0
has body: You are creating a ConcurrentHashMap in both cases, so the thread safety is exactly the same. ConcurrentHashMap implements the Map interface, which is what you're calling through in example 1. But this has no impact on the underlying object that was instantiated.

http://stackoverflow.com/a/26139577
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26059327
type: Answer
has comment: http://stackoverflow.com/comment/41013849
score: 0
has comment: http://stackoverflow.com/comment/41011490
has comment: http://stackoverflow.com/comment/40975427
has body: If you are looking to adding an HTML content to build results or projects, please check out this documentation page: 'Including third-party reports in build results' Configuratoin described in this doc can be done using Java API: see jetbrains.buildServer.web.reportTabs.ReportTabManager docs to configure tab settings on server side. see jetbrains.buildServer.agent.artifacts.ArtifactsWatcher to publish files from build agent. This one is used to publish files as build artifacts. UPD The abovementioned components can be used by plugin to configure 'third party report tab' (without any manual configuration). This way, plugin can provide html report from build without need to access uploaded artifacts.
answers question: http://stackoverflow.com/q/26059327
has comment: http://stackoverflow.com/comment/41046935

http://stackoverflow.com/comment/40968846
score: 0
has text: I thought it will be easier to understand without the code, as that will introduce problems and variables which arent directly linked to this specific issue. But I will follow your suggestion.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26137539

http://stackoverflow.com/comment/40920725
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26108167
type: Comment
has text: Whatever you do, any database is dead slow when compared to a `HashMap`. Given that the OP speaks of 100 MB, it makes no sense at all. What's worse: If the strings don't fit in memory, then you're at the mercy of your OS and harddisk... losing 5+ orders of magnitude in speed (100 ns HashMap vs. 10 ms harddisk). Compressing the strings using a trie sound much faster.

http://stackoverflow.com/q/26036793
has answer: http://stackoverflow.com/a/46008981
type: UnansweredQuestion
tagged with: ftp
tagged with: java
tagged with: file
type: Question
has title: java ftp delete all files without deleting folders
has body: How to remove all files on ftp the server without deleting folders using Java. For example, i have files that in the folders like: /TEST/DOCUMENT/1/111.txt /TEST/DOCUMENT/1/222.txt /TEST/DOCUMENT/2/333.txt /TEST/DOCUMENT/2/444.txt /TEST/PDF/1/111.pdf /TEST/PDF/1/222.pdf /TEST/PDF/2/333.pdf I need to delete only files not folders
score: 0
has comment: http://stackoverflow.com/comment/40786310
has comment: http://stackoverflow.com/comment/40785190
answer count: 1

http://stackoverflow.com/a/26182076
answers question: http://stackoverflow.com/q/26181917
has body: There is a very simple and useful example given at the android developer website for Creating a Navigation Drawer. Please go through the sample code. In that code they load different planets images based on item click of the navigation drawer list. As far as I can understand, you need the exact same functionality. Just instead of planets images, you want to load different urls.
score: 0
type: Answer

http://stackoverflow.com/q/26142835
type: AnsweredQuestion
tagged with: parsing
has answer: http://stackoverflow.com/a/26143343
tagged with: antlr4
type: Question
score: 0
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/26100737
accepted answer: http://stackoverflow.com/a/26143343
has title: Why does this addition to my ANTLR4 grammar break an unrelated rule alternative?
has body: I am parsing Magic cards using ANTLR4 (org.antlr:antlr4-runtime:4.0). This minimized version is able to parse abilities such as Enchant creature, Enchant black creature, ..., as well as Protection from creatures, Protection from legendary creatures, ... Now I'm trying to enable Protection from black, which gives me problems. I have the following lexer &amp; parser grammars, along with a test class: Lexer: lexer grammar OracleLexer; Black: 'black'; Creature: 'creature'; Creatures: 'creatures'; Enchant: 'enchant'; From: 'from'; Legendary: 'legendary'; Protection: 'protection'; WS: [ \t\f\r\n]+ -&gt; skip; Parser: parser grammar OracleParser; options { tokenVocab = OracleLexer; } line: keywordAbility EOF; keywordAbility: Enchant singularObject #Enchant | Protection From pluralObject #Protection; // (A) // Protection From (pluralObject | objectQuality) #Protection; // (B) singularObject: objectQuality? Creature; pluralObject: objectQuality? Creatures; objectQuality: cardtypeQuality+? | supertypeQuality+ cardtypeQuality*? | colorQuality+ supertypeQuality* cardtypeQuality*?; colorQuality: Black; supertypeQuality: Legendary; cardtypeQuality: Creature; Test class: import static java.util.Arrays.*; import static java.util.Collections.*; import java.util.List; import org.antlr.v4.runtime.*; public class OracleParserTest { private static final List&lt;String&gt; ruleNames = unmodifiableList(asList(OracleParser.ruleNames)); public static void main(String[] args) throws Exception { parse("Enchant creature"); parse("Enchant black creature"); parse("Protection from black"); parse("Protection from black creatures"); } private static void parse(String ability) throws RecognitionException { OracleLexer lexer = new OracleLexer(new ANTLRInputStream(ability.toLowerCase())); lexer.removeErrorListeners(); lexer.addErrorListener(new BailErrorListener()); OracleParser parser = new OracleParser(new CommonTokenStream(lexer)); parser.removeErrorListeners(); parser.setErrorHandler(new BailError…
tagged with: antlr

http://stackoverflow.com/comment/41062153
type: Comment
comment on: http://stackoverflow.com/q/26187229
type: QuestionComment
has text: @Mona Jalal as suspected the constructor accepts only Integers. Why are you trying to pass Strings to it?? Show my how YOU are calling the constructor?
score: 0

http://stackoverflow.com/comment/41005786
type: Comment
type: QuestionComment
score: 0
has text: do you want to draw **one** circle or do you want to add a **new** circle when that button is pressed?
comment on: http://stackoverflow.com/q/26155833

http://stackoverflow.com/comment/40845714
has text: /retrieve its values value mean ,can I do like this JsonObject js= routeJsonArray.getjsonObject(i)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26069726
type: Comment

http://stackoverflow.com/comment/40811291
comment on: http://stackoverflow.com/q/26050888
type: Comment
has text: See answer here: http://stackoverflow.com/questions/9264897/reason-for-the-exsistance-of-non-short-circuit-logical-operators
score: 0
type: QuestionComment

http://stackoverflow.com/q/26193892
downvote count: 0
answer count: 3
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: parse-platform
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26154855
score: 3
has answer: http://stackoverflow.com/a/26253174
upvote count: 3
tagged with: java
has body: As given in their quickstart guide for push notifications, I did everything. But whenever I try sending a test push, the app crashes. I have gone through all online help resources possible, but everything seems right except the execution. My main-> Application.java package-> com.virus.buzzkill; public class BuzzKillApplication extends Application { @Override public void onCreate() { super.onCreate(); Parse.initialize(this, "YhcMXhTCr65bWiI2RB4voL", "R7QWGNPMjIPh1CHTxZRXxuzgu"); ParseInstallation.getCurrentInstallation().saveInBackground(); } } My AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-feature android:name="android.hardware.camera" android:required="true" /> <permission android:name="com.virus.buzzkill.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.virus.buzzkill.permission.C2D_MESSAGE" /> <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.virus.buzzkill.MainActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.virus.buzzkill.MainActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.virus.buzzkill.MainActivity" /> <service android:name="com.parse.PushService" /> …
has title: App crashes on test push notification using parse
has answer: http://stackoverflow.com/a/26252972
type: Question
has answer: http://stackoverflow.com/a/26213182
tagged with: crash

http://stackoverflow.com/comment/40847418
has text: I'll clarify my problem. just a second.
type: Comment
comment on: http://stackoverflow.com/a/26070596
score: 0
type: AnswerComment

http://stackoverflow.com/comment/68704971
has text: try to execute this command as administrator. Ex. open netbeans or eclipse as administrator ( if you are using these tools ).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26048551
score: 0

http://stackoverflow.com/comment/40959223
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26127640
has text: Thanks for the advice. Question has been reformatted in an attempt to boil it down to the nitty-gritty.
score: 0

http://stackoverflow.com/comment/40911026
comment on: http://stackoverflow.com/a/26105540
type: AnswerComment
score: 0
type: Comment
has text: Having just tested it, I didn't realize that at run time, a null instance.someStaticMethod() won't cause a NPE. Learned something today.... something... pretty useless :).

http://stackoverflow.com/a/26091451
accepted answer of: http://stackoverflow.com/q/26091275
score: 0
type: AcceptedAnswer
has body: Your pi method is working fine. You should change the other one to this. I have written it a little bit different so you get the logic easily. public static String addPounds(String s, int x){ String a = ""; //starting from 1 so i can do mod division easily for(int i = 1; i &lt;= s.length(); i++){ //check if next # has to be placed at the end if(i + 1 &gt; s.length() &amp;&amp; (i + 1) % x == 0){ a += "#"; //check if next # has to be placed somewhere inside the string }else if(i % x == 0){ a += s.charAt(i - 1); a += "#"; //oherwise just add the char at i-1 }else { a += s.charAt(i - 1 ); } } return a; }
answers question: http://stackoverflow.com/q/26091275
type: Answer

http://stackoverflow.com/q/26077156
has answer: http://stackoverflow.com/a/26077210
answer count: 1
has comment: http://stackoverflow.com/comment/40858788
has body: I don't know what is wrong with this list, but when I try and test it out my IDE crashes. I don't know if it's my toString method, or my Add method, so here's my code. When I test the methods it my IDE doesnt print or return anything and quits working to the point I have to restart. public void add(int index, String string){ Node newest=new Node(string,null); Node temp; temp=head; newest.setNext(temp); for (int i=0;i&lt;index-1;i++){ newest.setNext(newest.getNext());} for (int i=0;i&lt;=index-1;i++){ temp.setNext(temp.getNext()); if (i==index-1){ temp.setNext(newest); } }} public String toString(){ Node Current= head; String result=" "; while(Current!=null){ result+=Current.getElement()+", "; Current=Current.getNext(); } return result; }
has comment: http://stackoverflow.com/comment/40858827
score: 0
has title: Why is this linked list crashing my IDE?
type: UnansweredQuestion
tagged with: linked-list
tagged with: java
type: Question

http://stackoverflow.com/a/26143007
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/40987899
type: Answer
answers question: http://stackoverflow.com/q/26142937
accepted answer of: http://stackoverflow.com/q/26142937
has body: You have to add the actual folder to the classpath: javac -cp .\;%CLASSPATH% Animal.java
has comment: http://stackoverflow.com/comment/40982102

http://stackoverflow.com/q/26190980
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26191002
has answer: http://stackoverflow.com/a/40722792
tagged with: awt
has title: i want to print all armstrong number between 1 to 1000 in a textbox using awt or swing but i only get last value by my code .So plc help me
has body: i want to print all armstrong number between 1 to 1000 in a textfield using awt or swing but i only get last value by my code .So pls help me public void actionPerformed(ActionEvent e) { String s1=tf.getText(); int n1=Integer.parseInt(s1); for(int n=0;n&lt;10000;n++) { int sum=0; int number=n; int original=number; while(number&gt;0) { int r=number%10; sum+=r*r*r; number=number/10; } if(sum==original) { tf1.setText(String.valueOf(original[i])); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/26191416
has answer: http://stackoverflow.com/a/43964329
type: UnansweredQuestion
tagged with: swing
answer count: 4
tagged with: java
downvote count: 2
type: Question

http://stackoverflow.com/a/26259296
type: Answer
answers question: http://stackoverflow.com/q/26192965
has body: the method of get from class FutureTask (at the above answer return fooFuture.get();) is a blocking function that means when you call it from UI thread it blocks the UI thread so cause your app sends you ANR error. My suggestion to solve it is using LocalBroadCastManager and when the computation finished it sends a local broadcast and in your UI you will get the result at the onReceive from the Extra that is embedded in the intent. another solution is using ruOnUiThread or passing the handler from UI thread. and last one is using post method of widgets.
score: 0

http://stackoverflow.com/q/26082978
favorite count: 0
has comment: http://stackoverflow.com/comment/40869865
type: UnansweredQuestion
has title: updating and deleting rows in excel in java using poi with xml approach
linked to: http://stackoverflow.com/q/1900647
has comment: http://stackoverflow.com/comment/40870109
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26083561
has comment: http://stackoverflow.com/comment/40888593
type: Question
has answer: http://stackoverflow.com/a/26083317
has body: I have a requirement in project where I have to delete few rows from an existing excel(.xlsx) and I have to update few columns from database. For example,if I have 10 rows in an excel,I have to delete 8 rows and update 2 columns of a remaining two rows from database.Finally my excel should have only two rows with updated values. Please let me know if I can do this with the xml approach using poi in java.I know how to read using xml,but am not sure about updating and deleting from xml.please help me on this
has comment: http://stackoverflow.com/comment/40869779
score: -2
linked to: http://stackoverflow.com/q/1834971
answer count: 2
downvote count: 2

http://stackoverflow.com/a/26126741
has body: String.split takes a regex. The regex for a capital letter is "[A-Z]", but you want to retain the character, thus look for "\\ [A-Z]" (a space before). Finally make it not capture the letter: String[] lines = lyrics.split("\\ (?=[A-Z])"); formatted = lyrics.replaceAll("\\ (?=[A-Z])", "\n"); To make up for the one-letter I, you can use String[] lines = lyrics.split("\\ (?!I\\s)(?=[A-Z])"); formatted = lyrics.replaceAll("\\ (?!I\\s)(?=[A-Z])", "\n");
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40949154
answers question: http://stackoverflow.com/q/26126639
has comment: http://stackoverflow.com/comment/40949051
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40949198
score: 2
has comment: http://stackoverflow.com/comment/40949045
accepted answer of: http://stackoverflow.com/q/26126639
has comment: http://stackoverflow.com/comment/40949082
has comment: http://stackoverflow.com/comment/40949101
has comment: http://stackoverflow.com/comment/40949077

http://stackoverflow.com/q/26122668
has answer: http://stackoverflow.com/a/26122688
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40941724
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40943116
answer count: 2
has title: SavingsAccount constructor
has comment: http://stackoverflow.com/comment/40941412
has comment: http://stackoverflow.com/comment/40943738
score: 0
has comment: http://stackoverflow.com/comment/40941808
has body: If I have class name SavingsAccount, two instance variables such as private double balance and private double Interest then how do I code a constructor that has initialBalance and interest?
has answer: http://stackoverflow.com/a/26122698
tagged with: constructor

http://stackoverflow.com/comment/40804844
type: QuestionComment
score: 0
has text: why don't you try to run it and read the compiler error?
comment on: http://stackoverflow.com/q/26047473
type: Comment

http://stackoverflow.com/a/31798446
score: 1
answers question: http://stackoverflow.com/q/26038333
upvote count: 1
has body: Baz gives the direction to the correct answer. I will attempt to put his answer in your context: private boolean loading; // Instance variable createBrowserControl() { // Browser widget definition method Browser b = ...; // Create the browser widget browser.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent event) { loading = false; } @Override public void changed(ProgressEvent event) { loading = true; } }); } public boolean loadPage(String url) { Display display = ... // Get the display from the UI or the widget boolean set = browser.setUrl(url); // URL content loading is asynchronous loading = true; while(loading) { // Add synchronous behavior: wait till it finishes loading if(!display.readAndDispatch()) { display.sleep(); } } return set; }
type: Answer
downvote count: 0

http://stackoverflow.com/q/26149643
favorite count: 0
has body: Hi I need to send an email when my application starts and and email when my application stops. Using spring... public class Main { public static void main(String[] args) { FileSystemXmlApplicationContext fac = new FileSystemXmlApplicationContext("config/applicationContext.xml"); } } The rest is wired up through the application context... I suppose I can just inject a simple bean that implements smart life cycle and send an email from within the start() and stop() methods?
tagged with: spring
possible better answer: http://stackoverflow.com/a/26149763
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26150262
accepted answer: http://stackoverflow.com/a/26150262
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26149763
upvote count: 2
has title: How to check for start and stop with spring framework?

http://stackoverflow.com/a/26072756
has body: Collections.toArray() is your friend. It has two methods a type safe and a non type safe one (preferred to use type safe). Integer[] a = new Integer[] {1,2,3}; List&lt;Integer&gt; l = Arrays.asList(a); Collections.reverse(l); l.toArray(a); If possible using Collections instead of arrays is the best practice.
has comment: http://stackoverflow.com/comment/40850897
has comment: http://stackoverflow.com/comment/40850995
downvote count: 0
has comment: http://stackoverflow.com/comment/40850911
has comment: http://stackoverflow.com/comment/40850867
has comment: http://stackoverflow.com/comment/40850964
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40850929
has comment: http://stackoverflow.com/comment/40850971
answers question: http://stackoverflow.com/q/26070106
score: 2

http://stackoverflow.com/comment/40888381
has text: ya according to me that is True solution.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26093015

http://stackoverflow.com/comment/40795457
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26041144
has text: It is single java program which i have created in eclipse. I have added external jar of xalan. When i am running this program it gives error. It dont have any other dependancy.
type: Comment

http://stackoverflow.com/q/26084711
type: UnansweredQuestion
tagged with: java
tagged with: http
type: Question
tagged with: glassfish
score: 0
answer count: 1
has title: Glassfish 4.1 answers with bad request, but 3.1.2 not
has body: I'm using jax-rs on glassfish 3.1.2 and plan to migrate to glassfish 4.1. But after doing some tests I discovered that one of our client apps sends http request with two 'Content-type' strings: PUT /api/v4/topTen HTTP/1.1\r\n Content-Type: application/json\r\n Content-Length: 5105\r\n Host: 10.19.76.2:8080\r\n User-Agent: Apache-HttpClient 1.0\r\n Accept: application/json\r\n Content-Type: application/json; charset=utf-8\r\n The problem is that glasshfish 4.1 does not accept this request and answers with '400 Bad request', but glassfish 3.1.2 processes it perfectly. Unfortunately I can't change the the client because it was published and many people use it. Is there any way to tune 4.1 to accept such request and process it?
has answer: http://stackoverflow.com/a/26582916

http://stackoverflow.com/comment/114450985
comment on: http://stackoverflow.com/a/26040615
type: AnswerComment
has text: This is not correct. It should be `"my extra spaced string".replaceAll("\\s+"," ")`
score: 0
type: Comment

http://stackoverflow.com/q/26052085
answer count: 0
has title: How to use soot to modify a byte code file, so that I can print some things?
type: UnansweredQuestion
has body: I have a target.java: static void main(){ int a = 0; a++; a++; return 0; } I want to use soot to insert a command so that target.java can output the following sentence "a is = 2" (I do not need the same code format as followed): static void main(){ int a = 0; a++; a++; System.out.println("a is = " + a + "\n"); return 0; } Anyone knows how to do it? I know some things about soot is that I should make an expression first then I should find the last position of main method then I convert the expression into a statement finally I should add the statement into the byte code. InvokeExpr reportExpr = Jimple.v().newStaticInvokeExpr(//something here); Stmt reportStmt = Jimple.v().newInvokeStmt(reportExpr); units.insertBefore(reportStmt, stmt); What should I put inside the newStaticInvokeExpr()?
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: soot
favorite count: 0

http://stackoverflow.com/comment/40895296
has text: 1)Where you initialize `keywords`? 2) Don't call `repaint();` inside `paintComponent()`.
comment on: http://stackoverflow.com/q/26096633
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26148591
has body: I have created an example class for my problem below. public class testClass { public void testMethod() { int testInteger = 5; } String testString = "Hello World" + testInteger; } I have an integer inside a method and a string that is in no method as seen above. I want the string to get the integer that inside the method but it cannot. Can someone please help explain why that is so and tell me how to make the string the integer. thanks.
tagged with: java
has answer: http://stackoverflow.com/a/26148674
type: Question
has title: How do i get a string to get an integer that is inside a method
has answer: http://stackoverflow.com/a/26148657
tagged with: string
tagged with: integer
favorite count: 0
has answer: http://stackoverflow.com/a/26148643
answer count: 5
downvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26148612
has comment: http://stackoverflow.com/comment/40989494
has answer: http://stackoverflow.com/a/26148639
upvote count: 0
score: -5

http://stackoverflow.com/q/26137199
has comment: http://stackoverflow.com/comment/40968780
tagged with: icons
has comment: http://stackoverflow.com/comment/40968307
has comment: http://stackoverflow.com/comment/40968529
has comment: http://stackoverflow.com/comment/40968589
possible better answer: http://stackoverflow.com/a/63296337
has answer: http://stackoverflow.com/a/63296337
has title: JTable, how can I put icons in the header?
has answer: http://stackoverflow.com/a/26160328
has body: i'm trying to render some icons in a JTable header without success. I've already tried something like this: http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingColumnHeaderswithIcons.htm but it doesn't show any icon in the header. How can I reach this goal?
accepted answer: http://stackoverflow.com/a/26160328
has comment: http://stackoverflow.com/comment/40968176
tagged with: jtableheader
tagged with: swing
has comment: http://stackoverflow.com/comment/40968454
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40968509
has comment: http://stackoverflow.com/comment/40968855
tagged with: java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/71718055

http://stackoverflow.com/comment/41034921
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26172653
has text: for the future try using maven or other dependency management "tool" instead. It's better for handling dependencies.
score: 0

http://stackoverflow.com/q/26064792
has answer: http://stackoverflow.com/a/26064847
has answer: http://stackoverflow.com/a/26064815
type: UnansweredQuestion
has body: I'm a beginner Java student trying to make this code list the amount saved and interest for 8 years. I'm trying to use a for loop for it. It calculates the interest but only lists it for 1 year. Would appreciate any help solving this problem. import javax.swing.JOptionPane; import java.text.*; public class RetirementGoal3 { private static DecimalFormat percentFormat = new DecimalFormat("###.##%"); private static DecimalFormat moneyFormat = new DecimalFormat("$###,###,###.00"); private static double interest; private static double saveAmount; private static double total; private static int Max_Year = 8; private static int year; private static double totalSave; private static double totalInterest; public static void main(String[] args) { calculateR(); } public static double calculateR() { String result = JOptionPane.showInputDialog(null, "Enter how much money you can save annually."); if(result != null) saveAmount = Double.parseDouble(result); String result1 = JOptionPane.showInputDialog(null, "Enter your interest rate(As a decimal)"); if(result1 != null) interest = Double.parseDouble(result1); totalSave = saveAmount; for(year = 1; year &lt;= Max_Year; ++ year) { totalInterest = saveAmount + saveAmount * interest; JOptionPane.showMessageDialog(null, " If you save " + moneyFormat.format(totalSave) + " each year for " + Max_Year + " years" + "\n With " + percentFormat.format(interest) + " Interest" + " Without Interest" + "\n\nAfter year " + year + " " + moneyFormat.format(totalSave) + " " + moneyFormat.format(totalInterest)); return total; } return total; } }
score: -1
tagged with: java
has title: What is wrong with my loop
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26064845
answer count: 3
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41157688
comment on: http://stackoverflow.com/a/26189466
type: AnswerComment
has text: @giannisapi, You are right. Now I understand that what you exactly want to do is to fetch all documents in which none of elements of `occupied` falls into the specified date range. Correct? Your original explanation is so cool that I failed to caught it. :) I add another answer for you.
score: 0
type: Comment

http://stackoverflow.com/q/26189167
linked to: http://stackoverflow.com/q/22310414
upvote count: 6
has answer: http://stackoverflow.com/a/26218749
has answer: http://stackoverflow.com/a/27808797
answer count: 3
linked to: http://stackoverflow.com/q/3418865
downvote count: 0
has answer: http://stackoverflow.com/a/26190380
has comment: http://stackoverflow.com/comment/41066287
favorite count: 0
score: 6
tagged with: maven
type: AnsweredQuestion
has body: I downloaded Eclipse Luna and imported a stable existing Maven project which makes use of the @Getter and @Setter lombok annotations. The annotations are recognized, but Eclipse flags any calls to the getter or setter methods giving the error message The method getSomething() is undefined for the type Foo Unlike other stackoverflow questions, like this, I am experiencing this issue despite the fact that I have updated my eclipse.ini, and added the lombok.jar to the same directory as my eclipse.exe and eclipse.ini file. The eclipse.ini changes made no difference though, I still have error markets everywhere! eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -javaagent:lombok.jar -Xbootclasspath/a:lombok.jar I have done a project > clean, I have tried using the full path to my lombok jar, I have exited and restarted Eclipse all to no avail. What am I missing here? Thanks for any help!!!
tagged with: java
has comment: http://stackoverflow.com/comment/41076688
has comment: http://stackoverflow.com/comment/41106541
accepted answer: http://stackoverflow.com/a/26218749
has title: ProjectLombok - Method Undefined in Eclipse After Installing Eclipse Luna
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/26190380
type: Question
tagged with: lombok

http://stackoverflow.com/comment/41046552
score: 0
type: Comment
type: QuestionComment
has text: Check this [SO question](http://stackoverflow.com/questions/25569365/some-transaction-propagations-not-working-with-spring-hibernate-4).
comment on: http://stackoverflow.com/q/26179159

http://stackoverflow.com/comment/41011134
score: 1
type: Comment
comment on: http://stackoverflow.com/q/26159993
type: QuestionComment
has text: How about this: Group the numbers in the list into different sets: Numbers with a 1 at first position, numbers with a 2 at first position, numbers with a 7 at third position, etc. Once you have this, the rest is finding set intersections. You will have 70 such sets, but it might be worth it if you have to do many such lookups for the same list of numbers.

http://stackoverflow.com/q/26177874
has comment: http://stackoverflow.com/comment/41043501
has comment: http://stackoverflow.com/comment/41043784
has answer: http://stackoverflow.com/a/26239980
has body: I am new in using keystores, is there a way to create a keystore when I have cert file and a private key in pem format? Please help keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(null, pwd.toCharArray()); String privKeyPEM= privateKey.replace("-----BEGIN RSA PRIVATE KEY-----\r\n",""); privKeyPEM = privKeyPEM.replace("\r\n-----END RSA PRIVATE KEY-----",""); byte [] encoded = Base64.decode(privKeyPEM); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded); KeyFactory kf = KeyFactory.getInstance("RSA"); PrivateKey privKey = kf.generatePrivate(keySpec); It fails here kf.generatePrivate(keySpec). and I got: algid parse error, not a sequence. the rest of the code: KeyStore.PrivateKeyEntry entry = new KeyStore.PrivateKeyEntry(privKey, new Certificate[ {certificate}); keyStore.setEntry(keyStoreAlias,entry , new KeyStore.PasswordProtection(pwd.toCharArray()));
type: Question
has title: Import private key from pem file into keystore
has comment: http://stackoverflow.com/comment/41045141
has comment: http://stackoverflow.com/comment/41043601
score: 0
has comment: http://stackoverflow.com/comment/41086974
has comment: http://stackoverflow.com/comment/41044572
accepted answer: http://stackoverflow.com/a/26239980
answer count: 1
has comment: http://stackoverflow.com/comment/41045281
has comment: http://stackoverflow.com/comment/41044991
has comment: http://stackoverflow.com/comment/41044799
tagged with: keystore
has comment: http://stackoverflow.com/comment/41044846
has comment: http://stackoverflow.com/comment/41049404
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41043539
tagged with: java

http://stackoverflow.com/q/26184082
has answer: http://stackoverflow.com/a/26188501
tagged with: jsp-tags
has title: Can not implement JSTL with new classpath
has body: I have a big problem to implement my jsp pages. I'm using Spring 4 with theoretically JSTL 1.2 + Servlet 3.0 in STS (Eclipse Luna) - Tomcat 7. I saw the article posted here, however I could not solve. &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; This url is recognized by the STS IDE (Eclipse). However when I try to open the page displays the error: /views/root/index.jsp(1,63) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application src/main/webapp/WEB-INF/web.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"&gt; &lt;view-state id="start"&gt; &lt;/view-state&gt; &lt;/flow&gt; src/main/webapp/WEB-INF/lib javax.servlet.jsp.jstl-1.2.1.jar javax.servlet.jsp.jstl-api-1.2.1.jar Trying with another approach: &lt;%@ taglib prefix="c" uri="http://xmlns.jcp.org/jsp/jstl/core" %&gt; This url is not recognized by the Eclipse IDE. Accusing error in project. &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core"&gt; As some libs who put in pom.xml (maven) the url in that line is recognized, however nothing happens in the browser. PS: Spring in all four projects say they no longer need the file "web.xml" and try to put some tutorials to follow, again accuses the eclipse error.
type: AnsweredQuestion
tagged with: facelets
tagged with: taglib
tagged with: java
accepted answer: http://stackoverflow.com/a/26188501
type: Question
tagged with: jstl
answer count: 1
score: 0

http://stackoverflow.com/a/26072373
type: Answer
score: 1
upvote count: 1
has body: I feel there is a better way to handle this scenario which obviates the use of AsyncTask. Instead a Filter can be used, which provides performFiltering() callback that actually runs in a worker thread. Here the matching data can be decided / prepared (like by a server call or similar). When the results are prepared the publishResults callback which runs on UI thread, can be used to modifiy the list backing the Custom Adapter. I am just beginning to understand the Android Adapters so I may be incorrect here though. Here is the code that I am using public class LocalityListAdapter extends ArrayAdapter&lt;Locality&gt; { List&lt;Locality&gt; localities; @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.locality_row, null); } Locality currentLocality = localities.get(position); if (currentLocality != null) { TextView txvLocalityName = (TextView) view.findViewById(R.id.txvLocalityName); txvLocalityName.setText(currentLocality.getName()); } return view; } @Override public Filter getFilter() { return localityFilter; } Filter localityFilter = new Filter() { @Override public CharSequence convertResultToString(Object resultValue) { Locality locality = (Locality) resultValue; return locality.getName(); } protected FilterResults performFiltering(CharSequence constraint) { List&lt;Locality&gt; localityList = new ArrayList&lt;Locality&gt;(); ...Get Data from Server //Return FilterResults created from response FilterResults filterResults = new FilterResults(); filterResults.values = localityList; filterResults.count = localityList.size(); return filterResults; } @Override protected void publishResults(CharSequence charSequence, FilterResults filterResults) { localities.clear(); List&lt;Locality&gt; filteredList = (List&lt;Locality&gt;) filterResults.values; for(Localit…
downvote count: 0
answers question: http://stackoverflow.com/q/26059450

http://stackoverflow.com/q/26093109
accepted answer: http://stackoverflow.com/a/26093138
has title: Display answer once
has body: So my assignment for programming is to make a program that reads ten user inputs and then informs the user which one is of the highest value. As shown below, it does that perfectly and I got 100% on the assignment. However, I want to polish the coding structure so that every time when the user enters a bigger value after being prompted to do so, (such as 0,1,2,3,4,5,6,7,8,9) the output would not be displayed 1,2,3,4,5,6,7,8 and 9; with 9 being the final output. How can I get rid of all the values preceding 9 so that the output would just be 9? import java.util.Scanner; class Army{ public static void main(String[] args){ // declares an array of doubles double[] inputArray = new double[10]; // allocates memory for 10 doubles System.out.println("Please enter ten numbers."); try { Scanner in = new Scanner(System.in); for (int j = 0; j &lt; inputArray.length ; j++) { inputArray[(int) j] = in.nextDouble(); } } catch (Exception e) { e.printStackTrace(); } double maxValue = inputArray[0]; for (int i=0; i &lt; inputArray.length; i++) { if (inputArray[i] &gt; maxValue){ maxValue = inputArray[i]; System.out.println("The largest number is "+maxValue+"."); }else{ System.out.println("The largest number is "+inputArray[i]+"."); // optional: display only one answer. } } } }
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26093138
type: Question
tagged with: max
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26160203
tagged with: http://stackoverflow.com/tag/xml
score: 2
answer count: 0
has body: I'm using Simple framework deserialize an xml into an object, modify it and serialize it again. The xml I provide is a configuration xml with comments and some unused nodes. I would like to be able to serialize or "update" the xml with the values without making it remove the comments or the unused nodes. I was able to do it with EclipseLink JAXB (MOXy) as mentioned here: http://blog.bdoughan.com/2010/09/jaxb-xml-infoset-preservation.html But now I'm making an android application and JAXB is not supported so I've switched to simple but I can't seem to find a way to make it. Can I do it with simple? or somehow using android? without having to manually read DOM and update nodes manually?
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: jaxb
downvote count: 0
favorite count: 0
tagged with: serialization
tagged with: simple-framework
has title: simple-xml preserve comments and ignored elements on deserialization/serialization

http://stackoverflow.com/comment/41047128
has text: @Neil:Do not feel offended. :) I have not thougth about this, but you are just halfway right, so in 2.6: http://docs.mongodb.org/manual/reference/operator/query/or/#or-and-sort-operations so this is new in 2.6. in earlier versions either the individual clauses supported by the index or the sort itself : http://docs.mongodb.org/v2.4/reference/operator/query/or/ Feel free to ask as one would say.
type: Comment
comment on: http://stackoverflow.com/q/26178428
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41062857
type: Comment
comment on: http://stackoverflow.com/a/26186497
has text: Basically what I was testing the most were a bunch of for loops that would preform the logic to accomplish this. The main reason why I don't want to go w/ a map is because I don't want to say "mymap.add( ... )" over and over again, or have a for loop do it for me that uses data from the arrays I've already set up and put said data in the map.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26154108
tagged with: java
has comment: http://stackoverflow.com/comment/40999820
has comment: http://stackoverflow.com/comment/41001013
type: Question
tagged with: sorting
score: 0
tagged with: char
has comment: http://stackoverflow.com/comment/40999825
has title: quicksort doesn't sort string with many letters
upvote count: 1
downvote count: 1
tagged with: string
favorite count: 0
has body: I've been trying to do a program that sorts characters from a string in alphabetical order. It works with short words, but when I tried to input word such as : abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz. It doesn't sort it at all. Can somebody help me to improve my code? Here is my code: public class quicky{ public static void partition(char[] a,int low, int high){ int i = low; int j = high; char tmp; int pivot = i+(j-i)/2; while (i &lt;= j) { while(a[i] &lt; a[pivot]){ i++; } while(a[j] &gt; a[pivot]){ j--; } if(i &lt;= j) { tmp = a[i]; a[i] = a[j]; a[j] = tmp; i++; j--; } } if(low &lt; j){ partition(a, low, j); } if(i &lt; high){ partition(a, i,high); } } public Character[] toCharArray( String s ) { int len = s.length(); Character[] array = new Character[len]; for (int i = 0; i &lt; len ; i++) { array[i] = new Character(s.charAt(i)); } return array; } public static void main(String[] args) { String input = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; String output = quicksort(input); System.out.print(output); } public static String quicksort(String y) { int length = y.length(); int i = 0; int j = length-1; char[] a = y.toCharArray(); partition(a,i,j); String x=new String(a); return x; } }
answer count: 0
type: UnansweredQuestion
tagged with: quicksort
has comment: http://stackoverflow.com/comment/40999945

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26043883
tags question: http://stackoverflow.com/q/26070746
tags question: http://stackoverflow.com/q/26166751
tags question: http://stackoverflow.com/q/26108513
tags question: http://stackoverflow.com/q/26113512
tags question: http://stackoverflow.com/q/26064658
tags question: http://stackoverflow.com/q/26115927
tags question: http://stackoverflow.com/q/26123895
tags question: http://stackoverflow.com/q/26125420
tags question: http://stackoverflow.com/q/26093211
tags question: http://stackoverflow.com/q/26107483
tags question: http://stackoverflow.com/q/26148677
tags question: http://stackoverflow.com/q/26147041
tags question: http://stackoverflow.com/q/26113314
tags question: http://stackoverflow.com/q/26134482
tags question: http://stackoverflow.com/q/26179622
type: Tag
tags question: http://stackoverflow.com/q/26193892
tags question: http://stackoverflow.com/q/26178839
tags question: http://stackoverflow.com/q/26136933
tags question: http://stackoverflow.com/q/26112569
tags question: http://stackoverflow.com/q/26107727
tags question: http://stackoverflow.com/q/26152547
tags question: http://stackoverflow.com/q/26073244
tags question: http://stackoverflow.com/q/26131143
tags question: http://stackoverflow.com/q/26046608
tags question: http://stackoverflow.com/q/26125655
tags question: http://stackoverflow.com/q/26158956
tags question: http://stackoverflow.com/q/26097314
tags question: http://stackoverflow.com/q/26094783
tags question: http://stackoverflow.com/q/26071574
tags question: http://stackoverflow.com/q/26169323
tags question: http://stackoverflow.com/q/26159679
tags question: http://stackoverflow.com/q/26070562
tags question: http://stackoverflow.com/q/26192967
tags question: http://stackoverflow.com/q/26068837
tags question: http://stackoverflow.com/q/26056598
tags question: http://stackoverflow.com/q/26192854
tags question: http://stackoverflow.com/q/26182861
tags question: http://stackoverflow.com/q/26178119
tags question: http://stackoverflow.com/q/26072170
tags question: http://stackoverflow.com/q/26076082
tags question: http://stackoverflow.com/q/26050047
tags question: http://stackoverflow.com/q/26064954
tags question: http://stackoverflow.com/q/26147085
tags question: http://stackoverflow.com/q/26051247
tags question: http://stackoverflow.com/q/26087860
tags question: http://stackoverflow.com/q/26142984
tags question: http://stackoverflow.com/q/26081138
tags question: http://stackoverflow.com/q/26048524
tags question: http://stackoverflow.com/q/26137510
tags question: http://stackoverflow.com/q/26050513
tags question: http://stackoverflow.com/q/26062115
tags question: http://stackoverflow.com/q/26189124
tags question: http://stackoverflow.com/q/26074166
tags question: http://stackoverflow.com/q/26046112
tags question: http://stackoverflow.com/q/26189173
tags question: http://stackoverflow.com/q/26076523
tags question: http://stackoverflow.com/q/26183053
tag name: xml
tags question: http://stackoverflow.com/q/26142278
tags question: http://stackoverflow.com/q/26152073
tags question: http://stackoverflow.com/q/26075103
tags question: http://stackoverflow.com/q/26097760
tags question: http://stackoverflow.com/q/26155718
tags question: http://stackoverflow.com/q/26128560
tags question: http://stackoverflow.com/q/26183228
tags question: http://stackoverflow.com/q/26182517
tags question: http://stackoverflow.com/q/26065326
tags question: http://stackoverflow.com/q/26141586
tags question: http://stackoverflow.com/q/26156293
tags question: http://stackoverflow.com/q/26137303
tags question: http://stackoverflow.com/q/26082435
tags question: http://stackoverflow.com/q/26156427
tags question: http://stackoverflow.com/q/26171016
tags question: http://stackoverflow.com/q/26147896
tags question: http://stackoverflow.com/q/26082319
tags question: http://stackoverflow.com/q/26173100
tags question: http://stackoverflow.com/q/26034506
tags question: http://stackoverflow.com/q/26042188

http://stackoverflow.com/comment/40887112
score: 0
type: Comment
has text: @MarkoTopolnik: the answer from your link gave me the solution, which I'll answer below. Thanks.
type: QuestionComment
comment on: http://stackoverflow.com/q/26088763

http://stackoverflow.com/comment/41049404
comment on: http://stackoverflow.com/q/26177874
has text: this is a long shot, but the last time I needed encryption on runtime with no ks, I used the bouncy castle encrypt library.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26094408
tagged with: java
linked to: http://stackoverflow.com/q/4668218
has comment: http://stackoverflow.com/comment/40890986
has comment: http://stackoverflow.com/comment/40894298
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/46092207
score: 0
has title: Eclipse Sort Members uses wrong order
answer count: 0
type: UnansweredQuestion
tagged with: coding-style
has body: Eclipse always places static methods before static fields even though the order in Member Sort Order says static fields before static methods. Has anyone encountered and solved this issue?
has comment: http://stackoverflow.com/comment/40893022

http://stackoverflow.com/q/26129697
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/42129798
has answer: http://stackoverflow.com/a/26190955
has comment: http://stackoverflow.com/comment/40955014
has comment: http://stackoverflow.com/comment/40956935
has answer: http://stackoverflow.com/a/50495145
has title: Why Retrofit cannot encode properly query string with square brackets?
accepted answer: http://stackoverflow.com/a/26190955
tagged with: retrofit
has body: I'm using Retrofit for my network layer in my Android app, but I have a problem with the URL encoding. I have to call an REST API like that: https://my_hostname.com/some_path?q=some_query&amp;param[0]=value1&amp;param[1]=value2&amp;other_param=abcd as you can see the query string is composed by some different kind of parameters, so I decided to use the @QueryMap annotation in the Retrofit Interface with a Map&lt;String, String&gt; where q, param[1], param[0], other_param are String keys of the map What do I expect? I expect the square brackets in the URL are encoded with %5B for '[' and %5D for '[', but this does not happen. Why does this happen? The square brackets should be encoded with percent encoding. Is this a bug or I'm doing something wrong? I also tried the @EncodedQueryMap annotation with no differences.
downvote count: 0
possible better answer: http://stackoverflow.com/a/50495145
favorite count: 0
score: 9
tagged with: android
has comment: http://stackoverflow.com/comment/40964213
answer count: 4
type: AnsweredQuestion
tagged with: urlencode
tagged with: java
has answer: http://stackoverflow.com/a/49815565

http://stackoverflow.com/comment/40922229
score: 0
comment on: http://stackoverflow.com/a/26111873
type: Comment
type: AnswerComment
has text: The file object mainly provided the location info, and wasn't itself "open".

http://stackoverflow.com/q/26113394
has comment: http://stackoverflow.com/comment/40925077
has comment: http://stackoverflow.com/comment/40924780
answer count: 1
has comment: http://stackoverflow.com/comment/40925172
favorite count: 0
has answer: http://stackoverflow.com/a/26113791
has comment: http://stackoverflow.com/comment/40974855
tagged with: decompiler
has title: java operator `+` and `StringBuilder.append`
has body: It was said that when I use + operator to concat String it later transforms into StringBuilder.append but when I ran Java Decompiler GUI and opened MainClass.class there was public class MainClass { public static void main(String[] paramArrayOfString) { String str1 = "abc"; String str2 = "def"; String str3 = str1 + str2; } } when the original was public class MainClass { public static void main(String[] args) { String val1 = "abc"; String val2 = "def"; String res = val1 + val2; } } What is wrong? I compiled it using javac MainClass.java
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40924958
tagged with: java
has comment: http://stackoverflow.com/comment/40924888
accepted answer: http://stackoverflow.com/a/26113791
downvote count: 1
type: Question
upvote count: 4

http://stackoverflow.com/comment/40887784
type: Comment
has text: @Hovercraft Full Of Eels "Other issues: You're using null layout and setBounds — Don't." what layout would be best for me to use? and how to avoid using setbound if we want to set the jframe or button to the size we desire
comment on: http://stackoverflow.com/a/26092017
score: 0
type: AnswerComment

http://stackoverflow.com/a/26149476
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26149289
has body: do like this: public static void main(String[] args) { String str= "[1,2,3]"; String []arr=str.substring(1, str.length()-1).split(","); List&lt;Long&gt;list=new ArrayList&lt;Long&gt;(); for(int i=0;i&lt;arr.length;i++){ list.add(Long.parseLong(arr[i])); } System.out.println(list); }

http://stackoverflow.com/q/26171583
type: UnansweredQuestion
tagged with: java
tagged with: lwjgl
linked to: http://stackoverflow.com/q/122160
has comment: http://stackoverflow.com/comment/41032924
type: Question
has comment: http://stackoverflow.com/comment/41032764
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41032713
score: 0
has answer: http://stackoverflow.com/a/26237624
answer count: 1
has title: Every Class File from LWJGL has no source
has body: I just installed LWJGL and I selected lwjgl.jar, it loaded all the classes but when i click on one, it just says "This class has no source" Please help!

http://stackoverflow.com/a/26169805
has comment: http://stackoverflow.com/comment/41038742
has body: First of all curly bracket("{ }") block not require after String str where you place your if/else condition; So try to remove that bracket set { }. According to your question "My question is, why can't I do another if-statement after else if or if condition". You can do if or else if statement after the if condition. For example (just a syntax not any specific code) - it will compile public void test() { int i =0 ; int j=1; if(i==1) { System.out.println("print--"+i); // goes more logic or conditions here } else if (j==1) { System.out.println("print--"+j); // goes more logic or conditions here } if(i==0) { System.out.println("print--"+i); // goes more logic or conditions here } else { // goes more logic or conditions here } if(true) { // goes more logic or conditions here } }
type: Answer
answers question: http://stackoverflow.com/q/26166542
score: 0

http://stackoverflow.com/q/26068865
tagged with: jooq
has title: Generating a schema from the JOOQ Metamodel in a different SQLDialect
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26105276
upvote count: 2
tagged with: dialect
tagged with: ddl
tagged with: java
type: Question
tagged with: database
has body: I'm considering using jOOQ as a typesafe, DB dialect independent SQL generator, as I need to create a small database DDL script and a large number of INSERT- and UPDATE-statements on the fly from within a larger application. We then provide the file(s) as a download. I've created the initial DB schema manually in MySQL and generated jOOQ classes to work with it. Currently, JOOQ is used to generate a bunch of inserts into an empty MySql schema). This works fine. I would like to offer the user a selection of different DB schemes to export to: sqlite, MySQL/Maria, Postgres, and if the license is commercial, then maybe Access, Oracle etc. e.g. List&lt;DSLContext&gt; dbdialects = new ArrayList&lt;DSLContext&gt;(); dbdialects.add(using(SQLDialect.MYSQL)); dbdialects.add(using(SQLDialect.FIREBIRD)); dbdialects.add(using(SQLDialect.SQLITE)); //other dialects including MS Access available via commercial license. for (DSLContext create : dbdialects) { String dialect = create.configuration().dialect().toString(); String sql = create.insertInto(EMPLOYEES) .set(EMPLOYEES.FIRST_NAME, fn) .set(EMPLOYEES.LAST_NAME, ln) .getSQL(ParamType.INLINED); System.out.println(dialect + "\t" + sql); } Of course, I can recreate the base schema by hand for each RDBMS, but this is tedious, error prone and it seems superfluous: is there not a clever way to use the generated Metamodel from jOOQ that I created with my MySQL DB schema to generate the schema for the other SQL dialects?
accepted answer: http://stackoverflow.com/a/26105276
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41131236
has text: Just forgotten it since it is unusual. The head would actually be expected to be `myList` in such a call.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26191319
type: Comment

http://stackoverflow.com/q/26086443
type: UnansweredQuestion
has title: Junit testing play framework
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26116648
tagged with: security
score: 0
tagged with: playframework
has body: I need to test controllers that are secured with: @Security.Authenticated(Secured.class). Even after i log in i get unauthorized,i read that i need to copy the cookie from the log in response and send it with every request to secured method. tried that without any luck. any idea how to solve that?
answer count: 1
tagged with: junit

http://stackoverflow.com/comment/40908765
type: Comment
has text: Let me reformulate: I want to know where i add the viewpager, if it's in a new class, or if i sohuld add it in a current FragmentActivity. btw.I have read that, and it didnt make me much wiser.
comment on: http://stackoverflow.com/q/26104219
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40969016
has text: Are you using any client library or you have written the code to execute redis command ? Use Jedis to write your consumer and then see if you still face issues
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26136413

http://stackoverflow.com/a/26181831
answers question: http://stackoverflow.com/q/26181462
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Please note that AsyncTask.cancel() does not really cancel running task. Instead it only sets a flag to notify that cancel has been requested. It is up to AsyncTask implementation if and when to take this flag into account. Your current code does not check for cancellation after Thread.sleep returns. Correct implementation would be something like: public Void doInBackground(Long... params){ mRemindTime = params[0]; while (!isCancelled()){ try{ Thread.sleep(mRemindTime); if(!isCancelled()) publishProgress(); } catch (Exception e){ e.printStackTrace(); } } return null; } Also attribute 'running' and onCancelled() method in your asynctask are not needed. You can use method 'isCancelled()' instead.

http://stackoverflow.com/a/28587761
accepted answer of: http://stackoverflow.com/q/26049329
answers question: http://stackoverflow.com/q/26049329
upvote count: 30
type: Answer
has body: For those two particular cases, I think the recommended action is to substitute them with &lt;p&gt;. This is the link to the Oracle documentation.
has comment: http://stackoverflow.com/comment/63660674
score: 29
downvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26147123
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/7175509
upvote count: 7
type: Question
linked to: http://stackoverflow.com/q/16951609
has body: I have created two test methods in my MVC Controller class. In the first method the Model is being passed as an argument and in the second one I instantiate it directly. In both methods I add a single attribute to the Model instance: @RequestMapping("/test-modelParam") public String testMethod1(Model model) { model.addAttribute("testname", "testvalue"); return "/testview"; } @RequestMapping("/test-modelInstantiatedExplicitly") public ModelAndView testMethod2() { ModelAndView mav = new ModelAndView("/testview"); mav.addObject("testname", "testvalue"); return mav; } The View gets populated correctly in both cases. Is there any difference between the two approaches? If so, Where is it preferred to use one over the other?
has title: Spring MVC: Passing a Model as an argument to a controller method VS instantiating it explicitly
has comment: http://stackoverflow.com/comment/40989809
has answer: http://stackoverflow.com/a/26263194
has comment: http://stackoverflow.com/comment/41001629
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26263194
has comment: http://stackoverflow.com/comment/40986783
favorite count: 0
has comment: http://stackoverflow.com/comment/41001240
has comment: http://stackoverflow.com/comment/41195731
tagged with: spring
has comment: http://stackoverflow.com/comment/40995910
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40995853

http://stackoverflow.com/a/26071791
type: Answer
answers question: http://stackoverflow.com/q/26071393
score: 1
upvote count: 1
has body: My advice is to create a subclass of TreeNode, and override the method equals. (Inside the TreeNode you save your string). And i think with this you can use the DefaultTreeModel of java.
downvote count: 0

http://stackoverflow.com/q/26043713
has answer: http://stackoverflow.com/a/26043750
has comment: http://stackoverflow.com/comment/40797785
score: 0
has answer: http://stackoverflow.com/a/26043769
has answer: http://stackoverflow.com/a/26044009
has title: java enums - cannot convert from MyClass.Result to int
answer count: 4
possible better answer: http://stackoverflow.com/a/26043822
accepted answer: http://stackoverflow.com/a/26043750
has answer: http://stackoverflow.com/a/26043822
tagged with: value-of
has body: I have issues storing an enum value and then querying it via the toString() method. I require to handcode the numbers. How do I safely override my toString() ? public enum Result { SUCCESS(0), INVALID_UPLOAD_KEY(-20), UPLOAD_KEY_NOT_FOUND(-80); private final int value; //do I need this? private Result(int value) { this.value = value; } public static Result fromInt(final int n) { for (final Result result : values()) { if (result.getValue() == n) { return result; } } return null; } public int getValue() { return this.value; } public String toString() { switch (this.value) { case UPLOAD_KEY_NOT_FOUND: //Type mismatch: cannot convert from MyClass.Result to int return "Upload Key not found"; case INVALID_UPLOAD_KEY: //Type mismatch: cannot convert from MyClass.Result to int return "Invalid Upload Key"; case SUCCESS: //Type mismatch: cannot convert from MyClass.Result to int return "Success"; default: return "No result code associated with: " + this.value; } } } Eclipse complains the toString method Type mismatch: cannot convert from MyClass.Result to int
tagged with: tostring
type: AnsweredQuestion
tagged with: enums
tagged with: java
type: Question

http://stackoverflow.com/a/26170495
type: Answer
accepted answer of: http://stackoverflow.com/q/26170406
answers question: http://stackoverflow.com/q/26170406
score: 2
has body: For me I always use the m2e (First option) to import maven projects to Eclipse workspace. And for the second option Right click on the project go to configure then "convert to Maven project", the project will be treated as a Maven project.
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/26093352
has comment: http://stackoverflow.com/comment/40890256
has comment: http://stackoverflow.com/comment/40892246
has body: You can use it as : JSONArray jsonArray = data; //here data is JSON array you are getting from any source You need to add JSONExceptionbecause when we getJSONObjectfromJSONArray` it can throw error so. then just iterate it : for( int i = 0 ; i &lt; jsonArray.length() ; i++ ){ try { JSONObject object = jsonArray.getJSONObject(i); if( ! object.isNull("test") ){ JSONObject j = object.getJSONObject("test"); System.out.println(j.getString("page")); System.out.println(j.getString("ms")); } if( ! object.isNull("check") ){ JSONObject j = object.getJSONObject("check"); System.out.println(j.getString("page")); System.out.println(j.getString("ms")); } } catch (JSONException e) { e.printStackTrace(); } } Still problem then post me.
has comment: http://stackoverflow.com/comment/40894155
type: Answer
has comment: http://stackoverflow.com/comment/40892053
has comment: http://stackoverflow.com/comment/40889175
has comment: http://stackoverflow.com/comment/40890225
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26093211
has comment: http://stackoverflow.com/comment/40891117
has comment: http://stackoverflow.com/comment/40889867
has comment: http://stackoverflow.com/comment/40890535
has comment: http://stackoverflow.com/comment/40889573
score: 2
has comment: http://stackoverflow.com/comment/40890363
has comment: http://stackoverflow.com/comment/40891919
has comment: http://stackoverflow.com/comment/40891350
has comment: http://stackoverflow.com/comment/40889963
answers question: http://stackoverflow.com/q/26093211
has comment: http://stackoverflow.com/comment/40889463
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26048859
has comment: http://stackoverflow.com/comment/40810747
has comment: http://stackoverflow.com/comment/40808031
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40807597
has body: You are not calling the protected method from a sub-class, but from a static method. The fact that the static method is defined in the sub-class is irrelevant. Edit: Thanks! So based on the responses, are you saying, this would have worked in the sub class That new updated code has two problems: - Your PlatForm class has no default constructor, so you need to call the super constructor and pass the arguments - The fields you are trying to assign are final. They will already be set by your super class constructor.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26048818
has comment: http://stackoverflow.com/comment/40812881
has comment: http://stackoverflow.com/comment/40807375

http://stackoverflow.com/comment/40859230
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26075351
has text: then you missed to clean out the MDC after the request has been processed.

http://stackoverflow.com/q/26115076
tagged with: rest
possible better answer: http://stackoverflow.com/a/26115202
tagged with: spring
answer count: 4
has body: I have some JSON Objects that are more complex than the JSON representations of the java objects I have. I have methods that build these JSON Objects and I would like to return and consume these directly. I use org.json library to build my JSONs. I could get the GET method working by returning the JSON Object as a String. Is this the correct way to go about it? @RequestMapping(value = "/getjson", method = RequestMethod.GET, produces="application/json") @ResponseBody public String getJson() { JSONObject json = new JSONObject(); JSONObject subJson = new JSONObject(); subJson .put("key", "value"); json.put("key", subJson); return json.toString(); } Now I want to know how do I consume a JSON Object? As a string and convert it to a JSON Object? @RequestMapping(value = "/post", method = RequestMethod.POST, produces="application/json", consumes="application/json") @ResponseBody public String post(@RequestBody String json) { JSONObject obj = new JSONObject(json); //do some things with json, put some header information in json return obj.toString(); } Is this the correct way to go about my problem? I am a novice, so kindly point out anything that can be done better. Please note: I do not want to return POJOs.
linked to: http://stackoverflow.com/q/10420040
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26115385
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26115393
type: Question
score: 20
upvote count: 20
tagged with: post
linked to: http://stackoverflow.com/q/4823358
accepted answer: http://stackoverflow.com/a/26115393
has answer: http://stackoverflow.com/a/53238029
has title: Producing and consuming custom JSON Objects in Spring RESTful services
downvote count: 0
has answer: http://stackoverflow.com/a/26115202
favorite count: 0

http://stackoverflow.com/comment/41066202
type: QuestionComment
has text: There's also a [`dateFilter`](http://docs.oracle.com/javase/7/docs/api/javax/swing/RowFilter.html#dateFilter%28javax.swing.RowFilter.ComparisonType,%20java.util.Date,%20int...%29)
score: 0
comment on: http://stackoverflow.com/q/26185675
type: Comment

http://stackoverflow.com/q/26047161
tagged with: jsoup
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: parsing
has title: Jsoup -- iterate over multiple elements simultaneously?
type: UnansweredQuestion
has body: I am attempting to convert an html page with entries that have multiple types of details (e.g. name, phone number, and address), into a spreadsheet. I am able to to isolate each of these details as Elements, but I cannot seem to find a way to iterate over multiple Elements at once to print names and phone numbers next to one another rather than having all the names printed and then all of the phone numbers printed. Jsoup.connect(page).timeout(999999); Document doc = Jsoup.connect(page).get(); String title = doc.title(); System.out.println(title); Elements names = doc.select("li a"); Elements ratings = doc.select("li img"); for (Element name:names){ if (name.attr("href").startsWith("/biz/")){ System.out.println(name.text()); } for (Element rating:ratings){ System.out.println(rating.attr("alt")); }
has comment: http://stackoverflow.com/comment/40805594
has answer: http://stackoverflow.com/a/26048400
tagged with: java
type: Question

http://stackoverflow.com/comment/40974171
score: 0
has text: This is a Java coding question.
comment on: http://stackoverflow.com/q/26140630
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40908586
type: QuestionComment
comment on: http://stackoverflow.com/q/26104219
has text: From what i see above you are not trying to create a view pager, there is no view pager code, please could you add it
score: 0
type: Comment

http://stackoverflow.com/comment/40968014
type: Comment
comment on: http://stackoverflow.com/a/26136281
type: AnswerComment
has text: Your link appears to be almost the same page as I referenced in the original post. I tried that but did not succeed because apparently this technique is not applicable for primitives (search for "primitives" in your page or see quote from the original post).
score: 0

http://stackoverflow.com/q/26114562
has comment: http://stackoverflow.com/comment/40931899
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26134323
tagged with: java
tagged with: selenium
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40962921
has comment: http://stackoverflow.com/comment/40930954
has title: How to make the opening of browser(all test in one browser) static in testng for selenium
tagged with: automation
accepted answer: http://stackoverflow.com/a/26134323
downvote count: 0
answer count: 1
favorite count: 0
has body: I am using selenium and testNG framework for my project. Now what is happening is each class is opening up a browser and then run its methods, eg, if I have five classes, then five browsers will open simultaneously and then run the tests. I want to Open Browser at the start once and run all the methods and then close it. public class openSite { public static WebDriver driver; @test public void openMain() { System.setProperty("webdriver.chrome.driver","E:/drive/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://vtu.ac.in/"); } @test //Clicking on the first link on the page public void aboutVTU() { driver.findElement(By.id("menu-item-323")).click(); } @Test //clicking on the 2nd link in the page public void Institutes() { driver.findElement(By.id("menu-item-325")).click(); } Now What I want is the testNG should open browser once and open vtu.ac.in once and then execute the methods aboutVTU and Institutes and give me the result

http://stackoverflow.com/comment/40811692
type: Comment
type: QuestionComment
has text: `winEvaluation` != `evaluate`. Please post real code.
comment on: http://stackoverflow.com/q/26051186
score: 0

http://stackoverflow.com/q/26143959
has comment: http://stackoverflow.com/comment/40981012
has answer: http://stackoverflow.com/a/26144252
favorite count: 0
has body: package main; import java.util.Arrays; import javax.swing.*; public class TweetTester { public static void main(String[] args) { String tweet= JOptionPane.showInputDialog("Please enter a tweet:\n(Hashtags should be represented as #hashtags and mentions should be represented by @mentions)"); int length = tweet.length(); if (length&lt;=140) { String[] splited = tweet.split("\\b+"); //split on space if(Arrays.asList(splited).contains("#")) { int index = tweet.indexOf("#"); int count = 0; while (index != -1) { count++; tweet = tweet.substring(index + 1); index = tweet.indexOf("#"); } System.out.println("No of *#* in the input is : " + count); } if(Arrays.asList(splited).contains("@")) { int index = tweet.indexOf("@"); int count2 = 0; while (index != -1) { count2++; tweet = tweet.substring(index + 1); index = tweet.indexOf("@"); } System.out.println("No of *@* in the input is : " + count2); } if(Arrays.asList(splited).contains("http://")) { int index = tweet.indexOf("http://"); int count3 = 0; while (index != -1) { count3++; tweet = tweet.substring(index + 1); index = tweet.indexOf("http://"); } System.out.println("No of *http://* in the input is : " + count3); } //JOptionPane.showMessageDialog(null, (140 - length)+" Charcters Left\n"+"Tweet:\n"+tweet+"\nLength Correct"+ "number of #:"+count); } if (length&gt;140 ){ JOptionPane.showMessageDialog(null,"Excess Characters: "+(length-140)); } } }
has answer: http://stackoverflow.com/a/26144281
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40980927
has comment: http://stackoverflow.com/comment/40980883
tagged with: java
has title: Not going through each if statement
downvote count: 3
has comment: http://stackoverflow.com/comment/40981172
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40980717
answer count: 2
has comment: http://stackoverflow.com/comment/40980603
upvote count: 0
has comment: http://stackoverflow.com/comment/40981071
has comment: http://stackoverflow.com/comment/40981048

http://stackoverflow.com/comment/67825298
comment on: http://stackoverflow.com/a/26164155
type: Comment
score: 2
has text: @Blaisorblade: that would be an alternative implementation and the unavoidable code duplication would be minimal, so, yes, that would be an option. But for the users of the class, it doesn’t make a difference anyway. Note that the JRE implementors decided not to create `EmptyOptional` and `NonEmptyOptional` implementation classes, but use conditionals internally. That likely reduces the MetaSpace consumption, however, I think the technical differences are too small to call one approach superor to the other. I wrote this class ad-hoc two years ago and there surely are alternatives…
type: AnswerComment

http://stackoverflow.com/comment/40977114
has text: I've modified my code but it does not prompt notification at all.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26141612
type: Comment

http://stackoverflow.com/a/26050647
score: 1
answers question: http://stackoverflow.com/q/26050551
upvote count: 1
has body: If the hyphen (-) is always constant before the dimensions, you could use the following. url = url.replaceAll("-\\d+x\\d+", ""); // http://techdissected.com/wp-content/uploads/2014/09/google-fiber-rabbit-11.jpg?6da9e4 To remove both the dimension and the trailing query: url = url.replaceAll("-\\d+x\\d+|\\?.*", ""); // http://techdissected.com/wp-content/uploads/2014/09/google-fiber-rabbit-11.jpg
type: Answer
downvote count: 0

http://stackoverflow.com/q/26172967
has answer: http://stackoverflow.com/a/26172999
has answer: http://stackoverflow.com/a/26185497
has comment: http://stackoverflow.com/comment/41044958
score: 0
tagged with: actionevent
answer count: 3
has answer: http://stackoverflow.com/a/26175185
has body: I'm new to JavaFX and I want to create a view class that will call methods in a Controller when an event is triggered by a button push. My code is below: package spacetrader.menu; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.layout.Pane; import spacetrader.Window; public class MenuView implements Initializable { public Window window; public MenuCtrl menuCtrl; @FXML Button start; @FXML Pane background; @FXML Button exit; public MenuView() {}; public MenuView(Window aWindow, MenuCtrl aMenuCtrl) { window = aWindow; menuCtrl = aMenuCtrl; } void renderMainMenu() { try { window.loadFXML(new FXMLLoader((getClass().getResource("MainMenu.fxml")))); } catch (IOException ex) { Logger.getLogger(MenuView.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void initialize(URL url, ResourceBundle rb) { start.setOnAction((ActionEvent event) -&gt; menuCtrl.newGame()); exit.setOnAction((ActionEvent event) -&gt; menuCtrl.closeApplication()); } } This compiles, but when I run it and press the button I get a null pointer exception on the lambda expressions. The exception refers to "menuCtrl." How should I be setting up my program to make the button call menuCtrl.newGame()? Here's what I've tried already: I've moved the setOnAction commands to between the various methods. Replaced the calls to menuCtrl methods with System.out.prinln statements to confirm that this works. It does. I've replaced menuCtrl methods with System.out.println(this) to ensure there isn't a scoping problem. It prints "spacetrader.menu.MenuView@74f51979" as expected. Converted the Lambda expressions to anonymous inner classes Used a block as the lambda's body
possible better answer: http://stackoverflow.com/a/26172999
has comment: http://stackoverflow.com/comment/41053775
has comment: http://stackoverflow.com/comment/41055558
has title: Calling methods in a Java Fx ActionEvent
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26185497
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/q/26120971
tagged with: apache-pig
score: 0
tagged with: java
has title: Hadoop PIG Custom UDF method in foreach generate loop
answer count: 1
tagged with: hadoop
has body: Is it possible to code UDF function that will do following records = load INPUT using PigStorage() AS (vin:chararray , longString:chararray); simpleData = foreach records generate vin , myUdfFunctionGetValue(longString , 'someKey'); Here longString is of structure "key:Value;key2:Value2,someKey:Value3...." So I need to parse longString and get the value of asked key. Am I going to wrong direction and is this possible in PIG?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26133005
type: Question

android-fragments
tags question: http://stackoverflow.com/q/26159483
tags question: http://stackoverflow.com/q/26142093
tags question: http://stackoverflow.com/q/26140457
tags question: http://stackoverflow.com/q/26155855
tags question: http://stackoverflow.com/q/26049613
tags question: http://stackoverflow.com/q/26046440
tags question: http://stackoverflow.com/q/26166761
type: Tag
tags question: http://stackoverflow.com/q/26159076
tags question: http://stackoverflow.com/q/26090227
tags question: http://stackoverflow.com/q/26130214
tags question: http://stackoverflow.com/q/26125544
tags question: http://stackoverflow.com/q/26079101
tags question: http://stackoverflow.com/q/26182290
tags question: http://stackoverflow.com/q/26166948
tags question: http://stackoverflow.com/q/26051126
tags question: http://stackoverflow.com/q/26078641
tags question: http://stackoverflow.com/q/26079943
tags question: http://stackoverflow.com/q/26166523
tags question: http://stackoverflow.com/q/26155616
tags question: http://stackoverflow.com/q/26112812
tags question: http://stackoverflow.com/q/26113992
tags question: http://stackoverflow.com/q/26101842
tags question: http://stackoverflow.com/q/26169249
tags question: http://stackoverflow.com/q/26185916
tags question: http://stackoverflow.com/q/26131188
tags question: http://stackoverflow.com/q/26075540
tags question: http://stackoverflow.com/q/26112543
tags question: http://stackoverflow.com/q/26189545
tag name: android-fragments
tags question: http://stackoverflow.com/q/26113975
tags question: http://stackoverflow.com/q/26087860

http://stackoverflow.com/q/26122666
has comment: http://stackoverflow.com/comment/40941806
accepted answer: http://stackoverflow.com/a/26122782
tagged with: filereader
has body: I have a for loop nested inside a do-while loop which is to read through a text file and look for the given input. I have noticed that it works perfectly fine if you give an input which exists in the file, however can someone help me understand why the program never exits the loop if you give an input which does not exist in the text file, even though it should exit when the variable with the text from the file becomes null. I have posted all relevant code from the method where the for loop is being executed, including the part where it gains the user input; just to be clear, there are no errors given when compiling or running the program. FileReader fileReader = new FileReader("VirtualATM.txt"); BufferedReader bufferedReader = new BufferedReader(fileReader); System.out.print("Enter your pin: "); char [] EnterPin = {0, 0, 0 ,0}; try{ EnterPin = System.console().readPassword(); }catch(InputMismatchException e){ e.printStackTrace(); System.out.println(e.getMessage()); //System.out.println(e.getLocalizedMessage()); } boolean pinTrue = false; String LineFromFile = null; LineFromFile = bufferedReader.readLine(); String [] PinSearch = LineFromFile.split("\\s+"); String UserPin = java.util.Arrays.toString(EnterPin); String PinMod = UserPin.replaceAll("\\[", ""); String PinMod2 = PinMod.replaceAll("\\,", ""); String PinMod3 = PinMod2.replaceAll("\\s+", ""); String PinToWrite = PinMod3.replaceAll("\\]", ""); do{ for(int search = 0; search &lt; PinSearch.length; search++){ String SearchForPin = PinSearch[search]; if(SearchForPin.matches(PinToWrite)){ pinTrue = true; System.out.println("Success!"); } else if(search =&gt; PinSearch.length){ System.out.println("Error! Invalid pin."); } } LineFromFile = bufferedReader.readLine(); }while(pinTrue == false &amp;&amp; line != null); }catch(IOException e){ e.printStackTrace(); System.out.println(e.getLocalizedMessage()); }
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26122742
upvote count: 1
type: Question
tagged with: do-while
possible better answer: http://stackoverflow.com/a/26122742
has answer: http://stackoverflow.com/a/26122782
answer count: 2
tagged with: for-loop
downvote count: 0
score: 1
has title: Why does this `do-while/for loop` never end if you give an invalid input?
favorite count: 0

linked-list
tags question: http://stackoverflow.com/q/26091882
tags question: http://stackoverflow.com/q/26104672
tags question: http://stackoverflow.com/q/26093228
tags question: http://stackoverflow.com/q/26125963
tags question: http://stackoverflow.com/q/26132734
tag name: linked-list
type: Tag
tags question: http://stackoverflow.com/q/26049060
tags question: http://stackoverflow.com/q/26076014
tags question: http://stackoverflow.com/q/26191240
tags question: http://stackoverflow.com/q/26169827
tags question: http://stackoverflow.com/q/26050652
tags question: http://stackoverflow.com/q/26070965
tags question: http://stackoverflow.com/q/26147586
tags question: http://stackoverflow.com/q/26066501
tags question: http://stackoverflow.com/q/26166091
tags question: http://stackoverflow.com/q/26077156
tags question: http://stackoverflow.com/q/26109189

http://stackoverflow.com/comment/41057377
comment on: http://stackoverflow.com/q/26185036
type: Comment
type: QuestionComment
has text: Without knowing anything about *how* you're trying to "run the program" it's hard to help. Is it a standalone, local app? Webstart? Applet? ETc.
score: 1

http://stackoverflow.com/a/26187867
upvote count: 17
has comment: http://stackoverflow.com/comment/120048136
has comment: http://stackoverflow.com/comment/126498244
has comment: http://stackoverflow.com/comment/120146749
downvote count: 0
answers question: http://stackoverflow.com/q/26186572
has body: You could try an ControlsFX CheckComboBox (ControlsFX is a 3rd party controls library for JavaFX). Just copied from the CheckComboBox javadoc: A simple UI control that makes it possible to select zero or more items within a ComboBox-like control. Each row item shows a CheckBox, and the state of each row can be queried via the check model. // create the data to show in the CheckComboBox final ObservableList<String> strings = FXCollections.observableArrayList(); for (int i = 0; i <= 100; i++) { strings.add("Item " + i); } // Create the CheckComboBox with the data final CheckComboBox<String> checkComboBox = new CheckComboBox<String>(strings); // and listen to the relevant events (e.g. when the selected indices or // selected items change). checkComboBox.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() { public void onChanged(ListChangeListener.Change<? extends String> c) { while(c.next()) { //do something with changes here } System.out.println(checkComboBox.getCheckModel().getCheckedItems()); } }); } Note: the JavaFX controls developer lead comments on the in-built combobox control for JavaFX: you can put whatever selection model instance you want into ComboBox, but only single selection will ever be supported. We did this as multiple selection didn't really make sense without drastic changes to the UI and UX, and we figured a separate control could be developed in the future to better support this use case The CheckComboBox control from ControlsFX is that seperate control.
type: Answer
has comment: http://stackoverflow.com/comment/137657153
has comment: http://stackoverflow.com/comment/94962299
score: 17

http://stackoverflow.com/comment/40843088
score: 0
type: Comment
has text: I couldn't suggest it better, +1
type: AnswerComment
comment on: http://stackoverflow.com/a/26068284

http://stackoverflow.com/q/26130990
tagged with: eclipse
upvote count: 4
accepted answer: http://stackoverflow.com/a/26132276
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/36720726
score: 4
answer count: 3
has title: How to download Weblogic Adapter in Eclipse Luna SR1
possible better answer: http://stackoverflow.com/a/28305165
tagged with: weblogic
has answer: http://stackoverflow.com/a/28305165
has answer: http://stackoverflow.com/a/26132276
has body: I'm trying to download Weblogic Adapter for Eclipse Luna SR1. Everytime I download a new version of eclipse I just go to the "Download additional server adapters" link to shows a list of available adapters and select the weblogic adapter. Now that Eclipse Luna SR1 was released I can't find the weblogic adapter. The glassfish adapter that is usually in the list here is not listed neither. What Happen to Oracle adapters? How can I install this adapter if is not in the list of adapters?
tagged with: java

http://stackoverflow.com/q/26184510
has body: I've got some problems trying to make the only common exception for my whole class. Could somebody tell me how make that? Before that I tried to make little try-throw-catch blocks like that: try { Integer a = 10; if(a == 10) throw(/*what to write here?*/) } //some code later... or here must be NO code because catch goes right after the try(if I'm not mistaken)? catch(/*what to write here?*/){ System.err.println("smth gone wrong"); } So the question is how to create one big exception for whole class and how to make correctly example above?
tagged with: exception
has title: Whole class exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26184582
accepted answer: http://stackoverflow.com/a/26184582
tagged with: java
type: Question
tagged with: try-catch
score: -2
downvote count: 3
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40880874
has text: @eckes I disagree. The accepted answer for that question claims that iterating over a ConcurrentHashMap is usually safe, which is correct for a given value of "usually". But Kevin's usage is not safe, so he is right to ask a separate question.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26088953
type: Comment

http://stackoverflow.com/a/26179182
type: Answer
accepted answer of: http://stackoverflow.com/q/26179001
answers question: http://stackoverflow.com/q/26179001
score: 31
has comment: http://stackoverflow.com/comment/41046168
has body: For a start, using Lambdas is not the solution to all problems... but, even then, as a for loop, you would write it: List&lt;Integer&gt; results = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; list.size(); i++) { if (search == list.get(i).intValue()) { // found value at index i results.add(i); } } Now, there's nothing particularly wrong with that, but note that the critical aspect here is the index, not the value. The index is the input, and the output of the 'loop'. As a stream:: List&lt;Integer&gt; list = Arrays.asList(10, 6, 16, 46, 5, 16, 7); int search = 16; int[] indices = IntStream.range(0, list.size()) .filter(i -&gt; list.get(i) == search) .toArray(); System.out.printf("Found %d at indices %s%n", search, Arrays.toString(indices)); Produces output: Found 16 at indices [2, 5]
has comment: http://stackoverflow.com/comment/41046246
type: AcceptedAnswer
downvote count: 0
upvote count: 31

http://stackoverflow.com/comment/41037692
comment on: http://stackoverflow.com/q/26174527
has text: you did see it because you didn't added `mapview` anywhere.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40944987
type: Comment
comment on: http://stackoverflow.com/q/26124230
type: QuestionComment
has text: I just have eddited my code. I have the same problem
score: 0

http://stackoverflow.com/comment/40910607
comment on: http://stackoverflow.com/q/26105157
score: 0
type: Comment
has text: sorry, no. Im gonna go with the wikipedia-definition because its the one everyone uses and also the one i would come up with. If you can access it in _ANY_ way its not a memory leak - your GC may be able to catch up if you dont overdo it.
type: QuestionComment

http://stackoverflow.com/a/26073585
answers question: http://stackoverflow.com/q/26073016
accepted answer of: http://stackoverflow.com/q/26073016
has comment: http://stackoverflow.com/comment/40885655
has body: The white spaces between your textviews are textviews that arent hidden, try to hide them when you have no data for them like: if(nsPutih==true) { tvOutput1.setText("Nasi Putih"); tvOutput1.setVisibility(View.VISIBLE); } else { tvOutput1.setVisibility(View.GONE); } However this is bad practice, you should try to dynamically create the textviews by putting them in a ListView. Also try to pass the data to the activity using a Map of objects.
score: 0
has comment: http://stackoverflow.com/comment/40852632
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40852731
type: Answer

http://stackoverflow.com/comment/40890410
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26093851
has text: Check my updated answer. You should be fine with that dependency.
score: 0

http://stackoverflow.com/comment/65622124
comment on: http://stackoverflow.com/a/39138850
type: AnswerComment
has text: Welcome to SO. It helps if you can add code to show the answer.
score: 0
type: Comment

http://stackoverflow.com/a/26112908
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26112860
upvote count: 1
type: Answer
has body: Your code will create a new file if the file doesn't already exist. If the file does exist, it will be erased and an empty file created in it's place. In both cases, you will have a brand new, empty file. There is nothing to search.

http://stackoverflow.com/q/26082622
possible better answer: http://stackoverflow.com/a/26083106
has answer: http://stackoverflow.com/a/26083106
type: AnsweredQuestion
has body: I want to map graphical/symbol characters to a simpler Java alternative where possible, for example: U1E36 latin capital letter l with dot below -> L U25B6 Black Right-Pointing Triangle -> > U25C0 Black Left-Pointing Triangle -> &lt; U25B2 Black UP-Pointing Triangle -> ^ My problem is I don't know what all the characters are so although it is technically easy enough to map the specific characters above it is difficult to do for every one, there could be hundreds. I already have this code for removing accents ecetera public static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+"); private static String stripDiacritics(String str) { str = Normalizer.normalize(str, Normalizer.Form.NFD); str = DIACRITICS_AND_FRIENDS.matcher(str).replaceAll(""); return str; } So I was wondering if there was something similar to help me with these symbol characters, note I don't want to ever remove them just replace with a simpler representation.
downvote count: 0
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40873179
accepted answer: http://stackoverflow.com/a/26118364
answer count: 2
upvote count: 1
tagged with: unicode
favorite count: 0
has title: How can I map unicode symbols to a simpler latin script equivalent in Java
has answer: http://stackoverflow.com/a/26118364
has comment: http://stackoverflow.com/comment/40888120
tagged with: normalize
linked to: http://stackoverflow.com/q/6230693

http://stackoverflow.com/comment/40800492
has text: Without the Z in quotes gives "2014-09-25T18:17:21.026+0100" which is the correct time but not UTC. Z without quotes just adds the timezone +0100. I need the output to be the UTC time and read exactly "2014-09-25T17:21:42.026Z"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26045021
type: Comment

http://stackoverflow.com/a/26232159
downvote count: 0
has body: the project is built using gradle . so config for all dependencies are redirected to build.gradle . the extract from the build file that helped me mutate jooq properties are: jooq { generator { generate { relations = true deprecated = false records = true immutablePojos = false daos = false fluentSetters = true } target { packageName = '...' } that file isnt accessible from the project directory but i could edit it here!!
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26175812
upvote count: 3
answers question: http://stackoverflow.com/q/26175812
type: Answer
score: 3

http://stackoverflow.com/a/26169102
has body: That static version is part of it. You could change your version to 1.1.0-SNAPSHOT which Gradle considers a "changing" module. However, Gradle will still only redownload the artifact every 24 hours by default. You can override this behavior and instruct Gradle not to cache changing modules at all. More info can be found in the Gradle docs. configurations.all { resolutionStrategy { cacheChangingModulesFor 0, 'seconds' } } If you are not willing to change your artifact version you could try using ResolutionRules. Edit: You can tell Gradle your dependency is a changing dependency. compile('com.blah.alpha:alpha:1.1.0+@aar') { changing true }
answers question: http://stackoverflow.com/q/26168319
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26168319
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26077178
accepted answer: http://stackoverflow.com/a/26077228
answer count: 3
has title: How can I make System.in Input Stream read utf-8 characters?
downvote count: 0
has answer: http://stackoverflow.com/a/26077316
has answer: http://stackoverflow.com/a/26077305
favorite count: 0
possible better answer: http://stackoverflow.com/a/26077305
type: AnsweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26077228
tagged with: java
has body: This is my code: public class MyTestClass { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); InputStream inputStream = System.in; int read = inputStream.read(); System.out.println(read); System.out.println((char)read); System.out.println(s); } } And I input the letter ğ twice when I run the program. The console output will be: ğ ğ 196 Ä ğ How can I see the correct letter instead of Ä? Scanner seems to do the right thing. And actually, why does not this approach work? What is wrong in here?
type: Question
tagged with: encoding

http://stackoverflow.com/comment/44936889
comment on: http://stackoverflow.com/a/26173418
type: Comment
type: AnswerComment
has text: No tuna, actually the time complexity matters here! not where you break the loop!
score: 0

http://stackoverflow.com/comment/125913738
comment on: http://stackoverflow.com/a/69270811
type: AnswerComment
type: Comment
score: 1
has text: Its same for me. I was using java 11 to generate the certs file and using them in java 8 so got the error. Once on same version, it resolved.

http://stackoverflow.com/comment/73680752
comment on: http://stackoverflow.com/q/26065917
has text: This discussion with @walkeros led me to implement solution with **RMI** over **Unix Domain Sockets** using awesome [junixsocket](https://code.google.com/p/junixsocket/wiki/GettingStarted) library.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26174322
has comment: http://stackoverflow.com/comment/41037547
has comment: http://stackoverflow.com/comment/41037678
has comment: http://stackoverflow.com/comment/41037388
has comment: http://stackoverflow.com/comment/41038129
type: Answer
has comment: http://stackoverflow.com/comment/41037344
has comment: http://stackoverflow.com/comment/41037517
has comment: http://stackoverflow.com/comment/41037489
has comment: http://stackoverflow.com/comment/41038391
score: 5
has body: Your creation SQL states PRIMRY KEY instead PRIMARY KEY. Your table was thus, initially created without the PRIMARY KEY constraint and since you added the 'IF NOT EXISTS' condition, new creations won't wake effect until the table is previously dropped. The reason your table was created without PRIMARY KEY constraint can be found within the column-constraint diagram: The constraint deffinition is wrong (PRMARY is not PRIMARY), (as remarked in red) that makes the column constraint sub-grammar not to triggered.
upvote count: 5
has comment: http://stackoverflow.com/comment/41037423
has comment: http://stackoverflow.com/comment/41037467
answers question: http://stackoverflow.com/q/26174258
has comment: http://stackoverflow.com/comment/41037539
downvote count: 0
has comment: http://stackoverflow.com/comment/41037352

opencv
type: Tag
tags question: http://stackoverflow.com/q/26064642
tags question: http://stackoverflow.com/q/26185411
tags question: http://stackoverflow.com/q/26175748
tags question: http://stackoverflow.com/q/26107826
tag name: opencv
tags question: http://stackoverflow.com/q/26109412
tags question: http://stackoverflow.com/q/26156582
tags question: http://stackoverflow.com/q/26187378
tags question: http://stackoverflow.com/q/26073373
tags question: http://stackoverflow.com/q/26152922

http://stackoverflow.com/a/26101654
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26098840
score: 1
has body: There would be something web service naming conventions. Please refer the below link and check whether you are able to find any answer for your quetion. Correct me if i am wrong http://docs.oracle.com/cd/E12461_01/140/retail_soa_enabler_tool_guide/or-rse-Standards.htm Avoid verbs when naming Web services.Example Avoid names such as CreateSupplierService.

http://stackoverflow.com/a/41218468
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/95436637
has comment: http://stackoverflow.com/comment/95451284
has body: server.port, management.port and management.context-path properties (the last two to access Actuator endpoints) could be set to make the embedded container to listen on different ports. In case it would be desirable to listen on ports other than server.port and management.port: @Configuration public class EmbeddedTomcatConfiguration { @Value("${server.additionalPorts}") private String additionalPorts; @Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); Connector[] additionalConnectors = this.additionalConnector(); if (additionalConnectors != null &amp;&amp; additionalConnectors.length &gt; 0) { tomcat.addAdditionalTomcatConnectors(additionalConnectors); } return tomcat; } private Connector[] additionalConnector() { if (StringUtils.isBlank(this.additionalPorts)) { return null; } String[] ports = this.additionalPorts.split(","); List&lt;Connector&gt; result = new ArrayList&lt;&gt;(); for (String port : ports) { Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); connector.setScheme("http"); connector.setPort(Integer.valueOf(port)); result.add(connector); } return result.toArray(new Connector[] {}); } } application.yml server: port: ${appPort:8800} additionalPorts: 8881,8882 Application.java @SpringBootApplication @ComponentScan(...) @Import(EmbeddedTomcatConfiguration.class) public Application { public static void main(String[] args) { SpringApplication.run(Application .class, args); } } In http://tech.asimio.net/2016/12/15/Configuring-Tomcat-to-Listen-on-Multiple-ports-using-Spring-Boot.html I covered how to make Embedded Tomcat to listen on a different port and configured JavaMelody to exclusively access it through that new port.
answers question: http://stackoverflow.com/q/26111050
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41018923
type: AnswerComment
comment on: http://stackoverflow.com/a/26164261
has text: Ahh I see. Ok , this is a bit more cumbersome then I hoped for, but could potentially lead me to what I'm looking for. Thanks
score: 0
type: Comment

http://stackoverflow.com/comment/41063763
score: 0
has text: 10 millisecond sis absurdly short for socket timeout. It's less than the granularity of the Windows clock for example. Use a second or more.
type: Comment
comment on: http://stackoverflow.com/q/26185826
type: QuestionComment

http://stackoverflow.com/a/26052600
has comment: http://stackoverflow.com/comment/41023776
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40834592
has comment: http://stackoverflow.com/comment/41079710
has comment: http://stackoverflow.com/comment/41079665
answers question: http://stackoverflow.com/q/26051100
accepted answer of: http://stackoverflow.com/q/26051100
has comment: http://stackoverflow.com/comment/40815497
type: AcceptedAnswer
downvote count: 0
has body: Because each time your dopost method is called, you're initializing variable with value 0. Instead simply you can check if the session attribute exist, else set the attribute. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = req.getSession(true); // get counter variables Integer smartCtr = session.getAttribute("smart") == null? 0: session.getAttribute("smart"); Integer globeCtr = session.getAttribute("globe") == null? 0: session.getAttribute("globe"); Integer sunCtr = session.getAttribute("sun") == null? 0: session.getAttribute("globe"); //your logic .... //set incremented values back session.setAttribute("smart", smartCtr); ..... }
has comment: http://stackoverflow.com/comment/41309463

http://stackoverflow.com/a/26071257
type: Answer
upvote count: 3
has body: That's called a wildcard, useful when defining generic types. Take a look at this example from the documentation: Collection&lt;?&gt; c = new ArrayList&lt;String&gt;(); c.add(new Object()); // Compile time error Since we don't know what the element type of c stands for, we cannot add objects to it. The add() method takes arguments of type E, the element type of the collection. When the actual type parameter is ?, it stands for some unknown type. Any parameter we pass to add would have to be a subtype of this unknown type. Since we don't know what type that is, we cannot pass anything in. The sole exception is null, which is a member of every type. Also from the great Java Generics FAQ: A wildcard describes a family of types. There are 3 different flavors of wildcards: " ? " - the unbounded wildcard. It stands for the family of all types. " ? extends Type " - a wildcard with an upper bound. It stands for the family of all types that are subtypes of Type , type Type being included. " ? super Type " - a wildcard with a lower bound. It stands for the family of all types that are supertypes of Type , type Type being included. Wildcards are used to declare so-called wildcard parameterized types, where a wildcard is used as an argument for instantiation of generic types. Wildcards are useful in situations where no or only partial knowledge about the type argument of a parameterized type is required.
answers question: http://stackoverflow.com/q/26071237
accepted answer of: http://stackoverflow.com/q/26071237
type: AcceptedAnswer
downvote count: 0
score: 3

http://stackoverflow.com/comment/40942241
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26122814
has text: hey are you doing query.getResultList() for the last query? Try that.

http://stackoverflow.com/q/26103731
tagged with: replaceall
has body: I have an html file and several jpgs that I retrieve from a database. This html has several img scr="..." tags and each tag has an absolute path based upon the customer's url. My task is to replace each of those absolute paths with relative path for viewing after I extract the html and images files to local drive. For example, I have: ... &lt;img src="www.something.com\images\image1.jpg"&gt; ... &lt;img src="www.something.com\images\image2.jpg"&gt; ... &lt;img src="www.something.com\images\image3.jpg"&gt; And I want: ... &lt;img src="image1.jpg"&gt; ... &lt;img src="image2.jpg"&gt; ... &lt;img src="image3.jpg"&gt; Challenges: 1) The customer's urls will be all the same within the html file, however, another html will have a different customer url. So I cannot simply look for the same string in every html. 2) Must be done in java, using java's native libraries. Cannot use Jsoup or any other 3rd party jar. Question: I presume replaceAll using regular expressions would be the way to go, but not sure how to write it for a varying search string in the case of htmls for different customers. Although I have scoured the stack submissions for an answer, I have not found one with this unique scenario and challenges. So my question is, what would be the best way to accomplish this task? Thank you in advance.
has answer: http://stackoverflow.com/a/26104128
type: UnansweredQuestion
tagged with: regex
tagged with: java
has title: Replace several html absolute path strings with relative path
type: Question
has comment: http://stackoverflow.com/comment/40909683
has answer: http://stackoverflow.com/a/26103787
has answer: http://stackoverflow.com/a/26103813
score: 0
answer count: 3

http://stackoverflow.com/q/26080574
has comment: http://stackoverflow.com/comment/40865779
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26080830
has comment: http://stackoverflow.com/comment/40865720
has body: I'm a beginner Java student and trying to get this code to show second JOptionPane if the number chosen is negative or 0. The second JOption isn't appearing if I choose 0 or a negative number. I suspect it has something to do with the "if(result != null)". I've tried using different operands and values and keep getting the bad operand types error. I would like to stick with the if-else statement because that's where we are at the moment in class. public static void calculateR() { String result = JOptionPane.showInputDialog(null, "Enter how much money you can save annually."); if(result != null) { saveAmount = Double.parseDouble(result); } else { JOptionPane.showMessageDialog(null, "Pick a number greater than 0!"); }
has title: Getting error with If-else using null
has comment: http://stackoverflow.com/comment/40865511
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26080830
has answer: http://stackoverflow.com/a/26080790
has answer: http://stackoverflow.com/a/26080841
has comment: http://stackoverflow.com/comment/40865505
type: Question
has comment: http://stackoverflow.com/comment/40865592
possible better answer: http://stackoverflow.com/a/26080790

http://stackoverflow.com/comment/40922061
comment on: http://stackoverflow.com/a/26111647
type: Comment
has text: That is unfortunate. The fully fleshed MapReduce example [here](http://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html) uses the old api then? Do you know where I could find an example that uses the new API (source code, not just the jar).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41011647
type: AnswerComment
type: Comment
has text: `replaceAll` is nothing to do here (you don't use regex), use `replace`
score: 1
comment on: http://stackoverflow.com/a/26160658

http://stackoverflow.com/comment/40983181
comment on: http://stackoverflow.com/q/26145174
score: 0
type: Comment
type: QuestionComment
has text: What exactly is the problem? Can you provide an example of how it looks now and how you want it to look?

http://stackoverflow.com/q/26119721
answer count: 0
downvote count: 0
score: 1
tagged with: maven
has comment: http://stackoverflow.com/comment/40935694
has body: I need help. I got the following error. I have googled around but cannot find any solution. O/S Window: 7 (64-bit) Java: java version "1.6.0_45" Command: mvn clean package -DskipTests [exec] npm ERR! npm -v 1.4.9 [exec] npm ERR! code ELIFECYCLE [exec] npm [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Shopping Project .................................. SUCCESS [0.937s] [INFO] Shopping Integration .............................. SUCCESS [2.020s] [INFO] Shopping Job ...................................... SUCCESS [1.050s] [INFO] Shopping Web Layer ................................ SUCCESS [33.822s] [INFO] Shopping WAR ...................................... FAILURE [31.418s] [INFO] Shopping DB Files ................................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3:12.071s [INFO] Finished at: Tue Sep 30 13:54:41 EEST 2014 [INFO] Final Memory: 85M/725M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7: run (1) on project Shoppingwar: An Ant BuildException has occured: exec returned : 1 [ERROR] around Ant part ...&lt;exec dir="C:\training\Shopping\Shoppingwar" executab le="cmd" failonerror="true" inputstring="yes" osfamily="windows"&gt;... @ 7:121 in C:\training\Shopping\Shoppingwar\target\antrun\build-main.xml How do I solve this problem?
type: Question
tagged with: ant
tagged with: java
has title: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7
upvote count: 1
has comment: http://stackoverflow.com/comment/40967498
favorite count: 0
type: UnansweredQuestion
tagged with: node.js

http://stackoverflow.com/q/26118598
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26118721
has title: Objective C to Java: converting a typedef block
tagged with: objective-c
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26118747
has body: I am trying to port the following typedef block: typedef void (^MyBlock)(BOOL success, enumType appStatus); How could I do this Java?
accepted answer: http://stackoverflow.com/a/26118721
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26118747

http://stackoverflow.com/q/26150035
tagged with: string
has comment: http://stackoverflow.com/comment/40992592
possible better answer: http://stackoverflow.com/a/26150472
favorite count: 0
has answer: http://stackoverflow.com/a/26150472
has comment: http://stackoverflow.com/comment/40992654
has comment: http://stackoverflow.com/comment/40992311
has comment: http://stackoverflow.com/comment/40992802
has body: String s = "ab#cd#ef#gh#"; String regex = "#"; char [] sChar = s.toCharArray(); char [] regexChar = regex.toCharArray(); int count = 1; for (int i = 0; i &lt; regexChar.length; i++){ for (int j = 0; j &lt; sChar.length; j++){ if (regexChar [i] == sChar[j]){ count += 2; } } } String [] splitS = new String [count]; String temp; for (int k = 0; k &lt; count; k++){ temp = ""; for (int i = 0; i &lt; regexChar.length; i++){ for (int j = 0; j &lt; sChar.length; j++){ if (regexChar[i] == sChar[j]){ temp = Character.toString(regexChar[i]); } else { temp = temp + Character.toString(sChar[j]); } } } splitS[k] = temp; } This is my code so far but it gives me splitS[#,#,#,#,#,#,#,#]. However it should be splitS[ab,#,cd,#,ef,#,gh,#]. Can anyone tell me why it's doing this?
has comment: http://stackoverflow.com/comment/40992676
has comment: http://stackoverflow.com/comment/40992408
tagged with: regex
has comment: http://stackoverflow.com/comment/40992326
score: 2
has answer: http://stackoverflow.com/a/73836071
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40992933
has comment: http://stackoverflow.com/comment/40992514
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40992348
has comment: http://stackoverflow.com/comment/40992990
downvote count: 1
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/40992321
has answer: http://stackoverflow.com/a/26150450
has comment: http://stackoverflow.com/comment/40993233
linked to: http://stackoverflow.com/q/5965767
has comment: http://stackoverflow.com/comment/40992359
has comment: http://stackoverflow.com/comment/40992947
has comment: http://stackoverflow.com/comment/40992769
has comment: http://stackoverflow.com/comment/40992618
has comment: http://stackoverflow.com/comment/40992413
has comment: http://stackoverflow.com/comment/40992299
accepted answer: http://stackoverflow.com/a/26150450
answer count: 3
has title: Splitting a string without using String.split() - and returning delimiters
has comment: http://stackoverflow.com/comment/40992458
has comment: http://stackoverflow.com/comment/40992377
has comment: http://stackoverflow.com/comment/40992628

http://stackoverflow.com/comment/41061631
type: Comment
has text: @user3599960 sure, I'll be attending your comments.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26173532

http://stackoverflow.com/q/26071619
has comment: http://stackoverflow.com/comment/40849189
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40849171
has body: I'm wondering how I can create a new object of a certain class, if I have that classname saved in a string. eg. I imagine to create an object of FooClass it would be something like: String className = "FooClass"; className.toClass() newObject = new (className.toClass())(); I've done quite a bit of searching but have been unable to find an answer. Thanks
tagged with: reflection
tagged with: java
downvote count: 3
has title: Create an object of class with given a class name as a String
type: Question
score: -2
has answer: http://stackoverflow.com/a/26071640
tagged with: class
linked to: http://stackoverflow.com/q/9886266
answer count: 1
duplicate of: http://stackoverflow.com/q/9886266
favorite count: 0

http://stackoverflow.com/comment/40849681
score: 0
type: Comment
has text: Not a very helpful first part of the first sentence, but the rest worked perfect :).
comment on: http://stackoverflow.com/a/26067681
type: AnswerComment

http://stackoverflow.com/q/26091652
has comment: http://stackoverflow.com/comment/40886002
has answer: http://stackoverflow.com/a/26091737
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40886017
has body: I am a beginner in Android programming, and trying to create a simple program that converts inches to feet, and US dollars to Japanese Yen. I have the following two radio groups in my main_activity.xml file: &lt;RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/distanceInput" android:layout_below="@+id/distanceInput" android:layout_marginTop="10dp" &gt; &lt;RadioButton android:id="@+id/inch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:checked="true" android:onClick="handleClickOne" android:text="Inches" /&gt; &lt;RadioButton android:id="@+id/foot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/currencyInput" android:layout_below="@+id/radioGroup1" android:onClick="handleClickOne" android:text="Feet" /&gt; &lt;/RadioGroup&gt; &lt;RadioGroup android:id="@+id/radioGroup2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/currencyInput" android:layout_below="@+id/currencyInput" android:layout_marginTop="10dp" &gt; &lt;RadioButton android:id="@+id/japan" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/radioGroup2" android:layout_centerVertical="true" android:checked="true" android:text="JPY" android:onClick="handleClickTwo" /&gt; &lt;RadioButton android:id="@+id/usdollar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/euro" android:layout_below="@+id/euro" android:text="US Dollars" android:onClick="handleClickTwo" /&gt; &lt;/RadioGroup&gt; This following code is for my handleClickOne() method that checks which radio button is selected between Inches and Feet, but the switch-case loop always falls on the default case - I wonder why: public void handleClickOne(View view) { DecimalFormat df = …
has comment: http://stackoverflow.com/comment/40885936
tagged with: java
has title: Check radio button id when there're two radio groups
type: Question
has answer: http://stackoverflow.com/a/26091791
score: 0
answer count: 2
tagged with: radio-button

http://stackoverflow.com/comment/40936132
type: AnswerComment
has text: ya! but that follows Java's structure? May i know y the visitor methods are not getting executed. I generated the remaining Lexer, Parser, Visitor and BaseVisitor using the org.antlr.v4.Tool
type: Comment
comment on: http://stackoverflow.com/a/26119312
score: 0

http://stackoverflow.com/comment/40926525
has text: I don't know AJAX. Could you help me with an outline code. Please.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26112951
type: AnswerComment

http://stackoverflow.com/a/26050046
score: 0
has comment: http://stackoverflow.com/comment/40830026
type: Answer
has body: Are you using Android 4.0 or higher? Also, maybe it's easier doing it with the sherlock actionbar
answers question: http://stackoverflow.com/q/26049904

http://stackoverflow.com/a/26076519
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Maybe you are reading only even lines you are reading a line twice? (in while statement...), it looks you reads the first line which is dropped in while condition test. If your response contains only one line, nothing will be readed use this: String line; while ((line=response.readLine()) != null) { responseString += line; }
type: Answer
accepted answer of: http://stackoverflow.com/q/26076468
answers question: http://stackoverflow.com/q/26076468
downvote count: 0

http://stackoverflow.com/comment/40801116
type: Comment
type: AnswerComment
has text: yours output is completely different so its supposed to be a half pyramid thats why the second loop is there
comment on: http://stackoverflow.com/a/26045332
score: 0

http://stackoverflow.com/a/26158104
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26157804
has body: You should have a Look at Hibernate Multi-Tenancy which is tailor made for this requirement. From Hibernate 4.x onwards it is available and advised to be used instead of using multiple SessionFactory. Please go through this post.

http://stackoverflow.com/q/26179603
has answer: http://stackoverflow.com/a/26179789
tagged with: loops
type: Question
answer count: 2
tagged with: arrays
score: 0
has answer: http://stackoverflow.com/a/26179775
type: UnansweredQuestion
has title: An array declared within the loop is not recognised outside it
has body: This is a segment from a program I'm working on for my school assignment. The array pc2[ ] that I need can only (as far as I can see) be assigned within the loop and it prints correctly as well inside the loop. However, when I want to pass it to the function ultra1(), the array pc2[ ] is not recognized... If anyone has any ideas, please share them as quickly as possible. Thanks in advance! void ultra() { String pc[]={"Inspiron 14 3000 Series","Inspiron 15 3000 Series","Inspiron 11 3000 Series","Inspiron 15 - 7000 Series"}; int bud[]={30190,28390,30990,81990,123990,186690,69990,48890,34990,38190}; String pc3[]=new String[10]; System.out.println("Please enter your maximum budget"); int max=sc.nextInt(); for(int i=0;i&lt;4;i++) { if(bud[i]&lt;=max) { String pc2[]={pc[i],pc[i],pc[i],pc[i]}; System.out.println(pc2[i]); } } ultra1(pc2); }
tagged with: java

http://stackoverflow.com/q/26076596
has answer: http://stackoverflow.com/a/26076628
type: Question
has answer: http://stackoverflow.com/a/26076647
upvote count: 0
has title: System.out.println() not working inside recursive function
has comment: http://stackoverflow.com/comment/40857830
has answer: http://stackoverflow.com/a/26076908
answer count: 3
has body: This is the Java code I wrote (Logic is that you can get a free soda bottle, if you exchange 5 empty soda bottles). Feel free to criticize or feedback for a better approach. package com.eanurag.practice; import java.util.Scanner; public class SodaBottleProblem { private int totalSodaBottle = 0; private int freeSodaBottle = 0; private int remainingBottle = 0; public int numberOfBottles(int originalNumberOfBottles) { freeSodaBottle = originalNumberOfBottles; while (freeSodaBottle % 5 &gt;= 5) { if (freeSodaBottle % 5 == 0) { freeSodaBottle = freeSodaBottle / 5; System.out.println("The Free Bottle count now is: " + freeSodaBottle); totalSodaBottle = totalSodaBottle + freeSodaBottle; System.out.println("The total Bottle count now is: " + totalSodaBottle); numberOfBottles(freeSodaBottle); } else if (originalNumberOfBottles % 5 != 0) { remainingBottle = freeSodaBottle % 5; System.out .println("The remaining count is: " + remainingBottle); freeSodaBottle = freeSodaBottle - (remainingBottle); System.out.println("The Free Bottle count now is: " + freeSodaBottle); numberOfBottles(freeSodaBottle); } } totalSodaBottle = totalSodaBottle + (freeSodaBottle + remainingBottle) / 5; System.out.println("Final value before return is:" + totalSodaBottle); return totalSodaBottle; } public static void main(String[] args) { // TODO Auto-generated method stub SodaBottleProblem sd = new SodaBottleProblem(); Scanner sc = new Scanner(System.in); System.out.println("Enter the original number of Soda bottles"); int originalNumberOfBottles = sc.nextInt(); System.out.println("Total number of bottles you can get: " + sd.numberOfBottles(originalNumberOfBottles)); sc.close(); } } Issue: I am quite puzzled to understand as to why System.out.println() calls inside recursive method numberOfBottles are not working at all. This is the output in console: Enter the original number of Soda bottles 77 Final value before return is:15 Total number of bottles you can get: 15
favorite count: 0
score: -1
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/40857838
tagged with: recursion
has comment: http://stackoverflow.com/comment/40857880
tagged with: java

http://stackoverflow.com/comment/40897062
type: AnswerComment
comment on: http://stackoverflow.com/a/26097200
has text: @pappu_kutty you are using autocomplete="on" in all the text fields ,remove them
score: 0
type: Comment

http://stackoverflow.com/comment/41036233
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26173702
has text: what is it ? have you ran my code to see what it does?
score: 0

http://stackoverflow.com/q/26192263
score: 0
accepted answer: http://stackoverflow.com/a/26192304
tagged with: android
answer count: 1
has title: How to avoid user clicking few times on the OptionsItemSelected button in Android?
has body: In my Android project user is clicking few times at button so I want to block that button if it's pressed already. Now SaveOrder() method is fired few times which is not acceptable. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.order_save: Log.d("Custom Synchronization", "Click!"); SaveOrder(); canQuit = true; hasAcceptQuit = true; onBackPressed(); // navigate to other acitivty return true; case R.id.order_adnotation: setAdnotationOrder(); return true; default: return super.onOptionsItemSelected(item); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26192304
tagged with: java
type: Question

http://stackoverflow.com/q/26042252
has comment: http://stackoverflow.com/comment/40795019
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: web-applications
tagged with: war
has comment: http://stackoverflow.com/comment/40795001
linked to: http://stackoverflow.com/q/12088
has comment: http://stackoverflow.com/comment/40795936
score: 1
tagged with: java
tagged with: source-code-protection
type: Question
downvote count: 2
has title: How can protect Java source code
duplicate of: http://stackoverflow.com/q/2004072
has comment: http://stackoverflow.com/comment/40795066
upvote count: 3
linked to: http://stackoverflow.com/q/49379
linked to: http://stackoverflow.com/q/2004072
has body: I am developing an Java web application witch I will deploy to a war file. The problem is that using JD Decompiler system administrators or someone else witch has access to war file can decompile and take the source code. Is it possible to protect the source code of JAVA ? For .Net application I use Intellilock to lock my C# source code and it works fine. But for Java it does not work.

http://stackoverflow.com/q/26188532
tagged with: java
score: 16
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/26188550
accepted answer: http://stackoverflow.com/a/26188550
possible better answer: http://stackoverflow.com/a/26188830
has answer: http://stackoverflow.com/a/26188830
has body: How would I go about iterating through a nested HashMap? The HashMap is setup like this: HashMap&lt;String, HashMap&lt;String, Student&gt;&gt; Where Student is an object containing a variable name. If for instance my HashMap looked like this (the following is not my code, it's just to simulate what the contents of the hashmap could be) hm =&gt; HashMap&lt;'S', Hashmap&lt;'Sam', SamStudent&gt;&gt; HashMap&lt;'S', Hashmap&lt;'Seb', SebStudent&gt;&gt; HashMap&lt;'T', Hashmap&lt;'Thomas', ThomasStudent&gt;&gt; How could I iterate through all of the single letter keys, then each full name key, then pull out the name of the student?
answer count: 2
has title: Iterate through nested hashmap
upvote count: 16
favorite count: 0
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41011255
type: QuestionComment
comment on: http://stackoverflow.com/q/26160472
score: 0
has text: Having a example would be nice.
type: Comment

http://stackoverflow.com/comment/40954438
type: QuestionComment
comment on: http://stackoverflow.com/q/26129304
score: 0
has text: I don't completely understand your requirements; I'd prefer an example of what you want _your_ class to look like, and examples of uses of your class that you do or don't want to disallow. Offhand, I'm guessing that you will want to use generics `<T extends YourInterface>` or use `instanceof` to check at run time.
type: Comment

http://stackoverflow.com/comment/41019171
type: QuestionComment
comment on: http://stackoverflow.com/q/26164545
has text: Well what **is** the problem? Stack traces? Undesired results?
score: 0
type: Comment

http://stackoverflow.com/comment/40843799
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26068715
has text: Define "strange output"

http://stackoverflow.com/comment/40953668
comment on: http://stackoverflow.com/a/26128911
has text: yes but I want another image to use it with inputstream , which is in drawable
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41052489
type: Comment
type: QuestionComment
has text: Did any part of your OS properly support 'HI-DPI' mode, besides your application? [According to the Arch Wiki](https://wiki.archlinux.org/index.php/HiDPI), HiDPI support is spotty at best.
score: 0
comment on: http://stackoverflow.com/q/26182460

http://stackoverflow.com/comment/40798688
comment on: http://stackoverflow.com/a/26041764
type: Comment
has text: Can you link to the github project or is it private?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26097445
type: Answer
score: 2
downvote count: 0
has body: 1. Can you still use the Tomcat datasource configuration? If so how does it know which profile to use? You can use the Tomcat datasourse configuration however the datasource definition will have nothing to do with Spring or Spring profiles. If you are using JNDI approach then you may have multiple datasources defined and can specify that one used in you application via profile properties however the actual definition will have nothing to do with Spring. Or, you can use a non-JNDI datasource i.e configured in Spring and perhaps using profiles. 2. How do you configure persistence.xml for multiple environments? Should the jdbc connection props even be in persistence.xml No, you only need a minimal persistence.xml when using Spring or perhaps not at all. 3. How do you set the active profile without recompiling? You can't The following is all you need to get up and running with a non-JNDI datasource. Example Spring Configuration (non-JNDI): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <jpa:repositories base-package="uk.co.certait.spring.data.repository" /> ${hibernate.ddl.auto} ${hibernate.dialect} ${hibernate.show.sql} true ${hibernate.enable.cache} org.hibernate.cache.EhCacheProvider Example Spring Datasource Definition <?xml version="1.0" encoding="UTF-8"?> ${database.driver} ${database.url} ${database.username} ${database.password} Example Spring Profile Definition: <?xml version="1.0" encoding="UTF…
has comment: http://stackoverflow.com/comment/40907162
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26080274
answers question: http://stackoverflow.com/q/26080274

http://stackoverflow.com/comment/138445199
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/53225089
has text: Query parameters also allow multiple values with the same key and `HashMap` only supports a single value. Also, if any value is `null`, this will add "key=null" instead of the probably expected "key=". I'm sure there are more cases, but in general a function should have a single responsibility and this has at least two: building a query string, and adding to the existing query.
score: 0

http://stackoverflow.com/a/26187782
has comment: http://stackoverflow.com/comment/41063359
has comment: http://stackoverflow.com/comment/41063168
has comment: http://stackoverflow.com/comment/41062751
has comment: http://stackoverflow.com/comment/41063304
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41063288
has comment: http://stackoverflow.com/comment/41063455
answers question: http://stackoverflow.com/q/26187749
has comment: http://stackoverflow.com/comment/41063145
type: Answer
has comment: http://stackoverflow.com/comment/41062849
accepted answer of: http://stackoverflow.com/q/26187749
has comment: http://stackoverflow.com/comment/41063590
has comment: http://stackoverflow.com/comment/41062976
has comment: http://stackoverflow.com/comment/41063470
score: 1
upvote count: 1
has body: Try writing text1.setText(list.size() + ""); or text1.setText(String.valueOf(list.size())); When you call System.out.println it works because the out object (of type PrintWriter) has an overloaded println(..) method for all primitive types. However, in your case having System.out.println("Size of HashSet : " + list.size()); makes parameter of println() method convert to string. It is detailed explained in this link. On the other hand, setText() of a TextView expects String and you are passing it an integer.

http://stackoverflow.com/comment/40899414
type: QuestionComment
has text: good answer. i wanna make it accessible at any time but this code is for once. please tell me where i should put the loop. :D
comment on: http://stackoverflow.com/q/26099119
score: 0
type: Comment

http://stackoverflow.com/comment/41023087
comment on: http://stackoverflow.com/q/26166542
score: 0
type: Comment
type: QuestionComment
has text: What? Where do you want to put the other 'if' statement? What error are you seeing? Why did you bracket out that section after 'str' was declared?

http://stackoverflow.com/comment/40788597
type: QuestionComment
comment on: http://stackoverflow.com/q/26037366
score: 0
has text: That's more like it. Have an up-vote. Now what exactly goes wrong? Is there an error message?
type: Comment

http://stackoverflow.com/a/26054668
answers question: http://stackoverflow.com/q/26054634
score: 1
has body: Your case START_STATE don't have a break. Then it will always go to next case witch is case FAIL_STATE: witch has a break. Your switch-case should follow this order. switch(condition){ case con1: // do something break; case con2: // do something break; default: // do something break; }
downvote count: 0
has comment: http://stackoverflow.com/comment/40818088
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40940623
comment on: http://stackoverflow.com/a/26122294
has text: thanks for pointing it out!! Missed this post in my search
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41115300
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26134827
has text: I am not sure what kind of comment you expect. Issue does not seem to be in configuration. Again, what do you mean it is "not working"? How are you using these caches? Can you post other configuration files that are relevant, like the SpringMVC one, or code snippets, logs, etc ...

http://stackoverflow.com/q/26063639
linked to: http://stackoverflow.com/q/14429242
score: 1
tagged with: java
has body: I have two JList controls side by side. And few buttons in between them. The layout looks fine when I run from eclipse. But if I run the exported jar file, the left occupies more space. I don't know why it's doing this. I place them in a GridBagLayout like this. mLstMdlTestSuitesAvailable = new DefaultListModel&lt;String&gt;(); mLstTestSuitesAvailable = new JList&lt;String&gt;(); mLstTestSuitesAvailable.setModel(mLstMdlTestSuitesAvailable); mLstTestSuitesAvailable.setMinimumSize(new Dimension(100, 100)); JScrollPane scrollPaneTestSuitesAvailable = new JScrollPane(mLstTestSuitesAvailable); GridBagConstraints gbcLstTestSuitesAvailable = new GridBagConstraints(); gbcLstTestSuitesAvailable.fill = GridBagConstraints.BOTH; gbcLstTestSuitesAvailable.weightx = 10; gbcLstTestSuitesAvailable.gridwidth = 10; gbcLstTestSuitesAvailable.weighty = 8; gbcLstTestSuitesAvailable.gridheight = 8; gbcLstTestSuitesAvailable.insets = new Insets(0, 11, 10, 11); gbcLstTestSuitesAvailable.gridx = 0; gbcLstTestSuitesAvailable.gridy = 1; panel.add(scrollPaneTestSuitesAvailable, gbcLstTestSuitesAvailable); mLstMdlTestSuitesSelected = new DefaultListModel&lt;String&gt;(); mLstTestSuitesSelected = new JList&lt;String&gt;(); mLstTestSuitesSelected.setModel(mLstMdlTestSuitesSelected); GridBagConstraints gbcLstTestSuitesSelected = new GridBagConstraints(); gbcLstTestSuitesSelected.fill = GridBagConstraints.BOTH; gbcLstTestSuitesSelected.weightx = 10; gbcLstTestSuitesSelected.gridwidth = 10; gbcLstTestSuitesSelected.weighty = 8; gbcLstTestSuitesSelected.gridheight = 8; gbcLstTestSuitesSelected.insets = new Insets(0, 11, 10, 11); gbcLstTestSuitesSelected.gridx = 15; gbcLstTestSuitesSelected.gridy = 1; JScrollPane scrollPaneTestSuitesSelected = new JScrollPane(mLstTestSuitesSelected); panel.add(scrollPaneTestSuitesSelected, gbcLstTestSuitesSelected); Can anyone please help me figure out what's going wrong here?
tagged with: gridbaglayout
answer count: 3
tagged with: layout
downvote count: 0
linked to: http://stackoverflow.com/q/7881925
favorite count: 0
has comment: http://stackoverflow.com/comment/40834717
linked to: http://stackoverflow.com/q/7222161
tagged with: jlist
has comment: http://stackoverflow.com/comment/40834453
has comment: http://stackoverflow.com/comment/40836003
has answer: http://stackoverflow.com/a/26063890
has answer: http://stackoverflow.com/a/26064952
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has title: JList control size changes while running the jar file
has answer: http://stackoverflow.com/a/26063907
type: Question

http://stackoverflow.com/q/26081635
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40867635
has title: How to debug web service application in eclipse?
tagged with: jakarta-ee
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40867678
has body: I am learning Java EE technologies. Is there a way I can use Eclipse debugger to step through the code and see how it works step by step? For instance, this is a simple html5 + restful service. Is there any way I can debug from the index.html java script, and step through the code little by little in Eclipse? That would be the best way to study this stuff. Thanks a lot. /** * A simple CDI service which is able to say hello to someone * * @author Pete Muir * */ public class HelloService { String createHelloMessage(String name) { return "Hello " + name + "!"; } } @Path("/") public class HelloWorld { @Inject HelloService helloService; @POST @Path("/json/{name}") @Produces("application/json") public String getHelloWorldJSON(@PathParam("name") String name) { System.out.println("name: " + name); return "{\"result\":\"" + helloService.createHelloMessage(name) + "\"}"; } /** A simple rest service saying hello */ @POST @Path("/xml/{name}") @Produces("application/xml") public String getHelloWorldXML(@PathParam("name") String name) { System.out.println("name: " + name); return " " + helloService.createHelloMessage(name) + " "; } } Then, the front end html 5 + java script. HTML5 + REST Hello World HTML5 + REST Hello World Name
downvote count: 0
tagged with: javascript
has answer: http://stackoverflow.com/a/26082236
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40867869

http://stackoverflow.com/a/43702908
has body: This might be too late. But since there is no proper answer to this yet, I'd like to post my workaround for this issue. I tried harism's answer and it needs to be used like this. So if you have an array-list of bitmaps, first you need to save a copy of the bitmap using Bitmap.copy(Bitmap.Config config, boolean isMutable) method. Then when you are going to using the bitmap, do not directly use the bitmap, instead get a copy of the bitmap using the same copy method, and that copied bitmap should be used in your application. The bottom line is once a bitmap is used multiple times, it will be recycled.So what I have done is to avoid using the original bitmap, I take copies of the original bitmap and use them.
answers question: http://stackoverflow.com/q/26073953
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/103342912
score: 0
type: AnswerComment
type: Comment
has text: _two flaws:_ an already existing value is not inserted and the solution busts with `ArrayIndexOutOfBoundsException` for values greater 9…
comment on: http://stackoverflow.com/a/57559905

http://stackoverflow.com/a/26094150
type: Answer
score: 2
upvote count: 2
has body: The first one is an integer division really. It divides an integer by another integer (the result of which is again an integer) and assigns the result to a double variable. Only the second one yields a double as result. integer / integer =&gt; result is integer, even though assigned to a double variable integer or double / double =&gt; result is double
answers question: http://stackoverflow.com/q/26094135
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26094135

http://stackoverflow.com/a/26046881
has comment: http://stackoverflow.com/comment/41052934
has comment: http://stackoverflow.com/comment/40804587
upvote count: 2
has comment: http://stackoverflow.com/comment/40804913
has body: You could use the annotation @JoinTable after the @OneToOne to point the card's table, so you won't need an entity for card, but if the card's table isn't just a relational table, you could map card in User as @OneToOne and have a @Transient 'getAddress()' method that returns 'this.card.getAddress()', but on card's entity you must map the relation between Address and Card(@OneToOne(mappedBy='card_id')), and in Address you could map card_id as @Id. First Alternative Customer: @OneToOne @JoinTable(name="card", joinColumns = @JoinColumn(name="cust_id"), inverseJoinColumns = @JoinColumn(name="card_id")) private Address address; Second alternative Customer: @OneToOne(mappedBy="cust_id") private Card card; ... @Transient public Address getAddress(){ return this.card == null ? null : this.card.getAddress(); } Card: @OneToOne(mappedBy="card_id") private Address address; Address: @Id private String card_id; In the Second case Card has a Embedded pk which is formed by two fks(Customer and Address) Card: @EmbeddedId private CustomerAddressPK id; CustomerAddressPK @Embeddable public class CustomerAddressPK(){ private String cust_id; private String card_id; }
type: Answer
has comment: http://stackoverflow.com/comment/40805479
has comment: http://stackoverflow.com/comment/40805457
has comment: http://stackoverflow.com/comment/40806110
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26046275

http://stackoverflow.com/a/26045911
has body: Inside your switch statement you have case only for +, so initializing operator to 0 or null will match nothing but default case. Better initialize it with +
score: 0
answers question: http://stackoverflow.com/q/26045839
type: Answer

http://stackoverflow.com/comment/40807072
type: QuestionComment
comment on: http://stackoverflow.com/q/26048684
has text: Have you tried [`Arrays.sort()`](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort%28byte[]%29)?
score: 0
type: Comment

http://stackoverflow.com/q/26069175
has comment: http://stackoverflow.com/comment/40844836
tagged with: java
type: Question
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/40845036
has comment: http://stackoverflow.com/comment/40844693
tagged with: user-interface
answer count: 1
tagged with: config
has body: I need to save some ui preferences selected by the admin, thinks like list of columns names to display in a table and other such display data that can be configured from the ui itself. Once its configured it will be saved in a file and then the file will be read subsequently to determine the display details and also send that data to backend service for querying. As its purely for ui purposes, I don't want to store it in the core module or in the backend DB, but would like to store it in the web module along side the html/jsp files. Has anyone done something like this - I was trying to figure out if there is a easy way to write files from jsp/html but it doesnt seem to be straightforward. If that is not recommended, any other suggestions on dealing with this scenario will be appreciated. Thanks.
has comment: http://stackoverflow.com/comment/40845089
has title: Where to store UI config in a java web app and read-write the config file from jsp page
has comment: http://stackoverflow.com/comment/40844864
has comment: http://stackoverflow.com/comment/40844898
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26069538
has comment: http://stackoverflow.com/comment/40844950

http://stackoverflow.com/q/26139618
upvote count: 1
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26139678
has title: How to force Intellij Idea to redesign/redraw my classes based on new code style?
tagged with: intellij-idea
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has body: I'm using Android studio and I just configured Java code style (File&gt;Settings&gt;Code Style&gt;Java&gt;Wrapping and Braces) in a way that displays "{" in new line after class and method definitions. However, by click on Apply and OK buttons nothing happens although in preview I saw the change. I restarted the IDE but nothing has changed :( Any suggestion would be appreciated. Thanks
has answer: http://stackoverflow.com/a/26139678
tagged with: android-studio
type: AnsweredQuestion

http://stackoverflow.com/q/26035616
has answer: http://stackoverflow.com/a/26035665
has comment: http://stackoverflow.com/comment/40782560
has answer: http://stackoverflow.com/a/26035641
score: 0
answer count: 2
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/26035641
favorite count: 0
has body: As a Java programmer, the concept of CLI seems unclear to me. Does developing a C# application imply that the exact same binary executable only has to be compiled once and can then be executed on Windows if .NET framework is installed and on Linux with Mono installed? If so, how does that work?
has comment: http://stackoverflow.com/comment/40783205
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26035665
tagged with: java
type: Question
tagged with: c++-cli
tagged with: c#
has title: How does Common Language Infrastructure work and what is its purpose?

header
type: Tag
tags question: http://stackoverflow.com/q/26186261
tags question: http://stackoverflow.com/q/26080988
tag name: header

http://stackoverflow.com/q/26077009
downvote count: 0
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has answer: http://stackoverflow.com/a/26208321
type: Question
tagged with: imageview
has title: SceneBuilder coordinates vs. JavaFX coordinates
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to make a game using JavaFX with FXML and scenebuilder. Currently I'm trying to make an event where when the user moves the player image to another image onscreen, and presses space, a small window pops up(supposed to be a shop like thing). The problem is that the images when running in the application are different than what they are in scenebuilder. I'm assuming that in the application, I'm getting the coordinates for the picture in respect to their origin as opposed to the view it's in. Is there a way to get the coordinates in respect to the scene it's in, or am I going about this wrong?
tagged with: fxml

http://stackoverflow.com/comment/40901354
type: QuestionComment
comment on: http://stackoverflow.com/q/26096173
has text: @EmreAltun See http://www.dba-oracle.com/t_ora_01461_can_bind_a_long_value_only_for_insert_into_a_long_column.htm
score: 0
type: Comment

http://stackoverflow.com/a/26178281
has comment: http://stackoverflow.com/comment/41044236
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26178156
has comment: http://stackoverflow.com/comment/41044299
accepted answer of: http://stackoverflow.com/q/26178156
has body: This has nothing to do with any new language features of Java. The term "leftmost" pertains simply to the earliest-occurring catch clause. Picture the code as a one-dimensional sequence of tokens, extending from left to right. That is how the language parser sees it. Therefore all that stipulation states is that the first matching catch-clause is entered.
has comment: http://stackoverflow.com/comment/41044278
score: 6

http://stackoverflow.com/q/26104459
favorite count: 0
has title: Converted JNDI name [java:comp/env/***] not found before reading the properties file
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/40925162
tagged with: properties
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40979482
tagged with: jndi
tagged with: configuration
has body: Good Mornig. I have an application in tomcat 8, java 1.7, Spring 3.2.2 and primefaces 5.0. When the application starts, it shows the next debug message in console: Looking up JNDI object with name [java:comp/env/etl.csv.token] localhost-startStop-1: org.springframework.jndi.JndiLocatorDelegate Converted JNDI name [java:comp/env/etl.csv.token] not found But the key isn't in the JNDI context. It is in a properties file. The application works fine and takes the property from the properties file, but i can't understand why spring is trying to find the property in the JNDI context The properties file is like this: database.driverClassName=org.postgresql.Driver database.initialSize=3 database.maxActive=15 database.maxIdle=10 database.minIdle=3 database.maxWait=10000 etl.csv.token=, And its properties are used like this: &lt;bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"&gt; &lt;property name="driverClassName" value="${database.driverClassName}" /&gt; &lt;property name="url" value="${database.url}" /&gt; &lt;property name="username" value="${database.username}" /&gt; &lt;property name="password" value="${database.password}" /&gt; &lt;property name="initialSize" value="${database.initialSize}" /&gt; &lt;property name="maxActive" value="${database.maxActive}" /&gt; &lt;property name="maxIdle" value="${database.maxIdle}" /&gt; &lt;property name="maxWait" value="${database.maxWait}" /&gt; &lt;property name="minIdle" value="${database.minIdle}" /&gt; &lt;property name="testOnBorrow" value="true" /&gt; &lt;property name="validationQuery" value="SELECT CURRENT_TIMESTAMP" /&gt; &lt;property name="removeAbandoned" value="true" /&gt; &lt;/bean&gt; For all properties, the behaviour is the same. I would like that message does not appear Sorry for the english, is not my native language Any help will be apreciated.
upvote count: 1

http://stackoverflow.com/comment/41065592
has text: primitive default will be set - `0` in case `if` is not satisfied. Please correct me if I am not.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26189324

http://stackoverflow.com/comment/40823731
type: AnswerComment
type: Comment
has text: modified the ans check now.
comment on: http://stackoverflow.com/a/26055441
score: 0

http://stackoverflow.com/comment/40878406
type: QuestionComment
has text: got it fixed with below given change, now the key on same reducer are getting sorted properly.
score: 0
comment on: http://stackoverflow.com/q/26072962
type: Comment

http://stackoverflow.com/comment/40871031
type: AnswerComment
has text: lib,src,target,nbactions,pom which content needs to copy
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26083733

http://stackoverflow.com/q/26052726
has body: I want to copy JSON fields from one file to another but only after the field satisfies a particular condition, as for example {"dataset": [ {"album_id":1, "album_type":"Live Performance", "artist_name":"John Doe",.... } ] } I want to copy only those records which have a user given artist_name or any other property, else skip the tuple for copying. I am using the following code to add the filtered records to a JSONObject "wr" which I then write to my output file. But its not giving me the desired results public static void dumpJSONElement(JsonElement element) { if (element.isJsonObject()) { JsonObject obj = element.getAsJsonObject(); java.util.Set&lt;java.util.Map.Entry&lt;String,JsonElement&gt;&gt; entries = obj.entrySet(); java.util.Iterator&lt;java.util.Map.Entry&lt;String,JsonElement&gt;&gt; iter = entries.iterator(); while (iter.hasNext()) { java.util.Map.Entry&lt;String,JsonElement&gt; entry = iter.next(); if(entry.getKey().equals(filterKey)){ if(! entry.getValue().toString().replace("\"", "").equals(filterValue)){ wr.put(entry.getKey(), entry.getValue()); } } else{ wr.put(entry.getKey(), entry.getValue()); } dumpJSONElement(entry.getValue()); } } else if (element.isJsonArray()) { JsonArray array = element.getAsJsonArray(); java.util.Iterator&lt;JsonElement&gt; iter = array.iterator(); while (iter.hasNext()) { JsonElement entry = iter.next(); dumpJSONElement(entry); } } else if (element.isJsonPrimitive()) { JsonPrimitive value = element.getAsJsonPrimitive(); } else if (element.isJsonNull()) { } else { System.out.println("Error. Unknown type of element"); } }
tagged with: parsing
score: 2
downvote count: 0
has title: Copy filtered JSON data from one file to another using gson library in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26079918
has comment: http://stackoverflow.com/comment/40814608
type: Question
tagged with: filtering
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
upvote count: 2
has comment: http://stackoverflow.com/comment/40814441
answer count: 2
has comment: http://stackoverflow.com/comment/40814382
favorite count: 0
has answer: http://stackoverflow.com/a/26053083

querying
type: Tag
tags question: http://stackoverflow.com/q/26085322
tag name: querying

http://stackoverflow.com/q/26193427
has comment: http://stackoverflow.com/comment/41072434
tagged with: object
has body: I have two classes(f.e. Car and Bicycle). Objects of both classes are sent to management layer, where they are used. I send every object to that layers by calling layerHandler.objectReceived(object); LayerHandler then need to store this object in its HashMap (im using Object because objects which will be stored there are not same type...(Car and Bicycle)) LayerHandler has other method called actionFired(String message, Object object); Second parameter 'object' belongs to Car or Bicycle class and is already stored in LayerHandler's HashMap. When this method occures, I need to find related object which is stored in HashMap. Right now Im using object.toString() as key value for hashmap. Both type of objects use defaut toSting() method which is not overriden. Im not going to show whole structure of my project here, but Im using HashMap for a reason. (I know ArrayList get(Object obj) method would be nice here, but I must use HashMap) I need to know, whether toString() will always returns same value which wont change over time so I will be able to use that as a key for my HashMap.
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
possible better answer: http://stackoverflow.com/a/26195082
has answer: http://stackoverflow.com/a/26195082
type: Question
has answer: http://stackoverflow.com/a/26193518
answer count: 2
has comment: http://stackoverflow.com/comment/41072364
score: 0
has title: Does the not overriden toString() method always return same value for object?
accepted answer: http://stackoverflow.com/a/26193518

http://stackoverflow.com/a/26100929
has body: Yes, you can replace separate imports of classes that belong to one package by single import of "all" classes in the package by using import android.hardware.*; To prevent other questions I want to note that it does not affect neither performance nor memory consumption. I however do not like and do not recommend this style because it sometimes causes some surprises when you import "wrong" class from other package. Usually IDE manages import statement very well, so you do not have to care about them at all, so I IMHO prefer using implicit import statements for each class. Concerning to inner classes. In your example you do not have even one inner class, but if you have you have to specify the fully qualified class name exactly as in case of top level classes.
score: 3
accepted answer of: http://stackoverflow.com/q/26100766
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26100766
type: Answer

http://stackoverflow.com/q/26192829
has comment: http://stackoverflow.com/comment/41071366
answer count: 3
tagged with: ibm-sterling
has title: Exception in thread "main" java.lang.ExceptionInInitializerError while trying to run ST312_TestMain class
has answer: http://stackoverflow.com/a/26978427
type: UnansweredQuestion
has body: I am trying to call "getOrderList" from the ST312_TestMain class. I am getting the java.lang.ExceptionInInitializerError for the below mentioned class. package com.Main; import org.w3c.dom.Document; import com.yantra.ycp.core.YCPContext; import com.Main.XMLUtil; import com.Main.SterlingUtil; public class ST312_TestMain { public static void main(String[] args) throws Exception { String ServiceName = "getOrderList"; String sServiceFlag = "N"; Document dTemplate = null; //ServiceName = "SendDN"; //sServiceFlag = "Y"; Document inputXML=null; inputXML = XMLUtil.getDocument("&lt;Order OrderHeaderKey='201407181105267340509' /&gt;"); //inputXML = XMLUtil.getXmlFromFile("src/Test.xml"); dTemplate = XMLUtil.getDocument("&lt;Order OrderHeaderKey='' OrderNo=''/&gt;"); if (args.length == 3) { ServiceName = args[0]; sServiceFlag = args[1].equals("Y") ? "Y" : "N"; inputXML = XMLUtil.getXmlFromFile(args[2]); } else { System.out .println("Usage: TestMain &lt;API/Service Name&gt; &lt;API/Service(N/Y)&gt; &lt;Input XML File&gt;"); System.out .println("No Input received using preset XML to call preset Service"); System.out.println("Service Name=" + ServiceName); } ***YCPContext env = new YCPContext("admin", "admin");*** System.out.println("Input XML \n" + XMLUtil.getXmlString(inputXML)); try { Document outputXML = null; if ("Y".equals(sServiceFlag)) { outputXML = SterlingUtil.callService(env, inputXML, ServiceName, null); } else { outputXML = SterlingUtil.callAPI(env, inputXML, ServiceName, dTemplate); } env.commit(); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Service Invocation Failed"); } } } The exception is as follows: Usage: TestMain &lt;API/Service Name&gt; &lt;API/Service(N/Y)&gt; &lt;Input XML File&gt; No Input received using preset XML to call preset Service Service Name=getOrderList log4j:WARN No appenders could be found for logger (com.yantra.ycp.core.YCPContext). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.…
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/35296922
has answer: http://stackoverflow.com/a/26193014
type: Question

http://stackoverflow.com/q/26171574
has body: Hi I am facing this error while starting my local Oracle Weblogic Server - &lt;Oct 2, 2014 5:07:17 PM PDT&gt; &lt;Critical&gt; &lt;WebLogicServer&gt; &lt;BEA-000386&gt; &lt;Server subsystem failed. Reason: java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredDocumentImpl.getXmlStandalone()Z java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredDocumentImpl.getXmlStandalone()Z at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:679) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:723) Truncated. see log file for complete stacktrace &gt; &lt;Oct 2, 2014 5:07:17 PM PDT&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to FAILED&gt; &lt;Oct 2, 2014 5:07:17 PM PDT&gt; &lt;Error&gt; &lt;WebLogicServer&gt; &lt;BEA-000383&gt; &lt;A critical service failed. The server will shut itself down&gt; &lt;Oct 2, 2014 5:07:17 PM PDT&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to FORCE_SHUTTING_DOWN&gt; Please help!
has comment: http://stackoverflow.com/comment/41036817
has comment: http://stackoverflow.com/comment/41033327
answer count: 0
tagged with: java
type: Question
has title: Error while starting Oracle Weblogic Local Server 11g
tagged with: weblogic
has comment: http://stackoverflow.com/comment/41051646
score: 0
has comment: http://stackoverflow.com/comment/41056184
tagged with: apache
type: UnansweredQuestion

http://stackoverflow.com/a/26125483
has body: There certainly is some guessing involved, regarding the actual intention and use-case where you encountered this problem. Additionally, it is not entirely clear what something, somethingElse and yetAnotherThing are (where they come from and where they should go). However, based on the information that you provided, and as an addition to (or rather extension or generalization of) the answer by slartidan: The difference between these dummy calls that you sketched there seem to be The String argument that is passed to the get method The Callback that is called Which method is executed next You could factor out these parts: The String argument and the Callback could be passed as parameters to a general method that creates a Callable. The sequence of the calls could simply be defined by placing these Callable objects into a list, in the appropriate order, and execute them all with a single threaded executor service. As you can see in the main method of this example, the sequence of calls can then be configured rather easily: import java.util.Arrays; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ChainedAsyncTest { public static void main(String[] args) throws InterruptedException { ChainedAsyncTest t = new ChainedAsyncTest(); ExecutorService e = Executors.newFixedThreadPool(1); e.invokeAll(Arrays.asList( t.call("/something", t.somethingCallback), t.call("/something/else", t.somethingElseCallback), t.call("/yet/another/thing", t.yetAnotherThingCallback), t.allDone())); } private Callback somethingCallback = new Callback() { @Override public void onComplete(String data) { updateUi("something", data); } }; private Callback somethingElseCallback = new Callback() { @Override public void onComplete(String data) { updateUi("somethingElse", data); } }; private Callback yetAnotherThingCallback = new Callback() { @Override public void onComplete(String data) { updateUi("yetAnotherThing", data)…
answers question: http://stackoverflow.com/q/26059300
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/41113976
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41113398
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26059300

http://stackoverflow.com/comment/40905279
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26096970
type: Comment
has text: yeah, you are right!!! I exported the folder from hdfs to a loca directory and checked that the files with tilde sign are not there. Again the size of those files in hdfs shows to be 0.

http://stackoverflow.com/comment/104229249
comment on: http://stackoverflow.com/a/37966649
type: Comment
has text: @BahadirTasdemir we've set time zone in application.properties as `spring.jackson.time-zone=IST` will that be enough for the above mentioned zone
score: 0
type: AnswerComment

http://stackoverflow.com/q/26159380
has comment: http://stackoverflow.com/comment/41010941
has answer: http://stackoverflow.com/a/26159497
has answer: http://stackoverflow.com/a/26159606
score: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has body: I want to check whether a session exists or not in a webpage, however on doing so if, session does not exists compiler receives a NullPointerException. How to check a session so that it does not produce this Exception? Consider, session does not exist try { HttpSession currentsession=request.getSession(false); if(currentsession==null) || currentsession.getAttribute("current-emailID").equals(null)) { //Code to redirect to default page } } catch(NullPointerException npe) { //Code to redirect to default page }
has title: How to check whether a session exists?
has comment: http://stackoverflow.com/comment/41009088
tagged with: session
tagged with: java
has comment: http://stackoverflow.com/comment/41062549
has comment: http://stackoverflow.com/comment/41009321
has comment: http://stackoverflow.com/comment/41009114
type: Question
answer count: 2

http://stackoverflow.com/comment/40913718
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26106829
has text: @nem in that case, I have mis-understood the question. Not sure you would re-invent the sort algo's builtin but I assume it is home work.
score: 0

http://stackoverflow.com/comment/40885003
type: AnswerComment
comment on: http://stackoverflow.com/a/26091115
has text: Yeah sry i was just in a hurry to install eclipse and see if everything fince xD
score: 0
type: Comment

http://stackoverflow.com/comment/40842750
comment on: http://stackoverflow.com/a/26067861
score: 0
type: AnswerComment
has text: the extra slash was formatting issue with this editor. I have only 2 slashes, it doesn't work
type: Comment

http://stackoverflow.com/q/26100896
score: 0
tagged with: dbpedia
has comment: http://stackoverflow.com/comment/40906185
has comment: http://stackoverflow.com/comment/40906488
answer count: 0
tagged with: query-optimization
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17111903
tagged with: similarity
has body: I have a question: I'm following this post (To use iSPARQL to compare values using similarity measures) to use SPARQL to compare values using similarity measures. In particular, I have used this code: select ?city ?percent where { ?city a dbpedia-owl:City ; rdfs:label ?label . filter langMatches( lang(?label), 'en' ) bind( replace( concat( 'x', str(?label) ), "^x[^Londn]*([L]?)[^ondn]*([o]?)[^ndn]*([n]?)[^dn]*([d]?)[^n]*([n]?).*$", '$1$2$3$4$5' ) as ?match ) bind( xsd:float(strlen(?match))/strlen(str(?label)) as ?percent ) } order by desc(?percent) limit 100 where I dynamically calculate this string for all my resources. 'x', str(?label) ), "^x[^Londn]([L]?)[^ondn]([o]?)[^ndn]([n]?)[^dn]([d]?)[^n]([n]?).$", '$1$2$3$4$5' The execution time of this query is about 40 seconds with an excellent PC. When I have a big dataset, this program is impossible to use! My question is: Is there a way to optimize this query to dramatically reduce the execution time? Alternatively, how can I achieve the goal of identifying a resource like this on DBpedia in a reasonable amount of time (about 1 second)?
tagged with: sparql
tagged with: java
linked to: http://stackoverflow.com/q/17954399
has comment: http://stackoverflow.com/comment/40907102
type: Question
linked to: http://stackoverflow.com/q/24557020
has comment: http://stackoverflow.com/comment/40905782
has title: How I can optimize a query to compare values using similarity measures
has comment: http://stackoverflow.com/comment/40905545

http://stackoverflow.com/comment/41061107
score: 0
comment on: http://stackoverflow.com/q/26186875
type: QuestionComment
has text: not according to jsonlint.com
type: Comment

http://stackoverflow.com/comment/40838697
score: 0
has text: how do you calling homebean? i made a correction in my answer <context:component-scan base-package="br.com.allinone.bean, br.com.allinone.service,br.com.allinone.service.impl"/>
type: Comment
comment on: http://stackoverflow.com/a/26065560
type: AnswerComment

http://stackoverflow.com/a/26076408
has comment: http://stackoverflow.com/comment/40857868
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26076327
has body: as assylias said in the comments: You can use the -target 1.6 flag when compiling with javac If you're using an IDE (NetBeans, for example) the option for the target framework would be somewhere in the project properties. In NetBeans: Right click the project -> Properties -> Libraries tab -> Java Platform. Note, you will need the older JDK installed (and referenced) in order to be able to do this.
downvote count: 0
has comment: http://stackoverflow.com/comment/40857714
type: Answer

http://stackoverflow.com/comment/41027618
comment on: http://stackoverflow.com/q/26168846
has text: I just checked the 4rth edition - now the text says after the example cited above - `Although the first form is useful, it’s more limited because it can only be used at the point where the array is defined. You can use the second and third forms anywhere, even inside a method call. For example, you could create an array of String objects to pass to the main( ) of another method, to provide alternate command-line arguments to that main( ):`.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/26118090
has answer: http://stackoverflow.com/a/26118612
type: Question
favorite count: 0
possible better answer: http://stackoverflow.com/a/26118140
has answer: http://stackoverflow.com/a/26126636
has answer: http://stackoverflow.com/a/26118140
tagged with: lambda
tagged with: java-8
upvote count: 16
tagged with: guava
tagged with: java
answer count: 3
has body: You have already seen this many times yourself, of that I'm sure: public SomeObject findSomeObject(Arguments args) { SomeObject so = queryFirstSource(args); // the most likely source first, hopefully if (so != null) return so; so = querySecondSource(args); // a source less likely than the first, hopefully if (so != null) return so; so = queryThirdSource(args); // a source less likely than the previous, hopefully if (so != null) return so; // and so on } We have different sources where an object we search could be. As a more vivid example we could image that we first check if a userid is in a list of privileged users. If not we check if the userid is in the list of allowed users. Else we return null. (It's not the best example but I hope it's a vivid-enough one.) Guava offers us some helpers that could beautify that code above: public SomeObject findSomeObject(Arguments args) { // if there are only two objects return com.google.common.base.Objects.firstNonNull(queryFirstSource(args), querySecondSource(args)); // or else return com.google.common.collect.Iterables.find( Arrays.asList( queryFirstSource(args) , querySecondSource(args) , queryThirdSource(args) // , ... ) , com.google.common.base.Predicates.notNull() ); } But, as the more experienced among us will have already seen, this may perform bad if the lookups (i.e. queryXXXXSource(args)) take a certain amount of time. This is because we now query all sources first and then pass the results to the method that finds the first among those results which is not null. In contrast to the first example, where the next source is only evaluated when the former does not return something, this second solution may look better at first but could perform much worse. Here's where we come to my actual question and to where I suggest something of that I hope someone has already implemented the base of it or of that someone might propose a even smarted solution. In plain English: Has someone already implemented such a defferedFirstN…
accepted answer: http://stackoverflow.com/a/26126636
type: AnsweredQuestion
downvote count: 0
score: 16
has title: Is there an elegant way to get the first non null value of multiple method returns in Java?

http://stackoverflow.com/q/26138764
tagged with: system
tagged with: solrj
has body: I want to index my system each files and folders information into solr. Is there any handler in solr to do it? I can index any file using data import handler using below command curl "http://localhost:8983/solr/update/extract?ext.idx.attr=true\&amp;ext.def.fl=text&amp;commit=true" -F "myfile=@tmp1.txt" But i want to index my whole system into solr.
type: AnsweredQuestion
tagged with: solr
type: Question
has title: Index my Hard drive into solr
has answer: http://stackoverflow.com/a/26139602
accepted answer: http://stackoverflow.com/a/26139602
tagged with: java
tagged with: search
score: 0
answer count: 1

http://stackoverflow.com/q/26071139
upvote count: 2
has body: I want to use spring-integration-aws to upload and read files from amazon s3 in my spring application (full java configured). This example do exactly what I want to do : https://github.com/spring-projects/spring-integration-extensions/tree/master/samples/aws-s3 But it use xml configuration which I can't translate in java configuration. Can anybody help me.
answer count: 1
tagged with: spring-integration
tagged with: amazon-s3
tagged with: java
type: UnansweredQuestion
has title: spring-integration-aws java configuration
has answer: http://stackoverflow.com/a/26072116
score: 2
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
type: Question
tagged with: spring

http://stackoverflow.com/comment/40896260
type: Comment
type: QuestionComment
has text: You don't have to implement `compareTo()` again. Your `Student` class already defines one and it will be used when you call `Collections.sort()`. And please rename the name of *class*. `Class` is already an inbuilt class in java.
comment on: http://stackoverflow.com/q/26097379
score: 0

http://stackoverflow.com/q/26184693
upvote count: 2
score: 2
has answer: http://stackoverflow.com/a/26184855
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41056868
tagged with: java
has comment: http://stackoverflow.com/comment/41056956
has title: TableLayout removeAllViews not removing children
type: Question
tagged with: debugging
tagged with: tablelayout
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26184855
tagged with: android
has body: In my refresh method I clear the TableRow elements to make room for the new button array and also try to clear the TableLayout to make room for the freshly updated TableRows, but I keep getting an error saying TableLayout isn't cleared. It would appear table.remveAllViews(); isn't working. MainActivity.java: package com.example.tilegame; import java.util.ArrayList; import java.util.Collections; import java.util.List; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TableRow.LayoutParams; public class MainActivity extends ActionBarActivity implements OnClickListener { TableLayout table; Button buttons[]; int count = 0; int btnSize = 0; TableRow row; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnSize = (int)getResources().getDimension(R.dimen.box_size); table = (TableLayout)findViewById(R.id.table); buttons = new Button[9]; row = new TableRow(this); for(int x = 0; x < 9; x++) { if(x < 8) { Button btn = createButton(btnSize, false, x+1); buttons[x] = btn; } else if(x == 8) { Button btn = createButton(btnSize, true, x+1); buttons[x] = btn; } } randomizeArray(buttons); table.removeAllViews(); for(int x = 0; x < 3; x++) { TableRow row = new TableRow(this); for(int y = 0; y < 3; y++) { row.addView(buttons[count]); count++; } table.addView(row, x); } } public void onClick(View v) { switch(v.getId()) { case 0: swap(buttons, v.getId()); refresh(); break; case 1: swap(buttons, v.getId()); refresh(); break; case 2: swap(buttons, v.getId()); refresh(); break; case 3: swap(buttons, v.getId()); refresh(); break; case 4: swap(buttons, v.getId()); refresh(); break…
favorite count: 0

http://stackoverflow.com/a/26159091
score: 1
answers question: http://stackoverflow.com/q/26159011
downvote count: 0
type: Answer
has body: You should start from len - 1, because indexes are zero based. Change your last loop this way : for( int i = len-1; i &gt;= 0 ; i--) { invarr[k] = array[i]; System.out.println(invarr[k]); k++; }
upvote count: 1

http://stackoverflow.com/comment/40788058
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26038532
has text: Use a debugger. 1. Put a breakpoint on the method. 2. Run the program. 3. Look at the stacktrace when the program halts at the breakpoint.
type: QuestionComment

http://stackoverflow.com/comment/40831963
has text: @CarlManaster that took care of the error on the assertTrue line, thanks, but my tests still fail.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26050559
score: 0

http://stackoverflow.com/q/26079101
has comment: http://stackoverflow.com/comment/40863159
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/40862636
type: Question
has comment: http://stackoverflow.com/comment/40862466
has comment: http://stackoverflow.com/comment/40862527
has comment: http://stackoverflow.com/comment/40863111
has body: I'm wondering whether it is possible to insert a Fragment into a Preference. Basically I made a Fragment containing an array of EditText's for logging in. I want to reuse this Fragment in multiple places, so it would be really convenient to just insert the Fragment anywhere I need it and have it check whether the credentials are correct. At the moment, I'm inflating the Fragment's associated layout into the Preference's View which I'm not too happy with because I'm doing the verification twice and doing the same thing (showing the login dialog) in two different ways only depending on where I need it. Any help is greatly appreciated!
has title: Insert a fragment into a preference node
score: 0
has comment: http://stackoverflow.com/comment/40862556
has comment: http://stackoverflow.com/comment/40863113

http://stackoverflow.com/comment/137783839
score: 0
comment on: http://stackoverflow.com/a/65237972
has text: @Saikat Did you get it working on property? Still not working for me with Jackson version 2.16.2.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26112036
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26092632
downvote count: 0
has body: Taken from this google group discussion. This uses a boolean done (an AtomicBoolean for thread safe ops in this case) and a while loop. import com.firebase.client.Firebase; import com.firebase.client.FirebaseError; import java.util.Date; import java.util.concurrent.atomic.AtomicBoolean; public class Demo { public static void main(String[] args) { final AtomicBoolean done = new AtomicBoolean(false); Firebase ref = new Firebase("https://testjava.firebaseio-demo.com/"); ref.setValue(new Date().toString(), new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { done.set(true); } }); while (!done.get()); } }
has comment: http://stackoverflow.com/comment/83962905
accepted answer of: http://stackoverflow.com/q/26092632
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/40927817
upvote count: 5
has comment: http://stackoverflow.com/comment/40941329

http://stackoverflow.com/comment/41358179
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Java security: how to clear/zero-out memory associated with an object? (And/or ensure that is the only instance/copy of a particular variable)](http://stackoverflow.com/questions/6473352/java-security-how-to-clear-zero-out-memory-associated-with-an-object-and-or-e)
comment on: http://stackoverflow.com/q/26121105

http://stackoverflow.com/comment/41032185
has text: `SceneBuilder`'s documentation says: _Deprecated. This class is deprecated and will be removed in the next version_
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26170789

http://stackoverflow.com/q/26066806
has body: I have a 3D file made in Blender and exported to java (.OBJ file), which has his textures separated into some files. Inside this .obj file, it has some fields caled USEMTL and the name of its parts (textures files). However, when I draw it at the screen, he only shows the last USEMTL name. My question is: How can i proceed to make him read and texturize at the correct way? Without lapping other textures? This is the class that have the .obj loader public MLoader(String path, Model m) throws IOException { @SuppressWarnings("resource") BufferedReader reader = new BufferedReader(new FileReader(new File(path))); String line; while ((line = reader.readLine()) != null) { if (line.startsWith("v ")) { float v1 = Float.valueOf(line.split(" ")[1]), v2 = Float.valueOf(line.split(" ")[2]), v3 = Float.valueOf(line.split(" ")[3]); Vector3f v = new Vector3f (v1, v2, v3); m.vertex.add(v); } if (line.startsWith("usemtl ")){ String name = String.valueOf(line.split(" ")[1]); m.nameTexture.add(name); continue; } if (line.startsWith("f ")) { float v1 = Float.valueOf(line.split(" ")[1].split("/")[0]), v2 = Float.valueOf(line.split(" ")[2].split("/")[0]), v3 = Float.valueOf(line.split(" ")[3].split("/")[0]), n1 = Float.valueOf(line.split(" ")[1].split("/")[1]), n2 = Float.valueOf(line.split(" ")[2].split("/")[1]), n3 = Float.valueOf(line.split(" ")[3].split("/")[1]); Vector3f v = new Vector3f (v1, v2, v3), n = new Vector3f (n1, n2, n3); m.face.add(new Faces(v, n)); }if (line.startsWith("vt ")) { float vt1 = Float.valueOf(line.split(" ")[1]), vt2 = Float.valueOf(line.split(" ")[2]); Vector2f vt = new Vector2f (vt1, vt2); m.vertexTexture.add(vt); } } } As you can see, I created a IF statement, just to get this usemtl stuff (that is inside .obj file) - the texture names (which are into separate files) just to see if I could bind them individually. But I'm having trouble to do that (perhaps, logic isn't in my side). How to proceed? Other classes: Texture Class public class Textures { public T…
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
has title: How to separately texturize (with different texture files) a 3D model?
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26204494
has answer: http://stackoverflow.com/a/26204494
has answer: http://stackoverflow.com/a/26076318
answer count: 2
tagged with: 3d
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26076318
type: AnsweredQuestion

http://stackoverflow.com/a/26062027
has comment: http://stackoverflow.com/comment/40831304
downvote count: 0
has comment: http://stackoverflow.com/comment/40831479
has comment: http://stackoverflow.com/comment/40831447
type: Answer
has comment: http://stackoverflow.com/comment/40831387
has comment: http://stackoverflow.com/comment/40831575
has body: You need to flush after write, it flushes the stream. PrintWriter#flush would do that. Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. PrintWriter#flush - Java doc Code Snippet - PrintWriter out = new PrintWriter("D:/log.txt"); out.println(result); out.flush(); out.close(); And do not forget to close the writer after use.
score: 5
has comment: http://stackoverflow.com/comment/40831532
upvote count: 5
answers question: http://stackoverflow.com/q/26061971

http://stackoverflow.com/q/26038026
accepted answer: http://stackoverflow.com/a/26121229
possible better answer: http://stackoverflow.com/a/40946618
tagged with: cordova
has answer: http://stackoverflow.com/a/50261967
has answer: http://stackoverflow.com/a/40946618
tagged with: java
answer count: 3
upvote count: 5
has answer: http://stackoverflow.com/a/26121229
type: AnsweredQuestion
has title: Including .jar file into cordova plugin
downvote count: 0
tagged with: phonegap-plugins
favorite count: 0
type: Question
score: 5
has body: I need to include 3rd party plugin .jar to my custom cordova plugin. I can't find any way to do this. f.e. some of my actual code looks like this (in plugin.xml): <source-file src="src/android/AztecReaderPlugin.java" target-dir="src/com/example/aztecreadermobilas" /> Libraries I need to include: /libs /armeabi /libAztecLibrary.so /armeabi_v2 /libAzteclibraryv2.so /AztecReader.jar

http://stackoverflow.com/a/38061562
upvote count: 260
has comment: http://stackoverflow.com/comment/101384015
downvote count: 0
has body: tl;dr Instant.now() java.time The troublesome old date-time classes bundled with the earliest versions of Java have been supplanted by the java.time classes built into Java 8 and later. See Oracle Tutorial. Much of the functionality has been back-ported to Java 6 & 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP. Instant An Instant represents a moment on the timeline in UTC with a resolution of up to nanoseconds. Instant instant = Instant.now(); The toString method generates a String object with text representing the date-time value using one of the standard ISO 8601 formats. String output = instant.toString(); 2016-06-27T19:15:25.864Z The Instant class is a basic building-block class in java.time. This should be your go-to class when handling date-time as generally the best practice is to track, store, and exchange date-time values in UTC. OffsetDateTime But Instant has limitations such as no formatting options for generating strings in alternate formats. For more flexibility, convert from Instant to OffsetDateTime. Specify an offset-from-UTC. In java.time that means a ZoneOffset object. Here we want to stick with UTC (+00) so we can use the convenient constant ZoneOffset.UTC. OffsetDateTime odt = instant.atOffset( ZoneOffset.UTC ); 2016-06-27T19:15:25.864Z Or skip the Instant class. OffsetDateTime.now( ZoneOffset.UTC ) Now with an OffsetDateTime object in hand, you can use DateTimeFormatter to create String objects with text in alternate formats. Search Stack Overflow for many examples of using DateTimeFormatter. ZonedDateTime When you want to display wall-clock time for some particular time zone, apply a ZoneId to get a ZonedDateTime. In this example we apply Montréal time zone. In the summer, under Daylight Saving Time (DST) nonsense, the zone has an offset of -04:00. So note how the time-of-day is four hours earlier in the output, 15 instead of 19 hours. Instant and the ZonedDateTime both represent the very same simultaneous moment, just vi…
has comment: http://stackoverflow.com/comment/110740384
has comment: http://stackoverflow.com/comment/84808591
has comment: http://stackoverflow.com/comment/110764274
score: 260
answers question: http://stackoverflow.com/q/26142864
has comment: http://stackoverflow.com/comment/110748104
has comment: http://stackoverflow.com/comment/101384879
has comment: http://stackoverflow.com/comment/102024469
has comment: http://stackoverflow.com/comment/110762607
type: Answer

http://stackoverflow.com/comment/40831109
score: 0
comment on: http://stackoverflow.com/q/26061899
has text: Please post code for listview and adapter
type: QuestionComment
type: Comment

directory
tags question: http://stackoverflow.com/q/26147201
tag name: directory
tags question: http://stackoverflow.com/q/26048340
tags question: http://stackoverflow.com/q/26110068
type: Tag
tags question: http://stackoverflow.com/q/26169696
tags question: http://stackoverflow.com/q/26103136
tags question: http://stackoverflow.com/q/26097282

http://stackoverflow.com/comment/41107246
type: Comment
score: 0
type: AnswerComment
has text: Ahh, sorry for misunderstanding :)
comment on: http://stackoverflow.com/a/26095452

http://stackoverflow.com/comment/41058632
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26184897
has text: Thank you. I can certainly make the switch w/o too much difficulty, but I'm wondering if my class really meets the singleton standard of needing to be the only instance. I certainly don't want to re-read the file (which having multiple instances would cause), but I keep coming back to the fact that this seems to be basically a bunch of constants for which I want to provide access via methods instead of directly. Hence the "fuzzy" in the title. I'm still torn, but will take the weekend to mull this over.
score: 0

http://stackoverflow.com/q/26036156
has body: I surfed a lot of questions on the board, about tcp sockets, big-endian and little-endian format but to me nothing apllies to my case. And I'm sorry for my bad English, I'm working on it :) I'm loosing my mind on an unexpected behaviour in a simple client-server configuration. Here's the scenario: Server (C++) &lt;--- TCP socket ---> Client(Java). Here's the client code: package NetServ.apps.bigServer.NSLPClient; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; import java.nio.charset.Charset; import java.util.ArrayList; public class Communicator { private Socket sock; private final int port = 6666; private final String address="127.0.0.1"; private DataOutputStream out; private DataInputStream in; public Communicator(){ System.out.println("Creating communicator. Trying to bind to the tcp socket"); try { sock = new Socket(address, port); out=new DataOutputStream(sock.getOutputStream()); in=new DataInputStream(sock.getInputStream()); } catch (UnknownHostException e) { System.out.println("Unable to resolv host"); e.printStackTrace(); } catch (IOException e) { System.out.println("Generic I/O exception"); e.printStackTrace(); } System.out.println("Communicator created"); } public void sendRequest(Request req) throws IOException{ int cmd=0; if(req.getCmd().equals(CommandType.tg_setup_message)) cmd=0; if(req.getCmd().equals(CommandType.tg_remove_message)) cmd=1; if(req.getCmd().equals(CommandType.tg_trigger_message)) cmd=2; if(req.getCmd().equals(CommandType.tg_probe_message)) cmd=3; byte[] buff; Charset charset = Charset.forName("ISO-8859-1"); out.writeInt(cmd); //out.writeUTF(req.getDstAddr().toString().substring(1)); buff = req.getDstAddr().toString().substring(1).getBytes(charset); out.writeShort((short)buff.length); out.write(buff, 0, buff.length); out.writeInt(req.getProtocol()); out.writeInt(req.getSecure()); //out.writeUTF(req.g…
tagged with: c++
score: 2
upvote count: 2
tagged with: sockets
accepted answer: http://stackoverflow.com/a/26124696
type: AnsweredQuestion
tagged with: java
tagged with: dataoutputstream
has title: Unexpected behaviour in TCP socket connection Java Client<-> c++ server
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26038366
tagged with: endianness
favorite count: 0
has answer: http://stackoverflow.com/a/26038366
has answer: http://stackoverflow.com/a/26124696

http://stackoverflow.com/a/26194407
accepted answer of: http://stackoverflow.com/q/26194289
has body: Classes don't have keyword "new" as a personal method or anything like that. It is the Java language itself that has the keyword "new". So in other words you put "new" in the code the compiler would recognize it and instantiate a new Object. http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9- this link is the documentation of Java language, in section 3.9 it shows all the keywords. Edit: Like others are saying, what the snippet of code in your question indicates an inner class, so for instance, like it says in http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html public class ShadowTest { public int x = 0; class FirstLevel { public int x = 1; void methodInFirstLevel(int x) { System.out.println("x = " + x); System.out.println("this.x = " + this.x); System.out.println("ShadowTest.this.x = " + ShadowTest.this.x); } } public static void main(String... args) { ShadowTest st = new ShadowTest(); ShadowTest.FirstLevel fl = st.new FirstLevel(); fl.methodInFirstLevel(23); } } The following is the output of this example: x = 23 this.x = 1 ShadowTest.this.x = 0 This shows that the innerclass or class B(FirstLevel) is like or similar to the outer class's variables and methods(for it is associated with the instance of the outer class) of class A(ShadowTest).
answers question: http://stackoverflow.com/q/26194289
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26076725
accepted answer: http://stackoverflow.com/a/26081453
favorite count: 0
has title: ComboBox not showing bound values
has comment: http://stackoverflow.com/comment/40872640
tagged with: javafx-2
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26118552
has answer: http://stackoverflow.com/a/26118552
has answer: http://stackoverflow.com/a/26081453
has body: I have a comboBox cb and an ObservableList&lt;StringProperty&gt; data I have bound the cb's Items to data as follows: Bindings.bindContent(cb.getItems(), data); Suppose data has the following items: str1, str2, str3, str4 When I change data, the combobox gets the new list without any problem. But if str3 is selected in cb and I change the value of str3 to NewStr3 in data, that change is not getting displayed in cb. And sometimes the list displayed is also wrong (it shows str3 instead of NewStr3) eventhough underlying data it refers is correct. How can I force combobox to display new values when the underlying model is changed?
answer count: 2
tagged with: javafx-8
downvote count: 0

http://stackoverflow.com/comment/40932444
comment on: http://stackoverflow.com/q/26112966
type: Comment
type: QuestionComment
has text: Also, do you have enabled "Application security" in WAS (Security->Global security)? Without this option WAS authentication is not going to work...
score: 0

http://stackoverflow.com/a/26047334
answers question: http://stackoverflow.com/q/26047134
type: Answer
has body: According to the code in your post, you're still calling userFunction.registerUser directly from inside of the onClickListener handler - right after calling MyAsyncTask.execute. It's that registerUser call that the logcat output is complaining about, not the one in the AsyncTask. Did you mean to delete the duplicate call from the onClickListener handler after you moved that logic to the AsyncTask?
score: 0

http://stackoverflow.com/q/26042189
type: Question
tagged with: ubuntu-12.04
score: 0
has answer: http://stackoverflow.com/a/26042265
answer count: 1
accepted answer: http://stackoverflow.com/a/26042265
has comment: http://stackoverflow.com/comment/40794905
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
has title: output a variable in a text file
has body: I have some Java code like here: public synchronized void printLinkStatistics(Logger log) { log.info("\tInput Port = " + inputPort); Set &lt;Long&gt; ts = statData.keySet(); for(Long t: ts) { double utilization = statData.get(t); if (utilization!=0.0) { utilization *= 8.0; utilization /= 1e6; if (!Double.isNaN(utilization)) { log.info("\t\tTimestamp = " + t + ", Utilization = " + utilization + "Mbps"); } } } } and this code will write utilization in console but I need also write utilization + timestamp in a file to draw the pilot in future. How I create file with this variable? I'm using Eclipse in Ubuntu 12.04 EDITH I'm doing this but the file is empty: public synchronized void printLinkStatistics(Logger log) { try { PrintWriter pw = new PrintWriter(new File("output.txt")); log.info("\tInput Port = " + inputPort); Set &lt;Long&gt; ts = statData.keySet(); for(Long t: ts) { double utilization = statData.get(t); if (utilization!=0.0) { utilization *= 8.0; utilization /= 1e6; if (!Double.isNaN(utilization)) { log.info("\t\tTimestamp = " + t + ", Utilization = " + utilization + "Mbps"); pw.println("\t\tTimestamp = " + t + ", Utilization = " + utilization + "Mbps"); } } } } catch (FileNotFoundException e) { e.printStackTrace(); //handle exception as you want } }
has comment: http://stackoverflow.com/comment/40794951

http://stackoverflow.com/q/26158913
has comment: http://stackoverflow.com/comment/41108108
downvote count: 0
has comment: http://stackoverflow.com/comment/41145335
tagged with: aop
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26165708
has answer: http://stackoverflow.com/a/26161710
has answer: http://stackoverflow.com/a/26164538
has comment: http://stackoverflow.com/comment/42403286
answer count: 3
has comment: http://stackoverflow.com/comment/41018575
has body: I have service code like this: @Component public class MyService implements com.xyz.WithSession { public void someMethodWhichDoesNotNeedAutorization() { // code S1 } @com.xyz.WithAuthorization public void someMethodWhichNeedAutorization() { // code S2 } } and aspect like this: @Aspect public class MyAspect { @Before("target(com.xyz.WithSession)") public void adviceBeforeEveryMethodFromClassImplementingWithSession() { // code A1 } @Before("target(com.xyz.WithSession) &amp;&amp; @annotation(com.xyz.WithAuthorization)") public void adviceBeforeWithAuthorizationMethodFromClassImplementingWithSession() { // code A2 } Annotation looks like: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface WithAuthorization{ } code A1 is called before code S1 -- OK code A1 is called before code S2 -- OK code A2 isn't called before code S2 -- NOT OK What am I doing wrong? Code is written in Java 7 with Spring 3.1.3. Update I've tried another way. I use 'Around' advice instead of 'Before' and 'After' to have access to ProceedingJoinPoint. In this advice I check with reflection whether method has annotation 'com.xyz.WithAuthorization' or not: private boolean isAnnotated(ProceedingJoinPoint proceedingJoinPoint) { MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature(); return signature.getMethod().isAnnotationPresent(com.xyz.WithAuthorization); } My annotation has '@Retention(RetentionPolicy.RUNTIME)' but I see in debugger that annotation is missing on runtime in the method signature. So the problem still exists.
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41008318
tagged with: java
has title: Spring AOP for interface and for annotated methods within it
type: Question
upvote count: 4

http://stackoverflow.com/q/26128067
has comment: http://stackoverflow.com/comment/40952392
has comment: http://stackoverflow.com/comment/40955511
has title: The 100 game - CanIWin()
has comment: http://stackoverflow.com/comment/40952352
has comment: http://stackoverflow.com/comment/40954183
has comment: http://stackoverflow.com/comment/40952047
has comment: http://stackoverflow.com/comment/40952209
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40952504
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40951875
tagged with: java
has comment: http://stackoverflow.com/comment/40955525
tagged with: game-theory
score: 0
has comment: http://stackoverflow.com/comment/40952529
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40953777
favorite count: 0
has comment: http://stackoverflow.com/comment/40951704
has comment: http://stackoverflow.com/comment/40956465
has answer: http://stackoverflow.com/a/26128930
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40952615
has comment: http://stackoverflow.com/comment/40956303
has body: Problem: Two players pick numbers from a common pool of number to reach a combined total. The player who get to reach/cross the target value wins. The problem is to find out if player-1 can enforce a strategy to win - for a given total and a pool of numbers. My Approach: Assuming both the players pick the optimal number from the available pool. By optimal, I mean - Check if the highest number available in the pool >= remaining value. [yes]=> return the highest value available. If winning is not possible, pick the highest available number (RequiredToWin - HighestNumberInThePool) in the pool that will NOT guarantee a win in the next turn. I just came up with 'a' solution and wrote the code. I am trying to analyze if it is rite? optimal, in terms of time, space. Also trying to understand how I can improve my coding conventions - Global variables and the way I am using the conditional statements. Is this solution rite ? In the example - I used the expected sum from 100 to 105 -- to show the optimal pick in the output. See Player-1 picks 5 from the available pool [7,6,5,4,3,2,1] Edit This is not the solution to the problem. This approach fails for the case {pool:[1-5], Total:12}. The function says, Player-2 always wins, But Player-1 can always win, if he starts with a 3. /* In "the 100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins. What if we change the game so that players cannot re-use integers? For example, if two players might take turns drawing from a common pool of numbers of 1..15 without replacement until they reach a total &gt;= 100. This problem is to write a program that determines which player would win with ideal play. Write a procedure, "Boolean canIWin(int maxChoosableInteger, int desiredTotal)", which returns true if the first player to move can force a win with optimal play. Your priority should be programmer efficiency; don't focus on minimizing…

http://stackoverflow.com/comment/40927043
score: 0
has text: what makes you think you are not recieving all the data? how are you appending the response? You will always have the last part of the json, if it has line breaks, with your current implementation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26114581

http://stackoverflow.com/comment/41037489
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26174322
has text: @MarkRotteveel Not a bug but a feature. If you inspect the grammar diagrams at http://www.sqlite.org/lang_createtable.html carefully, you'll notice that a type-name can consist of arbitrary number of parts and in this case it goes to the column-constraint part only when encountering "NOT NULL".
score: 1

http://stackoverflow.com/comment/41026461
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26168410
has text: The initial memory allocation may take more time - if you run the test for 30 seconds instead of 0.5 sec you will probably see different results.
score: 0

http://stackoverflow.com/comment/40917726
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26083357
has text: How are they loaded anyway? You still haven't explained the relationship between `Product`and `CategoryList`.
type: Comment

http://stackoverflow.com/q/26192867
has body: I'm really stuck on this problem. This problem has never disturb me before.. I looked for all topics with same error, but nothing helps me.. SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/OnlineShop]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/OnlineShop]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoClassDefFoundError: javax/mail/MessagingException at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Unknown Source) at java.lang.Class.getDeclaredFields(Unknown Source) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:262) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.…
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26193296
accepted answer: http://stackoverflow.com/a/26193296
possible better answer: http://stackoverflow.com/a/47105867
tagged with: java
type: Question
upvote count: 2
has title: Tomcat error: A child container failed during start
has comment: http://stackoverflow.com/comment/41071529
answer count: 3
has answer: http://stackoverflow.com/a/47105867
has answer: http://stackoverflow.com/a/28278480
tagged with: tomcat8
favorite count: 0

http://stackoverflow.com/comment/41069895
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26191250
has text: @w0051977 What part of 'least significant' don't you understand?
type: Comment

http://stackoverflow.com/q/26072501
accepted answer: http://stackoverflow.com/a/26073227
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26315721
type: Question
has title: Unable to find Hibernate Tools in Spring Tool Suite 3.6.1 after installation of plugin
score: 3
has answer: http://stackoverflow.com/a/26073227
possible better answer: http://stackoverflow.com/a/26315721
tagged with: spring-tool-suite
tagged with: eclipse
upvote count: 3
answer count: 2
favorite count: 0
tagged with: spring
has body: I am trying to install Hibernate Tools plugin in my Spring Tool Suite 3.6.1 version, installation completes without any error but in am neither able to see Hibernate perspective nor I am getting options to reverse engineer hibernate classes. I have tried following without success: Using Install new software option..., update using site link -> Link Install Red Hat JBoss Developer Studio (Luna) 8.0.0.CR1 from Eclipse Marketplace Download zip archive update from jboss developer tools site. Did someone succeeded with Hibernate tools configuration in STS 3.6.1 Release.
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40912064
has text: @mdewitt If you think that if/else blocks are suitable substitutes for switch blocks, then you totally misunderstood my comment.
comment on: http://stackoverflow.com/q/26106078
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/26060182
tagged with: animation
tagged with: android-imageview
upvote count: 17
type: Question
type: AnsweredQuestion
tagged with: android-animation
tagged with: java
score: 17
has title: Animated transition between two imageview
answer count: 1
downvote count: 0
favorite count: 0
has body: On one hand I have a layout with two ImageView : &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/image_cross2" android:layout_width="wrap_content" android:layout_height="@dimen/image_size" android:layout_gravity="top" android:scaleType="centerCrop" /&gt; &lt;ImageView android:id="@+id/image_cross1" android:layout_width="wrap_content" android:layout_height="@dimen/image_size" android:layout_gravity="top" android:scaleType="centerCrop" /&gt; &lt;/FrameLayout&gt; On the other hand i have a list of image ressources : static int mImages[] = new int[] { R.drawable.artistes, R.drawable.couple1, R.drawable.couple2, R.drawable.couple3, R.drawable.enfant, R.drawable.manege, R.drawable.manege2, R.drawable.metropolitain, R.drawable.panoramique, R.drawable.sacrecoeur }; i have also a Scheduler made from Handler + postDelayed() to display the images one after another with a timer. This is working fine my issue is about the transition animation from one imageview to the other, knowing that i have to clean the imageviews each time to avoid OutOfMemoryExceptions : For now i do that in the schduled callback method : if (mIndex == mImages.length) { mIndex = 0; // repeat } if (mIndex % 2 != 0) { // pair mImageCross2.setImageResource(mImages[mIndex++]); Utils.crossfade(mImageCross2, mImageCross1, 1000/*duration*/); mImageCross1.setImageResource(0); } else { mImageCross1.setImageResource(mImages[mIndex++]); Utils.crossfade(mImageCross1, mImageCross2, 1000); mImageCross2.setImageResource(0); } with this animation : public static void crossfade(final ImageView viewIn, final ImageView viewOut, int duration) { Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(duration); Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setDuration(duration); fadeOut.setAnimationListe…
tagged with: android
has answer: http://stackoverflow.com/a/26062245
accepted answer: http://stackoverflow.com/a/26062245

http://stackoverflow.com/comment/50124154
type: AnswerComment
comment on: http://stackoverflow.com/a/26194764
has text: At first, Redline RPM can be used with Maven too. Secondly, Maven alone doesn't solve this problem, rpm-maven-plugin requires native RPM support. Building RPMs on platforms with no native support of the RPM build tools isn't a problem of the past. Redline RPM solves it partially. Finally, switching to Maven requires to follow a strict directory layout, it's not trivial and it wouldn't have solved my problem without additional plugins. If some dependencies are missing in the pom file, knowing them is still useful to fix it. Switching to the latest trendy tool doesn't solve everything.
type: Comment
score: 1

http://stackoverflow.com/q/26039028
has comment: http://stackoverflow.com/comment/40788730
has title: how to get perf to decode symbols for hadoop java code
tagged with: ubuntu
has answer: http://stackoverflow.com/a/26141974
accepted answer: http://stackoverflow.com/a/26141974
upvote count: 2
has comment: http://stackoverflow.com/comment/40789703
answer count: 1
favorite count: 0
has body: I'm using perf tools on ubuntu 12.04 to profile system level performance of hadoop 2.4.1 map/reduce jobs by doing: perf record -ag -F 100 sleep 60 My goal is to determine which processes/routines are consuming the cpu and identify candidates for optimization. Kernel symbols are decoded correctly, but java code is not. Perf report looks something like: Samples: 39K of event 'cycles', Event count (approx.): 11326629675790000f9f0 â + 10.64% java perf-9201.map [.] 0x00007eff6c188127 + 10.57% java perf-8988.map [.] 0x00007f71ac7b9a29 + 9.91% java perf-9077.map [.] 0x00007fa9e92073e0 + 9.77% java perf-9025.map [.] 0x00007f849cdf41a9 + 9.26% java perf-8747.map [.] 0x00007f078c6bda82 + 7.85% java perf-31343.map [.] 0x00007f6671041cb4 + 5.81% java perf-8835.map [.] 0x00007f5df0d5afc4 + 5.78% java liblzo2.so.2.0.0 [.] lzo1x_decompress + 2.61% java [kernel.kallsyms] [k] copy_user_generic_string + 1.58% java libc-2.15.so [.] 0x000000000008ce40 + 0.93% java perf-9677.map [.] 0x00007f7c81012887 + 0.86% swapper [kernel.kallsyms] [k] intel_idle + 0.69% java libjvm.so [.] SpinPause So the question is, how do I get perf to decode the symbols for the java code?
tagged with: linux
has comment: http://stackoverflow.com/comment/40789287
type: AnsweredQuestion
score: 2
tagged with: performance
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40807177
has comment: http://stackoverflow.com/comment/40789825
type: Question
tagged with: hadoop

http://stackoverflow.com/tag/jpeg
tags question: http://stackoverflow.com/q/26072939
type: Tag
tags question: http://stackoverflow.com/q/26147907
tag name: jpeg

http://stackoverflow.com/comment/42049284
has text: Sorry for being out. I made it work as you said, using CardLayout and show() method. Thank you all!
comment on: http://stackoverflow.com/q/26193256
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41036650
comment on: http://stackoverflow.com/q/26160992
score: 0
has text: Although we placed the class file with the program that starts by start.bat in the same directory as the start.bat,same error ended up out
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/133732943
score: 0
type: AnswerComment
has text: @ius is there any other better way around this problem which doesn't requires to deal with POJO, something that is similar to `@transient` **but has ability to persist data** ?
type: Comment
comment on: http://stackoverflow.com/a/26035036

realsense
tags question: http://stackoverflow.com/q/26159962
tag name: realsense
type: Tag

http://stackoverflow.com/a/26159286
type: Answer
answers question: http://stackoverflow.com/q/26159203
has body: The try catch block doesn't throw exceptions. This is done by the throw keyword. To throw an exception you could say throw new Exception(); The current method will halt and provide the exception to the calling method until it reaches the end or until it reaches a try catch block with try { } catch (Exception e) { } as signature. In the block of the catch you can then do some logging or alternative code to handle the exception.
score: 0

http://stackoverflow.com/a/26159597
has body: If you look at the documentation for the CommonsMultiPartFile you will see that your issue is in the way you are constructing your file. file.transferTo( new File( userDir, file)) should be: file.transferTo( new File(userDir, file.getOriginalFilename())) You need to access the originalFilename property of the file.
has comment: http://stackoverflow.com/comment/41014263
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41049012
has comment: http://stackoverflow.com/comment/41049162
type: Answer
accepted answer of: http://stackoverflow.com/q/26159515
answers question: http://stackoverflow.com/q/26159515

http://stackoverflow.com/comment/41132268
type: QuestionComment
comment on: http://stackoverflow.com/q/26180897
has text: i just ran it again and it worked. I literally changed nothing. EDIET okay, if i render the transparency onto my bitmap then render it onto another it make half of it dissapear again.
score: 0
type: Comment

http://stackoverflow.com/q/26125658
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/40951204
has body: I have written an application in Java using Eclipse Luna IDE. On paper I know the test cases required to test all branches/aspects of my application. Does "eclipse alone" allow us to write test cases and execute it ? I am specifically interested in being able to run all these tests cases in one click. Something like this will help test the complete application with just onclick.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40947469
has comment: http://stackoverflow.com/comment/40947305
downvote count: 0
linked to: http://stackoverflow.com/q/1962567
has title: Eclipse : Creating and simultaneously running multiple test cases
has comment: http://stackoverflow.com/comment/40951359
favorite count: 0
has comment: http://stackoverflow.com/comment/40948765
type: UnansweredQuestion
tagged with: plugins
has comment: http://stackoverflow.com/comment/40947243
answer count: 0
score: 1
tagged with: java
tagged with: testcase
upvote count: 1

http://stackoverflow.com/comment/40874955
has text: @Michael Last time i worked with it I had to dig into the source myself, and I can recall some of its details. Netty has a group of threads (`EventLoopGroup`, may be only one thread) and each of these threads loops on a selector (`EventLoop`). Each new connection (`Channel`) is bound to a thread, and whenever an event occurs, Netty calls the appropriate handler. You define the handlers for the events you're interested in (read, exceptions, etc). Event handling is done by the I/O threads, but you may also call `write` from an *outsider* thread. Netty ensures that it will be written safely.
type: Comment
comment on: http://stackoverflow.com/q/26085099
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40867678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26081635
has text: But can't set breaking point in javascript.
score: 0

http://stackoverflow.com/q/26104019
type: Question
has comment: http://stackoverflow.com/comment/40911509
tagged with: compatibility
has comment: http://stackoverflow.com/comment/40909953
score: 0
has comment: http://stackoverflow.com/comment/40909484
has comment: http://stackoverflow.com/comment/40907940
has comment: http://stackoverflow.com/comment/40911415
tagged with: textview
has comment: http://stackoverflow.com/comment/40909954
has comment: http://stackoverflow.com/comment/40911457
tagged with: android-version
has comment: http://stackoverflow.com/comment/40910347
has comment: http://stackoverflow.com/comment/40910908
type: UnansweredQuestion
has title: android.widget.TextView InflateException in Api 10
tagged with: android
has comment: http://stackoverflow.com/comment/40909979
has comment: http://stackoverflow.com/comment/40909379
has comment: http://stackoverflow.com/comment/40910346
has comment: http://stackoverflow.com/comment/40911614
has comment: http://stackoverflow.com/comment/40910004
has comment: http://stackoverflow.com/comment/40910988
answer count: 0
tagged with: java
has body: At first I was not supporting lower Android versions. As I had to I converted minSdkVersion to Api 10. I keep getting the error (below the layout code). I have included android-support-v4.jar. As far as I know, android.widget.textview is working with Api10 (I tested it). So what is causing this. Error: android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.TextView P.S. It is working on Api 16 &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.myproject.LoginActivity" &gt; &lt;TextView android:id="@+id/loginTip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="15sp" android:text="Log in!" /&gt; &lt;EditText android:id="@+id/username" android:layout_width="fill_parent" android:layout_height="39sp" android:layout_above="@+id/password" android:layout_centerHorizontal="true" android:hint="@string/enter_email" android:text="" /&gt; &lt;EditText android:id="@+id/password" android:layout_width="fill_parent" android:layout_height="39sp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:hint="@string/enter_password" android:inputType="textPassword" android:text="" /&gt; &lt;Button android:id="@+id/loginButton" android:layout_width="150sp" android:layout_height="40sp" android:layout_alignRight="@+id/password" android:layout_below="@+id/password" android:layout_marginTop="10sp" android:background="@drawable/buttonshape" android:text="@string/login" android:textColor="#D1D1D1" android:textSize="25sp" /…
has comment: http://stackoverflow.com/comment/40910210

http://stackoverflow.com/q/26074717
downvote count: 4
tagged with: for-loop
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40854326
has body: I've been testing now for hours and can't seems it to work, I need some clues! What I want to do is to make a picture go from one edge to other diagonal. What do I have to do? PaintWindow window = new PaintWindow(); ImageIcon man = new ImageIcon("C:/Users/Barry/Desktop/DA339AP1HT14/gubbe.jpg"); int leftRight = 1, rightLeft = 1; while (true){ if (leftRight &gt; 0) { for (int x = 0; x &lt;= 500; x += 10) { window.showImage(man, x, 0); PaintWindow.pause(50); } if (rightLeft &gt; 0) { for (int x = 500; x &gt;= 0; x -= 10) { window.showImage(man, x, 300); PaintWindow.pause(50); { } } } } } } public static void main(String[] args) { uppgift1f e1f = new uppgift1f(); e1f.leftRight(); } } EDIT ^^NEW Just made it so it starts from left top and when it hits the right top then it changes down to right bottom to left bottom but now what I want to do is to make it diagonal and i have no idea how. Please help with suggestions!
has comment: http://stackoverflow.com/comment/40854364
has title: FOR LOOP to make a image move diagonal
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40854328
has answer: http://stackoverflow.com/a/26074995
tagged with: java
has comment: http://stackoverflow.com/comment/40854462
type: UnansweredQuestion
score: -3

http://stackoverflow.com/a/26073082
answers question: http://stackoverflow.com/q/26073016
score: -1
upvote count: 0
type: Answer
has body: with your intent try to pass your values with putextra and getextra method it will work
downvote count: 1

http://stackoverflow.com/q/26080040
has title: Are there situations where if statements are irreplaceable by jump tables?
favorite count: 0
tagged with: logic
type: Question
score: -1
tagged with: java
has answer: http://stackoverflow.com/a/26080098
has body: I did not went too deep into this idea, but i wonder if if statements can be replaced by jump tables. If we have a set of ifs like if(x = 0) { ... } if(x = 1) { ... } if(x = 2) { ... } We could simply jump, direcly, to the routine that pertains to the value of x, if we had a table with pointers for each routine. In other situations like user input, let's assume we read a character from stdin, we would have like if(c = 'a') { ... } if(c = 'b') { ... } We could also find a way to índex a jump table based on the value of c My question is, in which situations is it TOTALLY impossible to replace an if by a jump table? Can computation be performed without if statements (or equivalents)
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40864239
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40864299
upvote count: 0

http://stackoverflow.com/a/26101604
accepted answer of: http://stackoverflow.com/q/26055179
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41002954
has body: I'm not sure I'm following your scenario, but this is what I do Highlight the field name Open Rename field dialogue. Either use Crtl + Alt + R Change the name of the field Check Rename getter and setter. Keep in mind that if you don't have the getter and setter already in the file, or the getter and setter name doesn't match the convention, the Rename options will be disabled. In this case use Generate getter and Setter dialogue Right-click the field Select Source > Generate Getter and Setters Select the fields for which you want to generate the getters and setters, if not already. Click OK. Hope this helps, if no, please add more details to the problem
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26055179

http://stackoverflow.com/comment/40931131
score: 0
has text: It seams that you are using JAX-RS along with Spring. Are you sure that you have followed the integration instructions of your JAX-RS implementation with Spring correctly?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26117070

http://stackoverflow.com/comment/40807363
type: Comment
has text: That's only part of the answer. The example in the question uses `x--` in the RHS of an assignment statement that assigns the variable x. What does `x = x--;` do?
score: 0
comment on: http://stackoverflow.com/a/26048433
type: AnswerComment

http://stackoverflow.com/comment/40837713
type: Comment
comment on: http://stackoverflow.com/a/26064847
type: AnswerComment
score: 0
has text: Ehm? Where do you hit the enter? Ok you lost me. Please update the question and provide, and be thorough about it, an expected output. Because right now i am not sure what you want

http://stackoverflow.com/comment/40884520
has text: @FuegoJohnson you are welcome :). Let me know if you get stuck
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26090861

http://stackoverflow.com/comment/40970535
type: QuestionComment
comment on: http://stackoverflow.com/q/26138507
score: 0
has text: make sure the limit of an array
type: Comment

http://stackoverflow.com/q/26128097
type: Question
has comment: http://stackoverflow.com/comment/40951858
has comment: http://stackoverflow.com/comment/40951810
answer count: 1
has title: How to know the current folder depth of a recursive file scanning
has comment: http://stackoverflow.com/comment/40951949
score: 0
has comment: http://stackoverflow.com/comment/40952006
has answer: http://stackoverflow.com/a/26128200
type: UnansweredQuestion
tagged with: recursion
tagged with: java
has body: I wrote a function that recursively scans a folder to search for files and process them (foundFile()). the problem is when the function finds an alias folder (for example in a mac, when I am trying to loop in a /Volumes folder). the script loops infinitely (I don't know why). is there a possibility to know the current "depth" of the recursion and to stop at (ie) 20? or even to stop the loop in that particular case (alias folder) private String[] types = { ".wav", ".mp3", ".ogg", ".wave", ".wma"}; public void listFile(String pathname) { File f = new File(pathname); File[] listfiles = f.listFiles(); if(listfiles!=null){ for (int i = 0; i &lt; listfiles.length; i++) { if (listfiles[i].isDirectory()) { File[] internalFile = listfiles[i].listFiles(); if(internalFile!=null){ for (int j = 0; j &lt; internalFile.length; j++) { for(int h=0;h&lt;types.length;h++){ if(internalFile[j].getAbsolutePath().endsWith(types[h])){ found.put(types[h], found.get(types[h])+1); foundFile(internalFile[j]); } } if (internalFile[j].isDirectory()) { String name = internalFile[j].getAbsolutePath(); listFile(name); } } } } else { processed+=1; for(int j=0;j&lt;types.length;j++){ if(f.getAbsolutePath().endsWith(types[j])){ this.found.put(types[j], found.get(types[j])+1); foundFile(listfiles[i]); } } } } } }
has comment: http://stackoverflow.com/comment/40951792

http://stackoverflow.com/comment/41021771
comment on: http://stackoverflow.com/q/26165439
score: 0
type: Comment
type: QuestionComment
has text: I don't see an error in your stacktrace

http://stackoverflow.com/comment/53520486
comment on: http://stackoverflow.com/q/26142816
type: Comment
type: QuestionComment
score: 0
has text: What about not using a CQRS/Axon approach? Sounds like you want to shoehorn the approach (CQRS) and the tool (Axon) in a way they were not intended for.

http://stackoverflow.com/a/26146874
answers question: http://stackoverflow.com/q/26145395
has body: For a properly rooted device you could just do adb pull for every partition you want one by one: adb pull /dev/block/platform/msm_sdcc.1/by-name/userdata userdata.bin The block device path is specific to the SoC chipset (Qualcomm in my example)
score: 0
has comment: http://stackoverflow.com/comment/40996303
type: Answer
has comment: http://stackoverflow.com/comment/40996494

http://stackoverflow.com/a/26187802
has body: Your problem is that the "map" variable is reused. map.put("positionTitle", al.get(i).toString()); positionTitles.put(String.valueOf(i), map); setts a new value for the same key in the same hashmap each time, and then stores the same object for different keys in the second map. Thus basically overwriting what you did before in each loop. To solve your problem you would need to either create a new hashmap object for each loop or use different keys. Since you talk about nested hashmaps I guess what you want to do is: map = new HashMap(); map.put("positionTitle", al.get(i).toString()); positionTitles.put(String.valueOf(i), map); I do not understan why you want to do this but good luck any way.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26187676
type: Answer
accepted answer of: http://stackoverflow.com/q/26187676
score: 0

http://stackoverflow.com/q/26139028
has comment: http://stackoverflow.com/comment/40971760
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26139362
has comment: http://stackoverflow.com/comment/40971539
favorite count: 0
accepted answer: http://stackoverflow.com/a/26139362
has comment: http://stackoverflow.com/comment/40971746
type: Question
has title: Use of Integer type in Switch statement in java
has comment: http://stackoverflow.com/comment/40971510
has comment: http://stackoverflow.com/comment/40971800
score: 4
has answer: http://stackoverflow.com/a/26139394
has answer: http://stackoverflow.com/a/26139567
tagged with: java
answer count: 3
downvote count: 1
tagged with: switch-statement
possible better answer: http://stackoverflow.com/a/26139394
has body: I was writing some simple code in java for my android app and i got these errors. case expressions must be constant expressions while private static final Integer is constant private static final Integer INVALID_USER = 901; private static final Integer SENDING_FAILED = 902; private static final Integer OK = 903; /* * * And some more project related declaration... * */ switch (responseCode){ case INVALID_USER: // logout break; case SENDING_FAILED: //resend request break; case OK: break; } This is because i used Integer Type, then i changed type to int and problem is solved My question is why we cant use Integer as a case expression. Docs says " A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer" though variable is constant I read this question but didnt get any thing
linked to: http://stackoverflow.com/q/12603824
upvote count: 5
duplicate of: http://stackoverflow.com/q/12603824

http://stackoverflow.com/comment/41066272
comment on: http://stackoverflow.com/a/26189469
score: 0
type: AnswerComment
has text: after creation, u have to change it in activity.Have a frame layout in activity and replace it using fragment manager as done here http://stackoverflow.com/questions/7849490/android-adding-fragments-dynamically
type: Comment

http://stackoverflow.com/a/26155354
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41002519
upvote count: 8
accepted answer of: http://stackoverflow.com/q/26151105
has comment: http://stackoverflow.com/comment/41015437
has comment: http://stackoverflow.com/comment/41002023
type: Answer
has body: The behavior you describe is the behavior if you don't explicitly configure logout support but only enable it, it you explicitly configure it it will use that configuration instead. @Override protected void configure(HttpSecurity http) throws Exception { http .logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout")); } This is also documented in the reference guide. However the real solution is imho that you shouldn't use a controller for the additional logout functionality but use a LogoutHandler instead. That will integrate nicely with Spring Security and you don't need to redirect/forward to different URLs.
score: 8
has comment: http://stackoverflow.com/comment/41002349
has comment: http://stackoverflow.com/comment/41001849
answers question: http://stackoverflow.com/q/26151105

http://stackoverflow.com/comment/40919229
type: AnswerComment
has text: Okay, well, maybe you have another file still open in the directory that you haven't shown us.
type: Comment
comment on: http://stackoverflow.com/a/26110123
score: 0

http://stackoverflow.com/comment/40887296
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26090861
score: 0
has text: Suppose you would need to make some other comparisons if the value was < 0. Would you put it in the catch clause then? Logic changes as business requirement change, so it's likely that at some point you will have to change this simple conditions that you have now and then, the catch would make the logic to be spread all over your method. Please read this: http://stackoverflow.com/questions/15208544/when-should-illegalargumentexception-be-thrown

http://stackoverflow.com/a/26115495
type: Answer
answers question: http://stackoverflow.com/q/26115287
score: 0
has body: If I understand you correct, you need to look at Activity Lifecycle: AndroidDevDocs and call to that method where you update or reload your data. For example you call for onStart() again and again for reload data in TextView or something like that. But this depends on your app: maybe you should create a function where you "update" all fields of your app. every time the status changes to "connected"

taglib
tags question: http://stackoverflow.com/q/26184082
tag name: taglib
tags question: http://stackoverflow.com/q/26091407
type: Tag

http://stackoverflow.com/a/26118650
answers question: http://stackoverflow.com/q/26118471
score: 0
has comment: http://stackoverflow.com/comment/40933745
has body: Why not just add the class name in top of object tree. You could have something like this. Gson gson = new Gson(); JsonElement je = gson.toJsonTree(new Base()); JsonObject jo = new JsonObject(); jo.add(Base.class.getSimpleName(), je);
type: Answer

http://stackoverflow.com/q/26041433
has comment: http://stackoverflow.com/comment/40793553
has comment: http://stackoverflow.com/comment/40793388
has comment: http://stackoverflow.com/comment/40793951
has answer: http://stackoverflow.com/a/26041930
tagged with: java
has comment: http://stackoverflow.com/comment/40793794
has comment: http://stackoverflow.com/comment/40793638
type: Question
has body: Given, for example, a class like this: public abstract class AbstractSomething { public static volatile SingularAttribute&lt;Somefield, AnotherField&gt; myAttribute; } how can I get an instance of myAttribute via reflection. There are no implementing classes for AbstractSomething. EDIT No, we need an instance of the SingularAttribute&lt;T, S&gt;. And the reason we need to use reflection is becuase these classes are generated and passed into our method as a Class object. We have no way no know which AbstractSomething we are receiving. There are quite a few of them. EDIT 2 Found out what the issue was. When a Hibernate context is present in the application, the interfaces on the abstract class are replaced with their implementation counterparts when accessing them.
has title: Get field instance from abstract class
has comment: http://stackoverflow.com/comment/40793711
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40798047
has comment: http://stackoverflow.com/comment/40793583
has comment: http://stackoverflow.com/comment/40793292
has comment: http://stackoverflow.com/comment/40793908
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26041490
tagged with: reflection

http://stackoverflow.com/q/26187341
has comment: http://stackoverflow.com/comment/41070932
has answer: http://stackoverflow.com/a/27699415
has title: HttpGet get = new HttpGet(url); giving exceptions
answer count: 2
has comment: http://stackoverflow.com/comment/41126017
favorite count: 0
tagged with: apache-httpclient-4.x
upvote count: 5
tagged with: http-get
type: UnansweredQuestion
has body: I am trying to do a very simple thing which was working a couple of days ago. CloseableHttpClient client = HttpClientBuilder.create().build(); HttpGet get = new HttpGet(url); HttpResponse response = client.execute(get); It is giving the following error Caused by: java.lang.IllegalStateException: Unsupported cookie spec: default at org.apache.http.cookie.CookieSpecRegistry.getCookieSpec(CookieSpecRegistry.java:110) at org.apache.http.cookie.CookieSpecRegistry$1.create(CookieSpecRegistry.java:163) at org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:157) at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:132) at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:166) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:485) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:878) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:84) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:109) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) I faced this error earlier using a deprecated client and I changed it to using HTTPClientBuilder. I am not sure why it is giving on HTTPGet. Any help is greatly appreciated.
has comment: http://stackoverflow.com/comment/41127943
has comment: http://stackoverflow.com/comment/42364720
downvote count: 0
tagged with: java
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/69630409
score: 5

http://stackoverflow.com/q/26108461
has answer: http://stackoverflow.com/a/26109289
tagged with: spring
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
tagged with: ssl
tagged with: jboss
has body: I have configured the SSL configuration for my jboss. -Djavax.net.ssl.keyStore=/opt/appserver/jboss5.1/test.jks -Djavax.net.ssl.keyStorePassword=********* -Djavax.net.ssl.trustStore=/opt/appserver/jboss5.1/test.jks -Djavax.net.ssl.trustStorePassword=******* I am using the spring integration to connect to restservice, the ssl certificate is getting passed for some request and it is not getting passed for some other request, Any idea why the certificate will not be passed for one request?
type: Question
has title: SSL Certificate Not getting passed
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26109289

http://stackoverflow.com/comment/41046557
comment on: http://stackoverflow.com/a/26179394
type: Comment
has text: then add `\s*` where the spaces are located. If you Still can't figure it out, then provide a sample string. I will try.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41010145
type: QuestionComment
has text: `i read about Handler and understand what it does ...` no, you do not ... `I have been thinking of working with boolean flag with while ... how to wait` bad, bad idea ... especially when sumMethod was called on Main thread (fx from onClick of view - you will get ANR)... halnder will finish it work just after setImageResource call(inside run method of inlined Runnable implementation) ... in other words put PART 3 inside run method ...
score: 1
comment on: http://stackoverflow.com/q/26159907
type: Comment

http://stackoverflow.com/q/26049313
has title: GUI Making Arrays of Images that Move Using Mouse Event
possible better answer: http://stackoverflow.com/a/26049723
favorite count: 0
tagged with: object
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26051134
score: 1
tagged with: java
has body: I am pretty overwhelmed at the moment with this assignment. I am only 3 weeks into Java programming and I was given this code and told to modify it in ways I'm not exactly familiar with. So any help would be greatly appreciated. I really want to understand this, so any information would also be helpful. The directions that I'm struggling with at the moment are: "Modify the Model class to store an ArrayList of Turtles. Make Model.update call Turtle.update for each Turtle in the ArrayList. To test it, put two or three turtles in the ArrayList, each starting in different locations. When you click (which causes "setDestination" to be called), make all of the turtles head for the same destination. Get this much working before you proceed." Before I created an array of these turtles, one turtle showed up fine. Now that I have created an array, nothing is showing up on my panel. It does compile properly, though. I understand that I should make separate Graphics objects, but how and where would be the best place to do this? Here is the code (which was in 4 separate files): Controller.java import java.awt.Graphics; import java.io.IOException; import java.awt.event.MouseListener; import java.awt.event.MouseEvent; import javax.swing.Timer; class Controller implements MouseListener { Model model; View view; Controller() throws IOException, Exception { model = new Model(); view = new View(this); new Timer(50, view).start(); } public void update(Graphics g) { model.update(g); } public void mousePressed(MouseEvent e) { model.setDestination(e.getX(), e.getY(), view.getWidth(), view.getHeight()); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public static void main(String[] args) throws Exception { // Use the following line to determine which directory your program // is being executed from, since that is where the image files will // need to be. //System.o…
tagged with: jpanel
has answer: http://stackoverflow.com/a/26049723
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26051134
tagged with: user-interface
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/40906191
score: 0
type: QuestionComment
type: Comment
has text: @NoGodbutALLAH There is a concept called "politeness". The purpose of this site to allow people to ask for help, not demand it. I would conclude this question with something like "Any help would be appreciated" or "Thank you for your help", or just let your question stand on its own. But the use of the imperative "So help me out" is rude. We're here to help, not be bossed around.
comment on: http://stackoverflow.com/q/26062922

http://stackoverflow.com/q/26184808
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41062548
accepted answer: http://stackoverflow.com/a/26219837
answer count: 1
has comment: http://stackoverflow.com/comment/41120946
has comment: http://stackoverflow.com/comment/41057070
favorite count: 0
linked to: http://stackoverflow.com/q/13250633
tagged with: git
has title: Strange name in git file
type: AnsweredQuestion
has body: Working on a Java project with Eclipse I found some strange git behavior. When trying to commit files from my terminal (in zsh) git showed up with this: Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: "src/com/sierisimo/app\bfragments/FragmentMenu.java" Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules) deleted: "src/com/sierisimo/app\bfragments/FragmentMenu.java" And I found a Similar Question But they are talking about octal numbers and "\b" doesn't look like an octal number... What do you suggest?
has answer: http://stackoverflow.com/a/26219837
has comment: http://stackoverflow.com/comment/41057035
score: 1
tagged with: java

http://stackoverflow.com/comment/41642868
type: Comment
has text: Hey Jasper, Apologies it took a while to reply... In the end I just simply went with Mockito as it makes everything infinitely easier to mock (statically as well) so essentially I'm only testing the stuff thats mine and not CMSHippos! Thanks for the reply as it helped!
comment on: http://stackoverflow.com/a/26175464
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40892910
type: Comment
comment on: http://stackoverflow.com/a/26095398
type: AnswerComment
has text: Note `JSONArray.fromObject(response);` is what youshould use look at second line.
score: 0

http://stackoverflow.com/comment/67811005
type: Comment
comment on: http://stackoverflow.com/q/26151644
type: QuestionComment
has text: Really lame that these folks closed a perfectly clear and reasonable question. Some tunnel vision here.
score: 5

http://stackoverflow.com/q/26172232
upvote count: 1
score: 1
tagged with: java
has title: netty bootstrap connection refused
type: Question
answer count: 2
has body: trying to connect client io.netty.bootstrap.Bootstrap: ChannelFuture cf = null; cf = m_bootstrap.connect(new InetSocketAddress(InetAddress .getByName("127.0.0.1"), 8084)); in cf, result : java.net.ConnectException: Connection refused: /127.0.0.1:8084 detailed message: [sun.nio.ch.SocketChannelImpl.checkConnect(Native Method), sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599), io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:208), io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:287), io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528), io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468), io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382), io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354), io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116), java.lang.Thread.run(Thread.java:695)] my /etc/hosts file looks like this: 127.0.0.1&gt;--localhost 255.255.255.255&gt;broadcasthost ::1 localhost- ****::1%lo*&gt;localhost 127.0.0.1&gt;--******** Not sure what to do? literally assumed I can pass localhost and port and it should work.
downvote count: 0
has answer: http://stackoverflow.com/a/26268360
tagged with: client
favorite count: 0
has answer: http://stackoverflow.com/a/26235018
type: UnansweredQuestion
tagged with: netty

http://stackoverflow.com/a/26133216
has comment: http://stackoverflow.com/comment/41155859
has comment: http://stackoverflow.com/comment/40962884
type: Answer
has body: Your problem is that you are trying to send the entire array you managed to read as a single object. On the sending side, you get a big array, call write and then flush which sends the entire array and waits for it to be flushed (with no control for you in between, so you sending app has no way to display progress). On the receiving end you get the same problem. You probably just call read which would read the entire ArrayList in a single operation. Chances are, you are able to read a lot of data before you try to send it as a big array. You can get some control if you break the array into reasonable "chunks" (maybe a simple max(1024, arraysize/100)). Then send the chunks one by one. The pseudo code would look like this: chunkSize = max(1024, arraysize/100) while(still bytes left to read) { Sender reading chunkSize bytes into Byte-Array from InputStream Sender write and flushes this Byte-Array to the SocketOutputStream reportProgress() }
upvote count: 0
has comment: http://stackoverflow.com/comment/40962283
answers question: http://stackoverflow.com/q/26101260
score: -1
downvote count: 1

http://stackoverflow.com/comment/40963235
comment on: http://stackoverflow.com/a/26133961
score: 0
type: AnswerComment
has text: Check Your localhostname and username and Password and Table NAme
type: Comment

http://stackoverflow.com/q/26147412
has answer: http://stackoverflow.com/a/27622448
has body: I currently have a column family that I want to index on multiple columns. The schema I am currently thinking of using is: CREATE TABLE keyspace.cfname ( row_key uuid, ts timestamp, some_field_a blob, some_field_b blob, some_field_c text, some_field_d int, PRIMARY KEY ((row_key)) ); For each field I want to index on I create a DIY index: CREATE TABLE keyspace.cfname_some_field_&lt;char&gt;_idx ( some_field_&lt;char&gt; type, ts timestamp, row_key uuid, PRIMARY KEY ((some_field_&lt;char&gt;), ts, row_key) ); The purpose is to support this kind of query: SELECT * FROM index WHERE some_field_&lt;char&gt; = X AND ts &gt;= Y AND ts &lt;= Z; I will in the future also want to support a query with 1-2 more levels of clustering. Note that values inside of the fields I want to index on are very unique. If a typical query to the index may return 100-1000000 row_keys and I need to query cfname to retrieve the values of the row_keys, would this schema be inefficient? How would Cassandra perform when querying 100-1000000 one-width rows from cfname? Some things I have also considered: embedding the row value inside of the index (lots of duplication as many records have 10+ rows and 4+ fields to index on) and clustering by Date in cfname for wider rows (if the 100-1000000 results are typically within a few dates).
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
tagged with: database
has title: Cassandra - Indexing on Multiple Columns with Many Unique Values
tagged with: cassandra
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: nosql

http://stackoverflow.com/a/26244346
accepted answer of: http://stackoverflow.com/q/26066452
answers question: http://stackoverflow.com/q/26066452
upvote count: 1
has body: Jersey will try to provide you with whatever you provide as the input argument based on the content-type of the request. You could also probably use a byte[] instead of InputStream. If the content-type was application/octet-stream and your input argument was a serializable object, then Jersey would assume that the incoming data uses Java serialization, same goes for application/xml (it will use JAXB). If you want to make this more explicit you can put @Consumes and @Produces on your servlet method.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/26051427
score: 2
has body: You can tryout this. Here I consider the state value if two cities are equal. public int compareTo(Object otherCity){ City other = (City) otherCity; int iReturn = name.compareTo(other.name); if (iReturn == 0){ //use your logic what to do when strings are equal. e.g. iReturn = iReturn = state.compareTo(other.state); } return iReturn; }
upvote count: 2
answers question: http://stackoverflow.com/q/26051301
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40856203
score: 0
has text: If you're going to do this, consider java.nio.ByteBuffer.allocateDirect instead of MappedByteBuffer (unless you actually need to persist the hash table to disk).
comment on: http://stackoverflow.com/q/26075667
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26035016
type: Answer
answers question: http://stackoverflow.com/q/26034965
score: 0
has body: Yes, your understanding is correct. The whole entry class is a value. In the below line library.put(entry.getBname().getTitle(), entry); entry.getBname().getTitle() --> key entry ---> value.

http://stackoverflow.com/q/26139856
has answer: http://stackoverflow.com/a/26143960
has comment: http://stackoverflow.com/comment/40973143
has body: I'm trying to retrieve an attribute from servlet(viewcurrentstock.java) to jsp(viewstock.jsp). here an exception is promted saying "org.apache.jasper.JasperException: java.lang.NullPointerException" viewcurrentstock.java ItemDBController itemDBController=new ItemDBController(); try { List<Item> allItems = itemDBController.getAllItems(); request.setAttribute("items",allItems); RequestDispatcher dispatcher=request.getRequestDispatcher("viewstock.jsp"); dispatcher.forward(request, response); } catch (Exception ex) { Logger.getLogger(ViewCurrentStock.class.getName()).log(Level.SEVERE, null, ex); } viewstock.jsp <%ArrayList<Item> itemlist = (ArrayList<Item>) request.getAttribute("items"); %> <%for (Item item : itemlist) {%> <%=item.getItemcode()%> <%=item.getItemname()%> <%=item.getDescription()%> <%=item.getQtyOnHand()%> <%= item.getReorderlevel()%> <%=item.getUnitprice()%> <%}%> server log: java.lang.NullPointerException at org.apache.jsp.viewstock_jsp._jspService(viewstock_jsp.java:66) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.…
type: UnansweredQuestion
has title: Exception org.apache.jasper.JasperException: java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/40972827
has comment: http://stackoverflow.com/comment/40979726
tagged with: java
has comment: http://stackoverflow.com/comment/40973196
has comment: http://stackoverflow.com/comment/40972865
type: Question
has comment: http://stackoverflow.com/comment/40973043
has comment: http://stackoverflow.com/comment/40973346
linked to: http://stackoverflow.com/q/3177733
tagged with: jsp
tagged with: servlets
has comment: http://stackoverflow.com/comment/41001000
score: 0
has comment: http://stackoverflow.com/comment/40972833
has comment: http://stackoverflow.com/comment/40979376
has comment: http://stackoverflow.com/comment/40973348
has comment: http://stackoverflow.com/comment/40980389
answer count: 1
has comment: http://stackoverflow.com/comment/40973121
has comment: http://stackoverflow.com/comment/40979132

http://stackoverflow.com/a/26168287
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26167930
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26167930
has comment: http://stackoverflow.com/comment/41026145
type: Answer
upvote count: 3
has body: The initial size of the ArrayList if the no-arg constructor is used quoting from the javadoc: Constructs an empty list with an initial capacity of ten. So it does not depend on anything, it doesn't depend on the RAM size either. However there are some clever optimization going on in the background. If you check the Oracle implementation of ArrayList, you will see that in this case an initial empty internal array will be used so no array will be allocated until you actually add some elements to the list - in which case an array of size 10 will be created. Once you attempt to add the 11th element, the internal array will be "resized". The new size is also implementation dependent, Oracle uses a 50% increment in the 1.7.0 version, so adding the 11th element will cause a new array to be allocated with the size of 15. Going behind the scene For the curious ones, you can use the following method to query the size of the internal array of the ArrayList (the solution uses reflection): public static int getCap(ArrayList&lt;?&gt; list) throws Exception { Field f = list.getClass().getDeclaredField("elementData"); f.setAccessible(true); Object[] o = (Object[]) f.get(list); return o.length; } Test results ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); System.out.println(getCap(list)); // Prints 0 list.add(""); System.out.println(getCap(list)); // Prints 10 for (int i = 1; i &lt; 11; i++) list.add(""); System.out.println(getCap(list)); // Prints 15 for (int i = 11; i &lt; 16; i++) list.add(""); System.out.println(getCap(list)); // Prints 22
score: 3

http://stackoverflow.com/q/26170827
has comment: http://stackoverflow.com/comment/41031575
type: UnansweredQuestion
tagged with: bigdata
linked to: http://stackoverflow.com/q/109383
tagged with: java
has comment: http://stackoverflow.com/comment/41031487
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/41031594
has answer: http://stackoverflow.com/a/26173881
has comment: http://stackoverflow.com/comment/41031505
has title: bigdata hadoop java codefor wordcount modified
tagged with: hadoop2
has body: I have to modify the hadoop wordcount example, to count the number of words that start with the prefix "cons" and then need to sort the results in the descending order of their frequency. Can anybody tell how to write the mapper and reducer code for this? Code: public class WordCountMapper extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { //Replacing all digits and punctuation with an empty string String line = value.toString().replaceAll("\\p{Punct}|\\d", "").toLowerCase(); //Extracting the words StringTokenizer record = new StringTokenizer(line); //Emitting each word as a key and one as itsvalue while (record.hasMoreTokens()) context.write(new Text(record.nextToken()), new IntWritable(1)); } }
answer count: 1
score: 0

http://stackoverflow.com/comment/40786412
comment on: http://stackoverflow.com/q/26037807
score: 0
type: Comment
type: QuestionComment
has text: You can create your own Exception subclass that has an error code in it, but there is no "convention" for associating exceptions with error codes.

http://stackoverflow.com/q/26128308
answer count: 2
has comment: http://stackoverflow.com/comment/40952215
has answer: http://stackoverflow.com/a/26128371
has comment: http://stackoverflow.com/comment/40952325
has body: In Java I have declared this color object: Color f_color = new Color(0,0,0); Later in the code I would like to update that color variable setting, for instance, the red channel to 2. I try to do so in the following way: f_color.r = 2; Obviously I get an error. Is it possible to do what I am trying to ? or the only way is to create a new color object? Thank you.
downvote count: 0
tagged with: colors
score: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/26128371
has answer: http://stackoverflow.com/a/26128427
upvote count: 2
possible better answer: http://stackoverflow.com/a/26128427
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40952213
tagged with: java
has title: Modify color java object
has comment: http://stackoverflow.com/comment/40952353
type: Question

http://stackoverflow.com/comment/41021580
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26156760
has text: The compiler is doing its job if it stops you from adding a `Set<Integer>` to an `ArrayList<Set<String>>`. That's what you're seeing in the first case. But it must NOT stop you from adding a `Set<Integer>` to an `ArrayList<Set<?>>` because a `Set<Integer>` is a type of `Set<?>`, so it must be permissible to add it to the list.

http://stackoverflow.com/comment/40839070
comment on: http://stackoverflow.com/q/26065390
score: 0
type: Comment
type: QuestionComment
has text: I am really sorry, I provided code that I had not completely fixed. The code above should not include the case for '_'. That was a relic of my attempts to add it on to the last element in the list. And no, there is no legitimate reason that I am using StreamTokenizer. Do you feel that StringTokenizer is superior?

http://stackoverflow.com/comment/41003691
comment on: http://stackoverflow.com/a/26155747
type: Comment
has text: @KickButtowski You don't assign null to a Thread. You assign null to a variable referencing a Thread. After assigning null, the variable no longer references that Thread. If the Thread were a regular Object, and there were no other references, it would eventually be garbage-collected. A Thread, however, will happily continue running, without anyone referencing it.
score: 1
type: AnswerComment

http://stackoverflow.com/q/26135473
favorite count: 0
has answer: http://stackoverflow.com/a/26151479
accepted answer: http://stackoverflow.com/a/26156387
tagged with: android
score: -2
possible better answer: http://stackoverflow.com/a/26151479
has body: I am trying to integrate admob for android in eclipse. I followed the instructions from here but now I i stuck with a run time error at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689) this is my logcat ok after giving the unique id this is now the logcat is 10-02 02:44:13.855: E/AndroidRuntime(1457): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.skylite.ghanalivetv.Splash$PlaceholderFragment" on path: DexPathList[[zip file "/data/app/com.skylite.ghanalivetv-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.skylite.ghanalivetv-1, /system/lib]] Can you please tell me how to solve it
has comment: http://stackoverflow.com/comment/40965032
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26156387
tagged with: java
has comment: http://stackoverflow.com/comment/40987498
downvote count: 3
tagged with: eclipse
tagged with: admob
type: Question
has title: integrating admob to android at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
answer count: 2
has comment: http://stackoverflow.com/comment/40965715

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/26098411

http://stackoverflow.com/comment/40815926
comment on: http://stackoverflow.com/q/26053663
type: QuestionComment
type: Comment
score: 0
has text: driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); List<WebElement> textField = driver.findElements(By.className("android.widget.EditText")); textField.get(0).sendKeys("text");

http://stackoverflow.com/a/28791343
has body: Fixed my problem turns out I started from the wrong first decision and thus ended up doing it wrong. I started with a different if of eye color and proceeded from there and fixed my problem
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26111143
accepted answer of: http://stackoverflow.com/q/26111143
type: AcceptedAnswer

http://stackoverflow.com/comment/40951053
has text: Hey Suhail Mehta! Thanks a lot for this explanation! :) I will try to get through this stuff you posted :) really thanks! :) Other tips or even hints are of course still appreciated!
comment on: http://stackoverflow.com/a/26126525
score: 0
type: AnswerComment
type: Comment

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/26175812

import
tags question: http://stackoverflow.com/q/26141003
type: Tag
tags question: http://stackoverflow.com/q/26119331
tags question: http://stackoverflow.com/q/26193486
tag name: import
tags question: http://stackoverflow.com/q/26051510
tags question: http://stackoverflow.com/q/26189852
tags question: http://stackoverflow.com/q/26179608
tags question: http://stackoverflow.com/q/26144947
tags question: http://stackoverflow.com/q/26170234
tags question: http://stackoverflow.com/q/26100766
tags question: http://stackoverflow.com/q/26087801

http://stackoverflow.com/a/26101228
has comment: http://stackoverflow.com/comment/40903800
has comment: http://stackoverflow.com/comment/40903730
type: Answer
has comment: http://stackoverflow.com/comment/40903280
has comment: http://stackoverflow.com/comment/40903329
has body: I would do it this way. DataInputStream dis = new DataInputStream(inputStream); int len = dis.readInt(); // read exactly 4 bytes byte[] bytes = new byte[len]; dis.readFully(bytes); When you do you first read, you could be getting less than 4 bytes. When you read the actual data, you might have to read many times to get it all. read(byte[]) can return as soon as it get 1 or more bytes.
upvote count: 1
answers question: http://stackoverflow.com/q/26100980
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40936084

http://stackoverflow.com/comment/40998132
type: QuestionComment
has text: Well, I wanted to keep the window at it's full size and just have a text window in the center - kind of like the google's main page. The idea, then, is to 'encrypt' the text and then output it post-encryption through another message (after choosing encryption type).
comment on: http://stackoverflow.com/q/26151920
score: 0
type: Comment

http://stackoverflow.com/comment/40951737
type: Comment
type: QuestionComment
has text: @CoryKlein Thanks. I am more concerned about the Play side code.
comment on: http://stackoverflow.com/q/26125334
score: 0

http://stackoverflow.com/q/26141093
has comment: http://stackoverflow.com/comment/40975847
score: 1
has comment: http://stackoverflow.com/comment/40975255
has comment: http://stackoverflow.com/comment/40975305
tagged with: jsp-tags
upvote count: 1
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26143707
has comment: http://stackoverflow.com/comment/40975591
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
has body: Image upload working on localhost fine using request.getRealPath() but same we are using in server that's not working, because server can not find specified path.. image can't be displayed .. how i can solved this problem.?? here is code for image uploading: filePath =request.getRealPath("") + "\\img\\"; System.out.println(filePath); String contentType = request.getContentType(); if ((contentType.indexOf("multipart/form-data") &gt;= 0)) { DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List fileItems = upload.parseRequest(request); // message= fileItems.get(2).toString(); Iterator i = fileItems.iterator(); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); if(fi.isFormField()) { message=fi.getString(); System.out.println("message is : "+message); bean.setEmp_id(Integer.parseInt(message)); } if (!fi.isFormField()) { String fieldName = fi.getFieldName(); System.out.println("field name"+fieldName); fileName = fi.getName(); if (fileName.lastIndexOf("\\") &gt;= 0) { file = new File(filePath + fileName.substring(fileName .lastIndexOf("\\"))); } else { file = new File(filePath + fileName.substring(fileName .lastIndexOf("\\") + 1)); } fi.write(file);
favorite count: 0
has title: image upload working on localhost fine but not in server in jsp
type: Question
has comment: http://stackoverflow.com/comment/40975815
has comment: http://stackoverflow.com/comment/40975178
accepted answer: http://stackoverflow.com/a/26143707

http://stackoverflow.com/a/34269960
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26055695
upvote count: 1
downvote count: 1
has body: Sorry, I don't understand your entire question, but there are 2 options for RMI. If you are interesting in a specific class method, you can use a interface to do a proxy to your object created on Server's method 'sayHello' Something like this: public interface TargetInterface extends Remote { public void doSomething() throws RemoteException; } public Target extends UnicastRemoteObject implements TargetInterface { private static final long serialVersionUID = 7204253532056038242L; public Target() throws RemoteException { super(); } @Override public void doSomething() throws RemoteException { //TODO } } In your method you should return TargetInterface. Otherwise, if you want to know all object structure, your object should be Serializable: public class Target implements Serializable is something like this that are you lookin for?

http://stackoverflow.com/a/26170207
has body: You can use regex: ^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=])(?=\S+$).{8,}$ Implementation: import java.util.regex.*; public class passwordvalidation { public static void main(String[] args) { String passwd = "aaZZa44@"; String pattern = "(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=])(?=\\S+$).{5,10}"; System.out.println(passwd.matches(pattern)); } } Find more here in this stackoverflow post: Regex explained
score: 0
answers question: http://stackoverflow.com/q/26170145
type: Answer

http://stackoverflow.com/a/26109407
answers question: http://stackoverflow.com/q/26100619
has comment: http://stackoverflow.com/comment/40925955
downvote count: 0
has comment: http://stackoverflow.com/comment/40925683
score: 1
has body: Question 1. I have no idea. It looks like you aren't only one asking this: https://discussions.apple.com/thread/4244061?start=0&amp;tstart=0 Did you check Console to see any errors/warnings? One crazy idea. May be this restriction is only applicable to supervised devices. They may just forgot to mention it in the documentation. Question 2. You can't do it. It's either removable (for non supervised or supervised device) or non removable (supervised devices only).
has comment: http://stackoverflow.com/comment/40948796
upvote count: 1
type: Answer

http://stackoverflow.com/a/26152736
has comment: http://stackoverflow.com/comment/40997549
has comment: http://stackoverflow.com/comment/40997327
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40997239
has comment: http://stackoverflow.com/comment/40997255
has body: The assignment operator is a ordinary expression. Like any other expression, you can put it wherever you want to. The value of this expression is the value being assigned. (This is also why you can write a = b = c)
downvote count: 0
answers question: http://stackoverflow.com/q/26152726

postgresql
tags question: http://stackoverflow.com/q/26165270
tags question: http://stackoverflow.com/q/26179976
tags question: http://stackoverflow.com/q/26156418
tags question: http://stackoverflow.com/q/26169355
tags question: http://stackoverflow.com/q/26110185
tags question: http://stackoverflow.com/q/26077484
tag name: postgresql
tags question: http://stackoverflow.com/q/26186413
tags question: http://stackoverflow.com/q/26193141
tags question: http://stackoverflow.com/q/26082435
type: Tag
tags question: http://stackoverflow.com/q/26142526
tags question: http://stackoverflow.com/q/26162964
tags question: http://stackoverflow.com/q/26064489
tags question: http://stackoverflow.com/q/26147101

http://stackoverflow.com/comment/40837686
type: QuestionComment
score: 1
has text: Thanks @Chris. It work's perfekt.
type: Comment
comment on: http://stackoverflow.com/q/26058826

http://stackoverflow.com/comment/40817784
has text: Just updating the jetty-maven-plugin (now I'm using 9.2.3) the `security-constraint` tag start to work. Thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26042276

http://stackoverflow.com/q/26140874
has answer: http://stackoverflow.com/a/26140973
has answer: http://stackoverflow.com/a/26140908
has comment: http://stackoverflow.com/comment/40974719
upvote count: 3
type: Question
type: AnsweredQuestion
score: 3
has body: I am trying to create a class that has a singleton property using a static factory method.. package ishan.Beans; public class ControlManager { private static ControlManager controlManager=null; private double id; private ControlManager() { this.id=Math.random(); } public static ControlManager getControlManager() { if(null==controlManager) return new ControlManager(); return controlManager; } public double getId() { return id; } } package ishan.Beans; public class Usage { public static void main(String a[]) { ControlManager cManager=ControlManager.getControlManager(); ControlManager c=ControlManager.getControlManager(); System.out.println(c); System.out.println(cManager); } } Every time I run this code, I get different instances of ControlManager in c and cManager. I am unable to figure out the problem or what is it that I am doing wrong.
tagged with: java
has title: Implementing Singleton using factory method
accepted answer: http://stackoverflow.com/a/26140908
downvote count: 0
answer count: 3
tagged with: singleton
possible better answer: http://stackoverflow.com/a/26140913
has answer: http://stackoverflow.com/a/26140913
favorite count: 0

http://stackoverflow.com/a/26063041
type: Answer
answers question: http://stackoverflow.com/q/26062613
has body: You should probably avoid trying to write your own compare method, because they can be hard to reason about. With Google Guava: private static final TreeSet&lt;Node&gt; treeSet = new TreeSet&lt;&gt;(nodeOrdering); Where nodeOrdering is defined as: Comparator&lt;Node&gt; nodeOrdering = Ordering.natural() .onResultOf(isValidFunction) .compound(Ordering.natural().onResultOf(totalValueFunction)); isValidFunction is defined like this: Function&lt;Node, Boolean&gt; isValidFunction = new Function&lt;&gt;() { @Override public Boolean apply(Node input) { return input.isValid; } }; totalValueFunction is defined similarly: Function&lt;Node, Double&gt; totalValueFunction = new Function&lt;&gt;() { @Override public Double apply(Node input) { return input.totalVal; } };
has comment: http://stackoverflow.com/comment/40833204
has comment: http://stackoverflow.com/comment/40833426
score: 0

http://stackoverflow.com/q/26041723
favorite count: 0
has answer: http://stackoverflow.com/a/29340196
upvote count: 1
has title: Hadoop memory usage: reduce container is running beyond physical memory limits
has body: I have simple mappers and following simple reducer (it is joining of two large tables by one field): protected void reduce(StringLongCompositeKey key, Iterable&lt;Text&gt; values, Context context) throws IOException, InterruptedException {} foreach(Text text : values) { // do some operations with one record and then emit it using context.write // so nothing is storing in memory, one text record is small (mo more then 1000 chars) } } but I got following error 14/09/25 17:54:59 INFO mapreduce.Job: map 100% reduce 28% 14/09/25 17:57:14 INFO mapreduce.Job: Task Id : attempt_1410255753549_9772_r_000020_0, Status : FAILED Container [pid=24481,containerID=container_1410255753549_9772_01_001594] is running beyond physical memory limits. Current usage: 4.1 GB of 4 GB physical memory used; 4.8 GB of 8.4 GB virtual memory used. Killing container. There is one nuance -) Iterable&lt;Text&gt; values is very long! As I considered before, and still believe that it is true, that that Iterable loads next record on demand, and it shouldn't be problem for hadoop to process it, without consumption a lot of RAM. Could this error appear while shuffling or sorting? Is there any special information about processing long sequences?
accepted answer: http://stackoverflow.com/a/26042117
possible better answer: http://stackoverflow.com/a/29340196
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26042117
score: 1

http://stackoverflow.com/a/26115994
answers question: http://stackoverflow.com/q/26114760
type: Answer
has comment: http://stackoverflow.com/comment/97249171
has comment: http://stackoverflow.com/comment/40935939
has body: This is because of the default namespace xmlns="http://www.w3.org/2000/svg". Try using the local-name() function: .//*[local-name()=\"text\" and @class=\"hurz\"]
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26114760

http://stackoverflow.com/q/26039401
has answer: http://stackoverflow.com/a/26121257
has title: Calling my WebService via AJAX more often causes a server fault
has body: I have a class that I run on the Java SE that gets called through a thread every second. Everything works fine. However when I transform this into a WebService and call it via AJAX every second, I get a SOAP server fault. However if I call it every 6 seconds, everything is fine. The method I used to call cannot perform the work. It actually succeeds to read and parse XML, but when converted to a WebService the XML parsing crashes. What could cause the fault, when calling the WebService more often? Here is the exception thrown on the server side : [Fatal Error] :1:7: A pseudo attribute name is expected. Sep 25, 2014 3:22:46 PM com.sun.xml.internal.ws.server.sei.TieHandler createResponse SEVERE: null java.lang.NullPointerException at Targets.XML.TESXMLStringToArrays(XML.java:209) at Navires.Vessel.allVessels(Vessel.java:137) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.reflect.misc.Trampoline.invoke(Unknown Source) at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.reflect.misc.MethodUtil.invoke(Unknown Source) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.xml.internal.ws.api.server.MethodUtil.invoke(Unknown Source) at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(Unknown Source) at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(Unknown Source) at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source) at com.sun.…
type: AnsweredQuestion
tagged with: ajax
type: Question
accepted answer: http://stackoverflow.com/a/26121257
tagged with: http://stackoverflow.com/tag/xml
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40789680
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/q/26054975
score: 0
tagged with: smartcard
tagged with: android
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: Does anyone know how to get the Smart Card ATR for an Android application by using the NFC API? The card that I am using is a contactless card. I have this code szATR =" 3B " + getATRLeString(myTag.getHistoricalBytes())+ "80 01 " + getHexString(myTag.getHistoricalBytes())+""+ getATRXorString(myTag.getHistoricalBytes()); but it is returning null as response.
type: Question
tagged with: contactless-smartcard
has answer: http://stackoverflow.com/a/26069954
has title: How to get smart card ATR by using the Android NFC API?
answer count: 1
accepted answer: http://stackoverflow.com/a/26069954
tagged with: nfc
has comment: http://stackoverflow.com/comment/40818997

http://stackoverflow.com/comment/40881426
has text: Yes, but after I load that image I should be able to click and drag and manipulate the shapes again
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26089184

http://stackoverflow.com/a/26091410
downvote count: 0
answers question: http://stackoverflow.com/q/26091133
has body: Tell your friend this: A smart man knows that tomato is a fruit and not a vegetable, a wise man know that you don't put tomato in a fruit salad. Point is: yes, technically he can write this for(int i = 0; i != max; i++){ ... } but if other programer will read it - they most likely question the reason. Keep it simple and consistent. as mentioned already: If the value changes inside the for-loop, you may end-up with infinite loop -don't do that.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26096797
score: 0
answers question: http://stackoverflow.com/q/26096618
type: Answer
has body: As you have told the date format "MM/dd/yyyy" so it will check only first four characters after "/" if you write the date as "12/31/XYZ2014" it will throw an exception and invalid date will be printed.

http://stackoverflow.com/a/26181774
has comment: http://stackoverflow.com/comment/41051111
has comment: http://stackoverflow.com/comment/41058435
has comment: http://stackoverflow.com/comment/41051410
type: Answer
answers question: http://stackoverflow.com/q/26180897
has comment: http://stackoverflow.com/comment/41052166
has comment: http://stackoverflow.com/comment/41051574
has comment: http://stackoverflow.com/comment/41052209
has comment: http://stackoverflow.com/comment/41051294
has comment: http://stackoverflow.com/comment/41051582
has comment: http://stackoverflow.com/comment/41051733
has comment: http://stackoverflow.com/comment/41051093
has comment: http://stackoverflow.com/comment/41051556
has comment: http://stackoverflow.com/comment/41051533
has comment: http://stackoverflow.com/comment/41051199
has comment: http://stackoverflow.com/comment/41057003
has comment: http://stackoverflow.com/comment/41051795
score: 0
has comment: http://stackoverflow.com/comment/41051260
has body: According to the Wikipedia article, your formulas for adding two pixels are wrong. Edit(2): The normal operator is not commutative. There is a clear difference between background and foreground. You need to swap the arguments thus: normal(pixels[tp + xx],col); instead of: normal(col,pixels[tp + xx]); The first error is in alpha value extraction, you use: int aA = (a >> 24 &amp; 0xff); //read by a compiler as (a >> (24 &amp; 0xff)) use int aA = (a &gt;&gt; 24) &amp; 0xff; instead. You should use: int A = (int) (aA+bA*(1-srcAlpha)); int R = (int) (aR*srcAlpha+bR*dstAlpha*(1-srcAlpha)); //... Why do you add 0.5? Performance optimization: In order to optimize performance, you can circumvent using floating point operations, by shifting back the result: int cA = 0xff-aA; int A = aA+bA*cA/0xff; int R = (aR*aA+bR*bA*cA)/0xff; //...
has comment: http://stackoverflow.com/comment/41051612
has comment: http://stackoverflow.com/comment/41051909

http://stackoverflow.com/comment/40872856
score: 1
comment on: http://stackoverflow.com/q/26084761
type: Comment
type: QuestionComment
has text: Implementing a pipeline stage involves nothing more than reading from stdin, and writing to stdout.

http://stackoverflow.com/q/26094756
score: 4
has comment: http://stackoverflow.com/comment/42756859
upvote count: 4
answer count: 3
has title: OAuth authentication with DropWizard
tagged with: dropwizard
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26103543
tagged with: oauth
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47353664
has body: I have a set of RESTful web services built on DropWizard. Currently I am using BasicAuth to authenticate the users to use the API . That involves an overhead of having another DB with user/password details. I was looking about token based authentication and found that DropWizard supports Oauth2 out of the box. Can anyone help me with a sample implementation of this Oauth2 based authentication ? And what would be the architecture to implement so ? Any help would be appreciated.
tagged with: java
has answer: http://stackoverflow.com/a/46973423
type: Question
has answer: http://stackoverflow.com/a/54100059

http://stackoverflow.com/comment/40987944
type: AnswerComment
has text: @Pshemo org.json.JSONObject
type: Comment
comment on: http://stackoverflow.com/a/26147295
score: 0

http://stackoverflow.com/comment/40889145
has text: out parameter will not bring any value into procedure but it will return some value to the java program. here date_info is an out parameter and used in condition clause. that is the problem please check once.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26093112

http://stackoverflow.com/comment/40813118
type: Comment
type: QuestionComment
score: 0
has text: @MikeNguyen do you get System.out.print correctly ?
comment on: http://stackoverflow.com/q/26052064

http://stackoverflow.com/a/26173129
has body: It would help if you could show what the column name constants are (especially for KEY_MAINHUTY.) In any case, after looking this over, the only thing I can conclude is that the table you are querying does not have a column with the name specified by KEY_MAINHUTY. Can you verify that your table does indeed have a column with the name specified by KEY_MAINHUTY? The call to c.getColumnIndex(KEY_MAINHUTY); is returning -1, yet that column name is clearly specified in your columns array.
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41035332
has comment: http://stackoverflow.com/comment/41035380
type: Answer
answers question: http://stackoverflow.com/q/26172994
accepted answer of: http://stackoverflow.com/q/26172994

http://stackoverflow.com/comment/40949176
type: AnswerComment
comment on: http://stackoverflow.com/a/26126185
type: Comment
has text: the `new` operator means object creation. Since this code is not inside a method but inside the class, and since this object is not static, it is created when the enclosing object (your `RouteMapActivity`) is created.
score: 0

http://stackoverflow.com/comment/40783882
has text: Then that's why you're getting an error. Please post your directory structure so that I can help you fix it.
comment on: http://stackoverflow.com/q/26036313
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26172415
upvote count: 1
answers question: http://stackoverflow.com/q/26166088
has comment: http://stackoverflow.com/comment/41033848
downvote count: 0
type: Answer
has body: What you should do instead of calling hashCode - which has collisions all by itself - is to hash a canonical encoding in bytes. BigInteger has though, each number has its own unique encoding as byte array. Not all objects have such a canonical encoding though, so you cannot create a generic method for it. Furthermore, you also need some method of keeping the values apart (e.g. 11 could be a concatenation of 1 and 1 or the number 11). The easiest way is probably to prefix the value with the size of the value. public static byte[] buildHashFromSeparatedCanonicalValues(final BigInteger ... numbers) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("SHA-256 should always be available", e); } final ByteBuffer lengthBuffer = ByteBuffer.allocate(Integer.SIZE / Byte.SIZE); for (BigInteger number : numbers) { if (number == null) { throw new IllegalArgumentException( "Input objects cannot be null"); } final byte[] encodedNumber = number.toByteArray(); lengthBuffer.putInt(encodedNumber.length); lengthBuffer.flip(); md.update(lengthBuffer); lengthBuffer.clear(); md.update(encodedNumber); } return md.digest(); } This is specific for BigInteger values. You could make this more generic by serializing objects (that implement Serializable) but beware of serialization pitfalls.
score: 1

http://stackoverflow.com/a/32752342
accepted answer of: http://stackoverflow.com/q/26105187
answers question: http://stackoverflow.com/q/26105187
score: 1
upvote count: 1
has body: The latest release of Spring Data REST's docs illustrate excerpt projections. This provides an alternative default view of a collection of data. Your use case is the exact angle it was originally designed for.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/60248742
type: Answer

http://stackoverflow.com/comment/52833758
type: Comment
type: AnswerComment
has text: Thanks for editing the answer. Now it is more clear. It means adding final to main method at any class will not allow to create a main method in the child classes into the inheritance hierarchy.
score: 0
comment on: http://stackoverflow.com/a/26042869

http://stackoverflow.com/a/26103991
has body: You can override toString() method in your Class1, Class2 and so on like this: @Override public String toString() { return this.memberX + " " + this.memberY; } which will print memberX and memberY. System.out.println(x); invokes x.toString(); by default.
type: Answer
has comment: http://stackoverflow.com/comment/40908272
has comment: http://stackoverflow.com/comment/40907911
answers question: http://stackoverflow.com/q/26103934
has comment: http://stackoverflow.com/comment/40908105
score: 0
has comment: http://stackoverflow.com/comment/40908227

http://stackoverflow.com/q/26035917
answer count: 2
has answer: http://stackoverflow.com/a/26038369
downvote count: 0
has body: I have a multimodule project and want to generate FindBugs report either for the entire code, or, at least, for every individual module (and then aggregate individual results with https://code.google.com/p/findbugs-aggregator/ ). But when I run mvn site, neither individual report, nor the aggregated report is generated. How can I fix this? 4.0.0 mycompany-studio com.mycompany.parentproject 1.0.0-SNAPSHOT pom 0.21.0 0.21.0 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 1.7 file:///home/jenkins/repo/supermirror Supermirror repository p2 ${supermirror} Codehaus repository http://repository.codehaus.org/ <distributionManagement> ${project.artifactId}-site ${project.baseUri} </distributionManagement> org.eclipse.tycho tycho-maven-plugin ${tycho-version} true org.eclipse.tycho target-platform-configuration ${tycho-version} win32 win32 x86_64 win32 win32 x86 linux gtk x86_64 linux gtk x86 org.eclipse.tycho tycho-versions-plugin ${tycho-version} org.eclipse.tycho tycho-packaging-plugin ${tycho-version} 'mycompany_'yyyyMMddHHmm ../com.mycompany.module1 ../com.mycompany.module2 ../com.mycompany.module3 org.apache.maven.plugins maven-site-plugin 3.0 org.apache.maven.plugins maven-project-info-reports-plugin 2.7 org.apache.maven.plugins maven-checkstyle-plugin 2.8 sun-coding-standard.checkstyle.xml <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression> checkstyle-suppressions.xml aggregate aggregate org.codehaus.mojo findbugs-maven-plugin 3.0.0 true org.codehaus.mojo findbugs-maven-plugin 3.0.0 true org.apache.maven.plugins maven-pmd-plugin true Update 1 (25.09.2014 14:39): New version, still doesn't work. 4.0.0 mycompany-studio com.mycompany.parentproject 1.0.0-SNAPSHOT pom 0.21.0 0.21.0 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 1.7 file:///home/jenkins/repo/supermirror Supermirror repository p2 ${supermirror} Codehaus repository http://repository.codehaus.org/ <distributionManagement> ${project.artifa…
tagged with: findbugs
tagged with: maven-3
has answer: http://stackoverflow.com/a/26036273
has title: Why doesn't FindBugs generate any reports?
favorite count: 0
type: UnansweredQuestion
tagged with: maven
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/41117625
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26138304
has text: I copied the original :)
score: 0

http://stackoverflow.com/comment/41079797
comment on: http://stackoverflow.com/a/26197276
type: AnswerComment
has text: i used your edited answer, however the dialogue box that displays is a row of horizontal numbers, with each number seperated by a space. This makes it unreadable. Ideally i am looking for the output in the dialogue box as a list. Before i removed the tags the numbers appeared in a list..
score: 0
type: Comment

http://stackoverflow.com/comment/40876149
score: 0
type: QuestionComment
has text: Thanks Sergiy for quick reply.But I could not post complete code here because it contain lots of class dependency. i can provide additional information if you needed
comment on: http://stackoverflow.com/q/26086294
type: Comment

http://stackoverflow.com/q/26058131
has answer: http://stackoverflow.com/a/26058277
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26059876
has body: I need you help in my observer pattern where I'm suppose to update when either TEMPERATURE or PRESSURE or HUMIDITY is updated. Here's the code: public static void main(String[] args) { TemperatureSensor t = new TemperatureSensor(); PressureSensor p = new PressureSensor(); HumiditySensor h = new HumiditySensor(); WeatherObserver w = new WeatherObserver(); w.addSubject(t); w.addSubject(p); w.addSubject(h); t.setTemperature(28); System.out.println("-------------------------------"); p.setPressure(200); System.out.println("-------------------------------"); h.setHumidity(89); } class Subject { private List&lt;Observer&gt; observers=new ArrayList&lt;Observer&gt;(); public void attachObserver(Observer observer) { this.observers.add(observer); } public void detachObserver(Observer observer) { this.observers.remove(observer); } public void notifyObservers() { for (Observer observer: this.observers) observer.update(this); } } class TemperatureSensor extends Subject { private double temperature; public double getTemperature() { return this.temperature; } public void setTemperature(double temp) { this.temperature=temp; this.notifyObservers(); // don't forget to do this! } } class PressureSensor extends Subject { private double pressure; public double getPressure() { return this.pressure; } public void setPressure(double press) { this.pressure=press; this.notifyObservers(); // don't forget to do this! } } class HumiditySensor extends Subject { private double humidity; public double getHumidity() { return this.humidity; } public void setHumidity(double humid) { this.humidity=humid; this.notifyObservers(); // don't forget to do this! } } abstract class Observer { public Observer(Subject subject) { subject.attachObserver(this); } abstract public void update(Subject subject); } class WeatherObserver extends Observer { public WeatherObserver(Subject subject) { super(subject); } public void addSubject(Subject subject){ subject.attachObserver(this); } public void update(Subject subjec…
score: 0
has title: Observer Pattern (temperature, pressure and humidity)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26059876
possible better answer: http://stackoverflow.com/a/26058277

http://stackoverflow.com/a/26133175
score: 0
has comment: http://stackoverflow.com/comment/40960997
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26133114
has comment: http://stackoverflow.com/comment/40960967
has comment: http://stackoverflow.com/comment/40961138
has comment: http://stackoverflow.com/comment/40961096
has comment: http://stackoverflow.com/comment/40961121
has comment: http://stackoverflow.com/comment/40961056
upvote count: 1
has body: try changing your code so that it returns after setting the correct data e.g. if (rmnum == 225){ name = "Mr. Clark"; catchphrase = "Just do it."; roomnumber = 225; return; } if (rmnum == 123){ name = "Mr. Harris"; catchphrase = "Do the essays and you will pass."; roomnumber = 123; return; } if (rmnum == 237){ name = "Mr. Turley"; catchphrase = "Give a perfect effort."; roomnumber = 237; return; } Of course it would be cleaner as less repetitive if you had a constructor that took name catchphrase and roomnumber
has comment: http://stackoverflow.com/comment/40961132

http://stackoverflow.com/comment/40858399
type: QuestionComment
has text: I disagree that this question leads to answers which simply offer personal opinion. The question asks for code which is functionally equivalent to nested for loops, and each answer given can be tested for correctness. Opinion does not play a part.
comment on: http://stackoverflow.com/q/26045184
score: 0
type: Comment

http://stackoverflow.com/comment/40802765
has text: I am using Hibernate.
comment on: http://stackoverflow.com/a/26046329
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40975678
type: QuestionComment
comment on: http://stackoverflow.com/q/26137932
score: 5
has text: It's not exactly what you're looking for, but this existing Spring Boot issue may be of interest: https://github.com/spring-projects/spring-boot/issues/1254
type: Comment

http://stackoverflow.com/a/26179833
has comment: http://stackoverflow.com/comment/41056979
has comment: http://stackoverflow.com/comment/41054655
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26177858
answers question: http://stackoverflow.com/q/26177858
type: Answer
score: 2
downvote count: 0
has body: The XML that you need is not well-formed. I suggest you to wrap all Person. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Persons", propOrder = { "person" }) @XmlRootElement(name = "Persons") public class Persons implements Serializable { private final static long serialVersionUID = 12343L; @XmlElement(name = "Person", required = true) protected List person; // getter and setter } output expected India 1 Aatif Hasan USA 2 ABC UK/country> 3 XYZ Anything here there is a possible solution to append xml into a file.
upvote count: 2

http://stackoverflow.com/a/26036458
downvote count: 0
has body: Just take elements from two iterators in parallel, while summing up the values, and building the new result array list. When you finished with the shortest list, you simply run through the longer list's iterator, and append the values to the result list. Something like this: List&lt;Integer&gt; l1 = ...; // shorter List&lt;Integer&gt; l2 = ...; // longer List&lt;Integer&gt; result = new ArrayList&lt;Integer&gt;(); // result Iterator&lt;Integer&gt; i1 = l1.iterator(); Iterator&lt;Integer&gt; i1 = l2.iterator(); // Add the numbers as long as both lists have elements at that position while(i1.hasNext() &amp;&amp; i2.hasNext()) { result.append(i1.next() + i2.next()); } // Append the remaining elements. // Note that it's not possible for both lists to have remaining elements. while(i1.hasNext()) { result.append(i1.next()); } while(i2.hasNext()) { result.append(i2.next()); }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26036354
has comment: http://stackoverflow.com/comment/40784051

http://stackoverflow.com/a/26124957
answers question: http://stackoverflow.com/q/26122487
has body: What you are asking for is the so-called routing file. And the answer is: yes, Madvoc has support for routing files, since v3.6 (that was one of the new features, so thats maybe why you didn't know about it:). Anyway, all you have to do is to have a route file and use different configurator: RouteMadvocConfigurator instead of default one. This configurator reads routing file from the class path and defines the actions from it. You should be able to specify all action flags using routing file, including async flag, interceptors and so on. Nice thing about the routing file is that it's syntax is not so strict, so you can make your own format easily. Here is an example of routing file: `/hello.html` "jodd.madvoc.action.HelloAction#view" GET /helloWorld.html jodd.madvoc.action.HelloAction#world /zigzag/${id} jodd.madvoc.action.ArgsAction#zigzag /zigzag As said, the format is loose, so you can e.g. define http method name everywhere you like in the line and so on. You can see more details in official documentation.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40956691
score: 0
accepted answer of: http://stackoverflow.com/q/26122487
type: Answer

http://stackoverflow.com/comment/40990910
has text: Your string is valid JSON, you could use Jackson's ObjectMapper to do it, but it seems like over kills
score: 1
comment on: http://stackoverflow.com/q/26149289
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26172645
answer count: 1
downvote count: 0
has title: Android Connect to MySQL using Java and REST
accepted answer: http://stackoverflow.com/a/26172718
score: 1
favorite count: 0
tagged with: rest
tagged with: android
has comment: http://stackoverflow.com/comment/41034274
has body: currently I am working with Android native and MySQL. To connect both of it, I used Java and REST. However, when I tried to run my REST service, I did not get any response (just blank page show up). I have tried to check the log and I did now find any error. Here is my code: Database.java -- Database Connection file package datasource; import java.sql.Connection; import java.sql.DriverManager; public class Database { @SuppressWarnings("finally") public static Connection createConnection() throws Exception { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/friseur", "root", ""); } catch (Exception e) { throw e; } finally { return con; } } } QueryPhoto.java -- To query from database package query; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import datasource.Database; import model.Photo; public class QueryPhoto { public static ArrayList<Photo> GetPhoto() throws Exception { ArrayList<Photo> photo = new ArrayList<Photo>(); Connection dbConn = null; try { try { dbConn = Database.createConnection(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Statement stmt = dbConn.createStatement(); String selectPhoto = "SELECT * FROM photo, user where photo.user_id = user.id"; ResultSet rs = stmt.executeQuery(selectPhoto); while(rs.next()) { Photo photoObject = new Photo(); photoObject.setPDateUpload(rs.getString("added_time")); photoObject.setPUrlOriginal(rs.getString("url_original")); photoObject.setPUrlWithHair(rs.getString("url_with_hair")); photoObject.setCaption(rs.getString("caption")); photoObject.setUserId(Integer.parseInt(rs.getString("user_id"))); photoObject.setUserName(rs.getString("username")); photo.add(photoObject); } } catch (SQLException sqle) { throw sqle; } catch (Exception e) { // TODO Auto-generated catch block if (dbConn != null) { dbConn.close(); } …
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/26172718
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/26189940
score: 4
upvote count: 5
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26293331
accepted answer: http://stackoverflow.com/a/26293331
linked to: http://stackoverflow.com/q/32568261
has comment: http://stackoverflow.com/comment/41083989
has comment: http://stackoverflow.com/comment/41070577
tagged with: nashorn
type: AnsweredQuestion
has title: Java 8 Nashorn ArrayIndexOutOfBoundsException
tagged with: java
has body: What, if anything, can I do to stop Nashorn from throwing an ArrayIndexOutOfBoundsException all the time? This seemingly trivial and correct (there's no bug herein) code snippet causes Nashorn to the exception: File test.js: var test; (function (test) { (function (renderer) { var posts = { 0: null, 1: null, 2: null, 3: null // comment out this line --&gt; no exception thrown }; })(test.renderer = {}); // comment out 'test.renderer = ' --&gt; no exception thrown })(test = {}); Then run the script like so: /usr/lib/jvm/java-8-oracle/bin/jjs test.js Result: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at jdk.nashorn.internal.runtime.AccessorProperty.initGetterSetter(AccessorProperty.java:271) at jdk.nashorn.internal.runtime.AccessorProperty.&lt;init&gt;(AccessorProperty.java:250) at jdk.nashorn.internal.runtime.SetMethodCreator.createNewFieldSetter(SetMethodCreator.java:166) at jdk.nashorn.internal.runtime.SetMethodCreator.createNewPropertySetter(SetMethodCreator.java:156) at jdk.nashorn.internal.runtime.SetMethodCreator.createSetMethod(SetMethodCreator.java:122) at jdk.nashorn.internal.runtime.SetMethodCreator.createGuardedInvocation(SetMethodCreator.java:78) at jdk.nashorn.internal.runtime.ScriptObject.findSetMethod(ScriptObject.java:1911) at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1632) at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:96) at jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176) at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124) at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:144) at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:232) at jdk.nashorn.internal.scripts.Script$test.L:2(test.js:3) at jdk.nashorn.internal.scripts.Script$te…
type: Question
has comment: http://stackoverflow.com/comment/59245740
answer count: 1
tagged with: javascript

http://stackoverflow.com/a/26134542
answers question: http://stackoverflow.com/q/26134338
type: Answer
upvote count: 1
has body: As a general rule, you should always do a redirect and not a forward after a submit (post). It avoids a lot of problems with the back button of the browser. That is called the post - redirect - pattern
score: 1
downvote count: 0

http://stackoverflow.com/comment/40900644
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26099582
has text: do you have a sample for that?
type: AnswerComment

http://stackoverflow.com/q/26076154
favorite count: 0
has answer: http://stackoverflow.com/a/26076215
has comment: http://stackoverflow.com/comment/40857399
type: UnansweredQuestion
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40857001
has title: How do I use the "this" keyword in java?
tagged with: java
answer count: 2
has body: I've been using multiple methods, but my "java the complete reference" book doesn't do a good job of explaining how to use the "this" keyword.
score: -2
tagged with: this
has comment: http://stackoverflow.com/comment/40856898
has answer: http://stackoverflow.com/a/26076249

http://stackoverflow.com/a/26127066
answers question: http://stackoverflow.com/q/26126998
score: 1
upvote count: 1
downvote count: 0
has body: You are getting incompatible types because you are attempting to use a boolean case label true when the switch expression is a String s. You don't even need the String; just use b itself. booleans aren't allowed as switch expressions, but you don't need a switch if all you have is a boolean. Just use an if statement.
type: Answer

http://stackoverflow.com/q/26159196
favorite count: 0
has body: Hi all and Sorry in advance for asking this question, but after five days of searching on stackoverflow and doing google-engineering I still got no answer for my question: I would like to include several *.jar files to my project that shall be used by my android app after Qt compiled it. Here is my environment: Installed Qt Creator 3.2.1(exe, not compiled from sources) main.cpp (starting Qt-Part) android/MainActivity.java (starting simple "Hello world" stuff and shall include different classes provided by the .jars (google-api-client-1.19.0.jar google-api-client-android-1.19.0.jar google-http-client-1.19.0.jar google-http-client-android-1.19.0.jar google-http-client-jackson-1.19.0.jar google-oauth-client-1.19.0.jar jackson-core-asl-1.9.13.jar jsr305-1.3.9.jar) android/AndroidManifest.xml android/libs containing the required .jars After googling for that problem, I tried almost everything, getting the same result each time: the .jars are not found for the android application or the build process did not work: [javac] C:\workspaces\qt_android\build-GsQt-Android\android-build\src\com\gservice\MainActivity.java:14: error: package com.google.android.gms.common does not exist [javac] import com.google.android.gms.common.ConnectionResult; [javac] ^ [javac] C:\workspaces\qt_android\build-GsQt-Android\android-build\src\com\gservice\MainActivity.java:15: error: package com.google.android.gms.common.api does not exist [javac] import com.google.android.gms.common.api.GoogleApiClient; [javac] ^\MainActivity.java:15: error: package com.google.android.gms.common.api does not exist and so on, for all of the eight jars that shall be included. Here are the things I tried to include them: created a folder within android, called "libs" and put my jars into it. After building the project, the folder and the jars have been copied to the build directory. By not to the device as it seems. included them as simple other files like the AndroidManifest and the MainActivity: OTHER_FILES += \ an…
linked to: http://stackoverflow.com/q/8850202
tagged with: android
upvote count: 6
has title: Qt Creator 3.2.1 including .jar for Android
type: UnansweredQuestion
score: 6
tagged with: qt-creator
has answer: http://stackoverflow.com/a/26650469
tagged with: qt
tagged with: java
has answer: http://stackoverflow.com/a/26159623
type: Question
answer count: 2
tagged with: jar
downvote count: 0

http://stackoverflow.com/comment/40863227
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26079406
has text: It is possible to develope modules independently, but all modules they depend on, the parent included, must have already been deployed. Btw, are your submodules correctly declaring parents?
score: 0

http://stackoverflow.com/q/26191909
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41069814
has comment: http://stackoverflow.com/comment/41069956
tagged with: java
has answer: http://stackoverflow.com/a/26192007
downvote count: 3
has comment: http://stackoverflow.com/comment/41069876
type: Question
score: -2
has comment: http://stackoverflow.com/comment/41070071
has comment: http://stackoverflow.com/comment/41069967
favorite count: 0
has body: As far as I know when an object is created within a given class memory is allocated for that particular object. but in this case: public class KindA { KindB b = new KindB(); // rest of the code } public class KindB { KindA a = new KindA(); // rest of the code } What happens in this case on the memory allocation side of things when 2 classes create objects of eachother?
has comment: http://stackoverflow.com/comment/41069919
answer count: 1
has comment: http://stackoverflow.com/comment/41069999
has comment: http://stackoverflow.com/comment/41069837
has title: What happens when 2 classes create objects of each other?
has comment: http://stackoverflow.com/comment/41069908
accepted answer: http://stackoverflow.com/a/26192007
upvote count: 1
has comment: http://stackoverflow.com/comment/41069938

http://stackoverflow.com/comment/40923254
score: 0
type: Comment
type: QuestionComment
has text: the class has several methods with jUnit annotations. I dont want to call any particular method but the whole class to get executed on click of button.
comment on: http://stackoverflow.com/q/26096401

http://stackoverflow.com/a/26118612
has body: I would write it like this (you may not need generics here but why not do it): public static &lt;A, T&gt; Optional&lt;T&gt; findFirst(Predicate&lt;T&gt; predicate, A argument, Function&lt;A, T&gt;... functions) { return Arrays.stream(functions) .map(f -&gt; f.apply(argument)) .filter(predicate::test) .findFirst(); } And you can call it with: return findFirst(Objects::nonNull, args, this::queryFirstSource, this::querySecondSource, this::queryThirdSource); (assuming your queryXXX methods are instance methods) The methods will be applied in order until one returns a value that matches the predicate (in the example above: returns a non null value).
upvote count: 7
answers question: http://stackoverflow.com/q/26118090
type: Answer
downvote count: 0
score: 7

http://stackoverflow.com/comment/41039773
score: 1
has text: @xxa You mean I shall change it, chopstick[n] = false; n + 1 in the case of the right method?
type: Comment
comment on: http://stackoverflow.com/q/26170786
type: QuestionComment

http://stackoverflow.com/comment/40983705
comment on: http://stackoverflow.com/q/26145459
type: Comment
type: QuestionComment
score: 0
has text: So to clarify, you set `ResponseDTO.id = 9223372036854775807` and receive `{ "id": "922337203685477000", ... }`? This seems wrong for several reasons.

http://stackoverflow.com/comment/40932349
has text: You're missing a close quote, and you're using `<=` instead of `<`. Other than that, it should work (even without the short-circuit operator).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26117631
score: 1

http://stackoverflow.com/comment/41033400
comment on: http://stackoverflow.com/q/26171897
score: 0
type: Comment
type: QuestionComment
has text: You're quite welcome.

http://stackoverflow.com/comment/41290233
type: AnswerComment
has text: Thomas, thank you again! This is all very useful. We have another assignment due soon for which we get to use lists, so at least I'll get to try those out very soon. You were correct, the boolean did help. My professor helped me with the last part; I had the boolean backwords. This ended up working: `boolean isInBook = false; for (int i = 0; i < people; i++) { if (addressBook[i] == person) { isInBook = true; } } if (!isInBook)`
score: 0
comment on: http://stackoverflow.com/a/26157237
type: Comment

http://stackoverflow.com/comment/40990848
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26149153
has text: I've got: `java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user' available as request attribute`
score: 0

http://stackoverflow.com/a/26034390
has comment: http://stackoverflow.com/comment/40780804
accepted answer of: http://stackoverflow.com/q/26034276
upvote count: 1
has body: As assylias points out, you may want to go for composition instead of inheritance in this case. If you really want to stick with inheritance, this may be sufficient: @Override public Iterator&lt;T&gt; iterator() { Iterator&lt;T&gt; delegate = super.iterator(); return new Iterator&lt;T&gt;() { @Override public boolean hasNext() { return delegate.hasNext(); } @Override public T next() { return delegate.next(); } }; } (Note, this is Java 8 which has a default implementation for remove. You'll have to override that method as well if you're on Java 7 or older.)
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40781274
answers question: http://stackoverflow.com/q/26034276
type: Answer

http://stackoverflow.com/comment/117840137
type: Comment
has text: What if you don't have permission to "%JAVA_HOME%/lib/security/cacerts" because it's a work computer?
score: 1
comment on: http://stackoverflow.com/a/26183328
type: AnswerComment

http://stackoverflow.com/q/26174269
has body: import java.applet.*; import java.awt.*; public class SumProduct extends Applet { public void init() { TextField txt1 = new TextField(""); TextField txt2 = new TextField(""); //TextField txt3= new TextField(); Button p = new Button("Sum"); Button q = new Button("Product"); add(p); add(q); add(txt1); add(txt2); //add(txt3); } public Boolean action(Event e, Object args) { if (e.target == p) { r = a + b; } if (e.target == q) { r = a * b; } } public void print(Graphics g) { int a = 0, b = 0, r; String m; String s1 = txt1.getText(); String s2 = txt2.getText(); a = Integer.parseInt(s1); b = Integer.parseInt(s2); m = String.valueOf(r); g.drawString(m, 100, 75); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41037308
linked to: http://stackoverflow.com/q/6255106
has comment: http://stackoverflow.com/comment/41064877
tagged with: java
has answer: http://stackoverflow.com/a/26174355
type: Question
answer count: 1
tagged with: applet
score: 0
tagged with: events
has title: Trying to use applet programming and want to print sum or product on particular event but several errors are occuring?

http://stackoverflow.com/comment/40807701
type: QuestionComment
comment on: http://stackoverflow.com/q/26045798
has text: Yea, turns out two RSA providers were inserted at the top of the list in slots 1 and 2. So doing two Security.removeProvider(Security.getProviders()[0].getName()) returned the list to the jdk default and the connection worked normally. So it looks like the com.rsa.jsee.JsseProvider doesn't talk well with MSSql 2008 R2. Thanks!
score: 0
type: Comment

http://stackoverflow.com/comment/40952885
has text: we are looking for the `a[k]` value that verifies `a[k] + a[j] + a[i] == 0`, i.e. `a[k] = -(a[j] + a[i])` nothing else to it.
comment on: http://stackoverflow.com/q/26128550
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26157118
has comment: http://stackoverflow.com/comment/41005057
has answer: http://stackoverflow.com/a/26157206
downvote count: 0
possible better answer: http://stackoverflow.com/a/26157246
has answer: http://stackoverflow.com/a/26157246
favorite count: 0
tagged with: android
has body: I am developing a game with two Activities. I have one class, ModelGetter, with this method: public int getPoint { return point++; } When I press a button in FirstActivity I call modelgetter.getPoint() and it returns 0. When I press a button in SecondActivity I call modelgetter1.getPoint() again, and it still returns 0. I have created a new instance of ModelGetter in SecondActivity. I don't know how to use the same instance in different activities and have my variable always increment.
accepted answer: http://stackoverflow.com/a/26157206
answer count: 4
type: AnsweredQuestion
has title: Android Java counter between activities
has answer: http://stackoverflow.com/a/26157257
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26157359
has comment: http://stackoverflow.com/comment/41006330
linked to: http://stackoverflow.com/q/13079302
score: 1
tagged with: java

http://stackoverflow.com/q/26178839
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26180059
tagged with: java
has body: Is there anyway to parse and search an XML located in assets folder using edittext and then return the node containing the searched/queried word? E.g. My XML file would look like this: book.xml <?xml version="1.0"?> Some texts are here. This text is gonna be long paragraph Some texts are here. This text is gonna be long paragraph Some texts are here. This text is gonna be long paragraph Some texts are here. This text is gonna be long paragraph What I want to do is, I have an XML file inside assets folder, which I want to parse and search within that XML file for a particular word/words using EditText. Whenever I type for a particular word in EditText, I want that word to be parsed in the XML and then return the whole node containing the word as a result. Will that be possible? Can anyone suggest me a way to do that without using database. I hope I am making sense here. I apologise if this question is a duplicate or similar type of questions have already been asked before, but I would be so grateful if anyone could tell me how. Thanks in advance
type: Question
has answer: http://stackoverflow.com/a/26180059
answer count: 1
score: 0
tagged with: android
has title: Return xml node containing queried word in xml using edittext

abstract
tags question: http://stackoverflow.com/q/26154149
tags question: http://stackoverflow.com/q/26042391
tags question: http://stackoverflow.com/q/26044356
type: Tag
tag name: abstract

http://stackoverflow.com/q/26057199
downvote count: 1
tagged with: git
type: Question
tagged with: libgdx
score: 0
has comment: http://stackoverflow.com/comment/56764508
has comment: http://stackoverflow.com/comment/40827910
tagged with: assets
favorite count: 0
type: UnansweredQuestion
has title: Why does my resourcefolder get moved when creating a local repository?
answer count: 0
tagged with: java
has body: So I've created a project with libgdx, and if you've used libgdx you'll know that it uses an assets folder in order to load images, sounds etc. My problem is that when I created a local repository the entire project folder got moved, along with the assetsfolder. Meaning that libgdx can't find the files. When I was still in school we did this very same thing and this issue never arose. If I could get any help understanding this I'd be grateful.
upvote count: 1

http://stackoverflow.com/comment/40976066
type: AnswerComment
has text: Do you have `<%@ taglib prefix="html" uri="/WEB-INF/struts-tags.tld"%>` in your JSP (as first row) ?
type: Comment
comment on: http://stackoverflow.com/a/26139191
score: 0

http://stackoverflow.com/a/57748510
answers question: http://stackoverflow.com/q/26084469
score: 0
has body: Executor Modern Java includes the excellent Executor framework to easily schedule work to be done on background threads. See Tutorial. In particular, you want the ScheduledExecutorService. ScheduledExecutorService scheduler = Executors.newScheduledThreadPool( 1 ) ; Ask that scheduler to run a Runnable task after a certain amount of time has passed. scheduler.schedule( runnable , delay , timeUnit ) ; java.time So next you need to determine the amount of time that needs to pass. Define your target, the day-of-month. The ThreeTen-Extra library has a class for that, DayOfMonth. DayOfMonth domTarget = DayOfMonth.of( 15 ) ; Get current moment as seen in the time zone by which you want to view the calendar. Keep in mind that for any given moment, the date varies around the globe by time zone. The date may be “tomorrow” in Tokyo while “yesterday” in Montréal. ZoneId z = ZoneId.of( "Africa/Tunis" ) ; ZonedDateTime now = ZonedDateTime.now( z ) ; Get the day-of-month of today. DayOfMonth domToday = DayOfMonth.from( now ) ; Extract the current date, just the date, without time-of-day and without time zone. LocalDate today = now.toLocalDate() ; Compare the day-of-month between today and the target. If today is past the target, move to the next month. LocalDate target = domTarget.atYearMonth( YearMonth.of( today ) ) ; // Get the date for our target day-of-month in the current month (current year-month). if( ! target.IsAfter( today ) ) { target = target.plusMonths( 1 ) ; // If target is not after today, move to the next month. } Get the first moment of the day on the target date. Do not assume the day starts at 00:00. On some dates in some zones, the day may start at another time, such as 01:00. ZonedDateTime start = target.atStartOfDay( z ) ; // Determine the first moment of the day on that date in that zone. Now we can determine the elapsed time between now and the starting time when we want to run our task. Represent this span-of-time unattached to the timeline as a Duration. T…
type: Answer

http://stackoverflow.com/comment/40975689
comment on: http://stackoverflow.com/a/26141369
score: 0
type: AnswerComment
type: Comment
has text: SQL (the query language) does not use `1` or `0` for booleans. It uses `true` and `false`.

http://stackoverflow.com/q/26081995
possible better answer: http://stackoverflow.com/a/26082392
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26082392
tagged with: text-based
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40868132
upvote count: 1
has comment: http://stackoverflow.com/comment/40868155
downvote count: 1
accepted answer: http://stackoverflow.com/a/26082117
has title: More while issues for my text based game
has comment: http://stackoverflow.com/comment/40868140
has comment: http://stackoverflow.com/comment/40868181
has comment: http://stackoverflow.com/comment/40868123
tagged with: boolean
type: AnsweredQuestion
has body: while(!A){ System.out.println ("You enter a room and look around, in it, you see three doors, a red door labeled A, a blue door labeled B, and a green door labeled C. Which door do you choose to go through? Enter, A, B, or C"); String correctdoor = scanner.next(); A = "A".equalsIgnoreCase(correctdoor); System.out.println("You have chosen wrong! You have fallen into a pit! Lucky for you though, the pit is easy to climb out of and you return to the room....\n\n\n"); } System.out.println("You progress through the door and find 5 light switches, you must turn them on in order to progress further. Enter the correct combination (using digits 1-5) here please. HINT - the 2nd and 4th numbers add up to the first number and the last number is NOT 5"); int lightcode = scanner.nextInt(); while (!(lightcode == 31425)){System.out.println ("That combination is incorrect");} System.out.println ("The door unlocks and you go down a set of stairs"); Hey, back again for more help. The while statement does work as intended when the user inputs b or c or any other value not A, but when they DO put A it does take them out of the while loop, but it still prints the 'you have chosen wrong' string. I'm not sure why, but I AM sure you guys can tell me why. Furthermore, the second loop works perfectly if I input the right number, the only issue is that when I do NOT, it DOES tell me 'the combo is incorrect' but it doesnt just print it once, it keeps printing it and wont stop, its neverending. What did I do wrong? Maybe I should use an if statement? Eh...no...that wont loop...ugh. ps I know I said the last number isnt 5, but ill fix it in post
has comment: http://stackoverflow.com/comment/40868149
has comment: http://stackoverflow.com/comment/40868110
has comment: http://stackoverflow.com/comment/40868099
favorite count: 0
has answer: http://stackoverflow.com/a/26082117

http://stackoverflow.com/comment/40909621
has text: It works!! thanks! Can I ask (just in case you might know) How can I get the value isnude the div element? for example how to get the value1 inside value1 ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26061198
type: Comment

http://stackoverflow.com/comment/41072017
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26192322
has text: I see. So basically, your question is not specific to logging, but you would want to be able to concurrently write to the same file without blocking. If you use Java 7, the `java.nio` package provides you with the right tools as far as I know.
type: Comment

fractions
type: Tag
tags question: http://stackoverflow.com/q/26068982
tag name: fractions

http://stackoverflow.com/q/26109304
score: 1
tagged with: java
type: Question
upvote count: 1
has title: How should I construct the structure of multiple classes and methods in one file?
linked to: http://stackoverflow.com/q/13132729
has answer: http://stackoverflow.com/a/26109372
accepted answer: http://stackoverflow.com/a/26109372
answer count: 3
has comment: http://stackoverflow.com/comment/40917985
linked to: http://stackoverflow.com/q/2336692
favorite count: 0
has answer: http://stackoverflow.com/a/26109348
has comment: http://stackoverflow.com/comment/40917808
possible better answer: http://stackoverflow.com/a/26109375
has answer: http://stackoverflow.com/a/26109375
has body: So for this assignment I have to use 3 classes in one file, and each of these classes has about 2 methods. I'm not quite sure how I should construct this. I was simply thinking about this (this is just a "sketch"): public class{ main{} } method 1 {} method 2 {} class 2{} method 3{} method 4{} class 3{} method 5{} method 6{} Is this the correct structure? Or should I put the 3 classes together first and then all the methods on together on the bottom?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40864182
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26079952
has text: Character.isWhiteSpace(Char) tests if a character is white space.
type: QuestionComment

http://stackoverflow.com/q/26119169
type: Question
has comment: http://stackoverflow.com/comment/40936478
has body: Using Maven I'm trying to add a new dependency to my project: org.jboss.seam seam-bom 3.1.0.Final pom Browsing Nexus repository index corresponding to the JBoss repository, I can see the artifact: https://repository.jboss.org/nexus/content/groups/public/ But if I browse the repository storage in Nexus, the artifact is no present, and I when I try to build the project, I get an error: Failure to find org.jboss.seam:seam-bom:pom:3.1.0.Final in http://eplus.cci.gc.es/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
tagged with: jboss
has answer: http://stackoverflow.com/a/26119893
answer count: 2
has answer: http://stackoverflow.com/a/26121130
has comment: http://stackoverflow.com/comment/40935166
downvote count: 0
has title: Why Nexus is not downloading an artifact which is listed in the index?
has comment: http://stackoverflow.com/comment/40934825
favorite count: 0
tagged with: nexus
type: UnansweredQuestion
tagged with: maven
tagged with: sonatype
score: 2
upvote count: 2
tagged with: java

http://stackoverflow.com/q/26120628
has title: Gallery Intent to Camera
linked to: http://stackoverflow.com/q/23426113
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40937522
has comment: http://stackoverflow.com/comment/40967384
tagged with: android
has answer: http://stackoverflow.com/a/26125353
answer count: 1
has body: I have an app that on ImageButton click it opens the Gallery intent from where you can either choose some pictures OR take another one using the Camera intent. My question is: I have made a camera layout that I would like to use instead of the one from the gallery intent. How could I use my custom layout instead of the basic one? Thanks
has comment: http://stackoverflow.com/comment/40937332
has comment: http://stackoverflow.com/comment/40937676
has comment: http://stackoverflow.com/comment/40938263
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40937838
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40949064
tagged with: java
has comment: http://stackoverflow.com/comment/40938346
type: Question
tagged with: android-camera

http://stackoverflow.com/comment/40950600
score: 0
type: AnswerComment
has text: the code which connect with mysql database is showing this "java.lang.Thread.State: WAITING (on object monitor) ............" How can I return/release connection object. I am closing it right now. Any idea where I might be wrong?
comment on: http://stackoverflow.com/a/26124427
type: Comment

http://stackoverflow.com/comment/45986301
type: Comment
has text: I have experience in a productive development in glassfish. It is not currently used. there is not much documentation online.
comment on: http://stackoverflow.com/a/28771235
score: 1
type: AnswerComment

http://stackoverflow.com/a/26040615
score: 3
answers question: http://stackoverflow.com/q/26040577
has body: With regex try "my extra spaced string".replaceAll("\\s+?"," "); thats preatty it.
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/114450985

http://stackoverflow.com/a/26130097
has comment: http://stackoverflow.com/comment/41569408
upvote count: 2
has comment: http://stackoverflow.com/comment/40957264
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26128977
has body: Yes, punctuation will be removed (speaking very generally, it's more complex that just that). The string you've provided effectively has zero tokens after going through the tokenizer. StandardTokenizer implements UAX #29, so you can read that over for a complete description. It does this to separate the input into tokens representing, roughly, words. Since you want punctuation to remain a part of your tokens in one way or another, I'm guessing that indexing words isn't really what you want to do, so StandardTokenizer is probably just not a good choice.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26128977
has comment: http://stackoverflow.com/comment/40958000
has comment: http://stackoverflow.com/comment/40967559

http://stackoverflow.com/q/26035114
has comment: http://stackoverflow.com/comment/40787048
has answer: http://stackoverflow.com/a/26035345
tagged with: spring
answer count: 4
score: 7
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 7
has comment: http://stackoverflow.com/comment/40783554
has comment: http://stackoverflow.com/comment/40783933
type: Question
has title: How to insert data into the database using spring + hibernate?
has answer: http://stackoverflow.com/a/26035250
downvote count: 0
has body: see i m havving user.java for the user info. @Entity(name = "user") @Table(name = "user") public class User { @Id @Column(name = "id") private String id; @Column(name = "password") private String password; //getter and setter for this.. } this is my userdao public class UserDao { public interface UserDAO { public String insert(User user); } } and this is the impl class for inserting into database see this was my code.please check it and tell me what i m doing wrong @Repository @Transactional public class UserImpl implements UserDAO { private DataSource dataSource; @Autowired SessionFactory sessionFactory; @Resource(name = "sessionFactory") public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } @Override public String insert(User use) { Session session = this.sessionFactory.openSession(); try{ Session sess = this.sessionFactory.getCurrentSession(); session.save(reg); return (String)user.getUserName(); }catch(Exception e){ System.out.println("in catch"+e.getMessage()); e.printStackTrace(); } } } } and in my controller after successful registration i m inserting data to the database by this userDao.insert(user); but i m not getting output means not any data is inserting into the database.why this..? this is my mvc configuration &lt;context:component-scan base-package="com.user.xyz" /&gt; &lt;mvc:annotation-driven /&gt; &lt;mvc:resources mapping="/resources/**" location="/resources/images/, /resources/css/" /&gt; &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/WEB-INF/view/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt;
has answer: http://stackoverflow.com/a/26035480
favorite count: 0
has comment: http://stackoverflow.com/comment/84206137
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26036089

http://stackoverflow.com/q/26170107
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41029709
tagged with: enums
has comment: http://stackoverflow.com/comment/41030062
accepted answer: http://stackoverflow.com/a/26170293
has title: Retrieve enum value using unique property
answer count: 2
has comment: http://stackoverflow.com/comment/41029644
downvote count: 0
has body: Is it possible to create a generic method or class to retrieve an enum value from a given unique property (field with getter method)? So you would have: public enum EnumToMap { E1("key1"), E2("key2"), ; private final String key; private EnumToMap(String key) { this.key = key; } public String getKey() { return key; } } so required is the same functionality as public static EnumToMap getByKey(String key) ... would provide. Preferably without reflection and as generic as possible (but in this case it may not be possible to create a generic solution without reflection). Clarification: So this method should work for multiple enumerations. The idea is not to have to implement the lookup over and over again.
favorite count: 0
has answer: http://stackoverflow.com/a/26170545
has comment: http://stackoverflow.com/comment/41030139
has comment: http://stackoverflow.com/comment/41029678
has answer: http://stackoverflow.com/a/26170293
tagged with: dictionary
possible better answer: http://stackoverflow.com/a/26170545
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41029631

http://stackoverflow.com/a/26101762
answers question: http://stackoverflow.com/q/26101540
has comment: http://stackoverflow.com/comment/40903794
type: Answer
upvote count: 11
has body: You probably want to use a comparator that orders case insensitively then uses case sensitive ordering as a tiebreaker. So something like: Set&lt;String&gt; set = new TreeSet&lt;&gt;((a, b) -&gt; { int insensitive = String.CASE_INSENSITIVE_ORDER.compare(a, b); return insensitive==0 ? a.compareTo(b) : insensitive; });
score: 11
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26101540
downvote count: 0

http://stackoverflow.com/comment/41052080
has text: Do you mean "each character" or "each string"? Each character would be 'h', 'g', 'f'
comment on: http://stackoverflow.com/q/26182222
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26168025
type: Answer
has body: It looks like you may need to move up the "tree" to get to a different folder. For example, if you are current in page x.jsp in folder "foo" and need to get to page y.jsp in folder "bar", you would need to do this - jsp: forward page='../bar/y.jsp'. The "../" tells jsp to back out of the current folder(foo) it is in and look for the next folder(bar). You would need to add one "../" for each level you go up. Hope this helps.
answers question: http://stackoverflow.com/q/26167609
has comment: http://stackoverflow.com/comment/41025732
score: 0

http://stackoverflow.com/q/26148682
has answer: http://stackoverflow.com/a/26163168
tagged with: spring
has body: hi i am working in a spring mvc project using thymeleaf and i have a method that executes a very complex query that takes 7 seconds to return 1500 rows, i have to populate a table with that data using thymeleaf, but its taking too much time populating the table, it takes 1 min to populate the table and show the web page, so it takes 1 min loading the page, is there a way to populate a table when you have a lot of data without taking too much time?? i used to think that it was taking too much time loading was because my method returns a list Objects and i need to cast that list of objects to my proper POJO object so i have to loop the list and cast each object, but its not that because i try the following tests 1) i try printing the list objects in a simple TextArea without the casting method and it printed me all the Objects, it took 9 secs to show the web page but you need to take out the 7 seconds that took the query to bring the data it printed like 1000 objects like this in my textArea: [Ljava.lang.Object;@e9548,[Ljava.lang.Object;@e9548..... 2) i try printing the list in a simple TextArea with my method that cast each object to my POJO objects and it took 10 secs almost the same time that it took when i printed the raw object list without my cast method it printed like 1000 objects like this in my textArea: com.abc.serviceClass.Person@252c46, com.abc.serviceClass.Person@252c46, com.abc.serviceClass.Person@252c46, com.abc.serviceClass.Person@252c46..... 3) this is why i think that the method that use thymeleaf to populate the table have the fault of the web page taking almost 1 min to load, Becasue when i populate my table using this code that th:each that have to iteare the 1500 registers that are in my listOfPojos and print the value i believe is why is taking too much time it takes more than 1 min to show my web page when i put that code, thats why i wanted to ask if its another way to populate my table using that list of 1500 pojos objects without taking tha…
tagged with: java
tagged with: populate
type: Question
tagged with: thymeleaf
has comment: http://stackoverflow.com/comment/41013707
answer count: 1
score: 0
has title: populate a table with thymeleaf with very large registers or data
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41002785
type: UnansweredQuestion

http://stackoverflow.com/comment/40929090
has text: I think you have not the well Freemarker version. I suggest you to see our odt+freemarker sample which is a maven project https://code.google.com/p/xdocreport/source/browse?repo=samples#git%2Fsamples%2Ffr.opensagres.xdocreport.samples.odtandfreemarker
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26047366

http://stackoverflow.com/q/26084653
has title: DriverManager.getConnection not working when program runs from another directory
has comment: http://stackoverflow.com/comment/40872658
score: 0
tagged with: sqlite
answer count: 1
has body: i have a dictionary app that uses sqlite database. when i run the app in the terminal from the path that jar file exist with this command java -jar RememberDict.jar it works, but when i run it from somewhere other than where the application exists, it gives me errors that i believe it comes from this code: try { conn = DriverManager.getConnection("jdbc:sqlite:" + System.getProperty("user.dir") + File.separator +"raw" + File.separator + "dict.db"); } catch (SQLException ex) { System.out.println("connot connect to words.db"); throw new Exception("Cannot connect to words.db"); } so to be specific when i run for example this command java -jar ~/NetBeansProjects/RememberDict/dist/RememberDict.jar it gives error like this: connot connect to words.db Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at database.Database.getFavWords(Database.java:122) at rememberdict.FavoritesPanel.&lt;init&gt;(FavoritesPanel.java:36) at rememberdict.GUIController.&lt;init&gt;(GUIController.java:62) at rememberdict.RememberDict$1.run(RememberDict.java:11) 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) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDisp…
tagged with: linux
has comment: http://stackoverflow.com/comment/40876665
has comment: http://stackoverflow.com/comment/40872747
has answer: http://stackoverflow.com/a/26087365
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40873635
has comment: http://stackoverflow.com/comment/40877779
type: Question
accepted answer: http://stackoverflow.com/a/26087365
has comment: http://stackoverflow.com/comment/40874698

http://stackoverflow.com/comment/41061464
comment on: http://stackoverflow.com/a/26187151
type: Comment
score: 0
type: AnswerComment
has text: This will go wrong if there are commas in any of the strings.

http://stackoverflow.com/q/26064999
linked to: http://stackoverflow.com/q/25995635
linked to: http://stackoverflow.com/q/18875356
has comment: http://stackoverflow.com/comment/40874675
tagged with: spring
accepted answer: http://stackoverflow.com/a/74804193
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
has comment: http://stackoverflow.com/comment/40840409
type: Question
answer count: 2
score: 8
has answer: http://stackoverflow.com/a/37067552
downvote count: 0
tagged with: tomcat
has body: I've been using spring boot for some projects lately and I really like it. For a new project, we'd like to use tomcat-users.xml for really basic authentication, but I can't figure out how to use the mechanism without a web.xml file. Most people using spring boot seem to be using spring security. Is it possible to use tomcat container security with the spring boot java config model? I understand this breaks the runnable jar paradigm but we're planning to deploy this as a war anyway.
possible better answer: http://stackoverflow.com/a/37067552
upvote count: 8
has answer: http://stackoverflow.com/a/74804193
favorite count: 0
has title: Spring Boot with container security

http://stackoverflow.com/comment/40962121
type: QuestionComment
score: 1
has text: RTFM: http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html
comment on: http://stackoverflow.com/q/26133818
type: Comment

http://stackoverflow.com/comment/41045159
type: AnswerComment
score: 0
has text: @user3639557 If yout matrix is always triangular then your solution is right and optimal concerning memory usage. I recommend you to implement its wrapping class with its accesors methods providing a direct access to its elements based on a (i row,j column) index.
type: Comment
comment on: http://stackoverflow.com/a/26177549

http://stackoverflow.com/a/26106745
has comment: http://stackoverflow.com/comment/40914698
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26106237
accepted answer of: http://stackoverflow.com/q/26106237
score: 6
upvote count: 7
downvote count: 1
has body: You can nest transactions with the Android sqlite API, with caveats: Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed. Another approach I've seen used with sqlite in general is to pass in a boolean parameter isInTransaction that tells the called method whether it should handle transactions on its own, or to let the caller handle transactions.

http://stackoverflow.com/q/26094987
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/26095710
has body: I new for spring mvc and jdo and I try to learn I got error of HTTP ERROR 503 Problem accessing /add. Reason: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 28; The prefix "mvc" for element "mvc:annotation-driven" is not bound. my program of spring mvc is placed here: person.java: package com.web.project; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.datastore.Key; @PersistenceCapable public class Person { // ID or key unique variable @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; // String or integer or other variable related to person @Persistent private String name ; @Persistent private String email; @Persistent private Date date; //getter and setter methods public void setKey(Key key) { this.key = key; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } public void setDate(Date date) { this.date = date; } public Key getKey() { return key; } public String getName() { return name; } public String getEmail() { return email; } public Date getDate() { return date; } @Override public String toString() { return "Person [key=" + key + ", name=" + name + ", email=" + email + ", date=" + date + "]"; } } personalcontroller.java: package com.web.project; import java.util.Date; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.servlet.http.HttpServletRequest; import com.web.project.Person; import org.springframework.ui.ModelMap; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable…
has answer: http://stackoverflow.com/a/26095755
tagged with: jsp
has answer: http://stackoverflow.com/a/52827882
has answer: http://stackoverflow.com/a/27766640
has comment: http://stackoverflow.com/comment/40891933
answer count: 4
favorite count: 0
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: jdo
tagged with: spring-mvc
has title: SEVERE: Context initialization failed and org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

http://stackoverflow.com/comment/40867622
score: 0
type: Comment
type: QuestionComment
has text: Do you want to block outgoing and incoming messages programmatically?
comment on: http://stackoverflow.com/q/26081632

http://stackoverflow.com/comment/84206137
has text: Not an answer, but for anything that handles anything of scale, hibernate is more trouble than its worth. I am not the first person to decide to rip anything hibernate out of an app after it was complete, because it simply doesnt perform at scale.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26035114

http://stackoverflow.com/a/26110928
type: Answer
answers question: http://stackoverflow.com/q/26110574
accepted answer of: http://stackoverflow.com/q/26110574
has body: You have to define a static variable where the other class can access the reference to the queue, or you have to pass a reference to the queue into the other class that needs to access it. Yes, you have to be careful about multi-threading anytime you access an object from two different threads, although the details of what you need to do will depend upon the specific queue class you are using.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26034456
downvote count: 1
has title: NullPointerException on insert operation
has comment: http://stackoverflow.com/comment/40786624
type: Question
upvote count: 0
answer count: 1
score: -1
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40786998
favorite count: 0
has comment: http://stackoverflow.com/comment/40788498
type: UnansweredQuestion
tagged with: swing
has body: I'm trying to insert into my database through the actionPerformed method for my button. But i keep getting "java.lang.NullPointerException" The button press is supposed to insert from the textboxes and send it to the database, but i currently get a java null pointer exception in the actionperformed method. Can you help me? (You can copy paste the code and run it directly if it would help) (There is a connection to the Database, so it's not that) import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JToolBar; import javax.swing.JDesktopPane; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JRadioButton; import java.awt.Font; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.sql.*; import javax.swing.JPasswordField; import javax.swing.JList; import javax.swing.JComboBox; public class MyGuiApplication { //database globals private Connection con; private Statement st; private ResultSet rs; //gui globals private JFrame frame; private JTextField EmailTextField; private JTextField FirstNameTextField; private JTextField LastNameTextField; private JTextField MobileNumberTextField; private JLabel lblPassword; private JLabel lblConfirmPassword; private JRadioButton MrsMsBTN; private JRadioButton MrBTN; private JLabel lblTitle; private JLabel lblFirstName; private JLabel lblLastName; private JLabel lblMobileNumber; private JLabel lblNewCustomer; private JLabel lblDeliveryInformation; private JLabel lblInCaseWe; private JLabel lblMandatoryField; private JPasswordField ConfirmPasswordField; private JPasswordField PasswordField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MyGuiApplication window = new MyGuiApplication(); window.frame.s…
has answer: http://stackoverflow.com/a/26046485
tagged with: java

http://stackoverflow.com/comment/40982626
score: 0
has text: Is the Content an Entity class?
type: Comment
comment on: http://stackoverflow.com/a/26123065
type: AnswerComment

http://stackoverflow.com/comment/40942363
type: Comment
has text: @Benjamin Your solution is still better because it limits the scope of `n` to the `for` loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26123019

http://stackoverflow.com/a/26103109
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40907144
accepted answer of: http://stackoverflow.com/q/26102783
answers question: http://stackoverflow.com/q/26102783
has body: One possible approach is to use a regular expression, for example "\d+" would check for only digits. String regex = "\\d+"; System.out.println("123".matches(regex)); // &lt;-- true, 123 is all digits. However, that doesn't address your special characters. So, a cleaner solution might be to use Character.isLetter(char) and something like, public static boolean isLetters(String in) { if (in != null) { for (char ch : in.toCharArray()) { if (!Character.isLetter(ch)) { return false; } } } return true; } Then your isDigits() test could look something like, public static boolean isDigitsOrSpecial(String in) { if (in != null) { for (char ch : in.toCharArray()) { if (Character.isLetter(ch)) { return false; } } } return true; }
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26163144
score: 9
has comment: http://stackoverflow.com/comment/51822336
has comment: http://stackoverflow.com/comment/67041395
has comment: http://stackoverflow.com/comment/43082661
has comment: http://stackoverflow.com/comment/68269919
upvote count: 9
answers question: http://stackoverflow.com/q/26067685
type: Answer
has comment: http://stackoverflow.com/comment/53626241
downvote count: 0
has body: I was not invoking the JoinGroup() method from the SignalR Hub shown in the Question. It makes sense that you need to join the Hub to be able to receive a broadcast. So in my Background Service onStart(), I call invoke("JoinGroup", "Group1"). Then I call the on() method to set up the handler of the message that gets received. Group1 is a configurable group name that the hub uses to split out broadcasts so different groups can use the same Hub. See the full code and commented solution block below. Hope this save someone some time! Here is what helped me followed by the full Android Background Service code: //Invoke JoinGroup to start receiving broadcast messages proxy.invoke("JoinGroup", "Group1"); //Then call on() to handle the messages when they are received. proxy.on( "broadcastMessage", new SubscriptionHandler1&lt;String&gt;() { @Override public void run(String msg) { Log.d("result := ", msg); } }, String.class); Here is the full Android Background Service code: import java.util.concurrent.ExecutionException; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; import microsoft.aspnet.signalr.client.*; import microsoft.aspnet.signalr.client.hubs.*; public class NotifyService extends Service { @Override public void onCreate() { super.onCreate(); } @SuppressWarnings("deprecation") @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); Toast.makeText(this, "Service Start", Toast.LENGTH_LONG).show(); String server = "http://Servername/Applications/ThroughputMobile/"; HubConnection connection = new HubConnection(server); HubProxy proxy = connection.createHubProxy("ptThroughputHub"); SignalRFuture&lt;Void&gt; awaitConnection = connection.start(); try { awaitConnection.get(); } catch (InterruptedException e) { // TODO Auto-generated cat…

http://stackoverflow.com/comment/40850864
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26047366
score: 0
has text: yes i added this and removed earlier exception now getting new exception edited above also:: fr.opensagres.xdocreport.core.XDocReportException: java.lang.NoSuchMethodError: freemarker.template.Configuration.setTagSyntax(I)V java.io.FileNotFoundException: Template fr.opensagres.xdocreport.document.odt.ODTReport@fbe57c!content.xml not found.

http://stackoverflow.com/q/26090194
has answer: http://stackoverflow.com/a/26090207
has body: In the code I am designing, I have a JButton instantiated in the main JFrame of my application that is using an ActionListener referencing an actionPerformed method in another class/component. I'm wondering if there is a way to remove that button upon running said actionPerformed method (clicking on it). In other words, is it possible for the actionPerformed method to reference back to the button that is activating it?
score: 0
type: UnansweredQuestion
tagged with: swing
has title: How do I remove a button in one class/component using the actionPerformed method of another class?
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/a/45883110
has comment: http://stackoverflow.com/comment/97295519
has comment: http://stackoverflow.com/comment/97295494
upvote count: 1
has body: I have another solution : private static byte calculateChecksum8(byte[] bytes){ byte result = 0; for(int i = 0; i &lt; bytes.length; i++){ result += bytes[i]; } result = (byte) (~ result &amp; 0xFF); result = (byte) (result +1 &amp; 0xFF); String str = String.format("%02x", result); System.out.println(result+" = "+str.toUpperCase()); return result; } Someone to confirm ?
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26191250
type: Answer

http://stackoverflow.com/comment/40817503
type: Comment
type: QuestionComment
has text: Integer.parseInt(String) instead of valueOf.
comment on: http://stackoverflow.com/q/26054580
score: 0

http://stackoverflow.com/comment/44937996
comment on: http://stackoverflow.com/a/26173418
type: AnswerComment
has text: Nice :) Care to include the solution (or maybe the strategy) as an answer here?
score: 0
type: Comment

http://stackoverflow.com/comment/40963271
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26133961
has text: my table name is 'users' and databasename is 'ticketing'

http://stackoverflow.com/q/26135429
type: UnansweredQuestion
has body: I am using smack 3.2.2 in a web app to send message from one Gmail id to another. My app works fine in my localhost(localhost:8080/app), but when I put it in remote server (www.example.com:8080/App) it shows me connection.getUser() is null and login fail because of username and password is incorrect. But if username and password was incorrect, how can it works in my localhost? It also throws org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized exception. Same code works in localhost but not in remote server. connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com"); connection = new XMPPConnection(connConfig); connection.connect(); connConfig.setSASLAuthenticationEnabled(false); SASLAuthentication.supportSASLMechanism("PLAIN", 0); connection.login(username, password); and also got Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.ServiceDiscoveryManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.XHTMLManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.muc.MultiUserChat Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.filetransfer.FileTransferManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.LastActivityManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.commands.AdHocCommandManager Error! A startup class specified in smack-config.xml could not be loaded: org.jivesoftware.smackx.ServiceDiscoveryManager Error! A startup class speci…
score: 2
has comment: http://stackoverflow.com/comment/40965611
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40967228
has comment: http://stackoverflow.com/comment/40965369
downvote count: 0
tagged with: xmpp
has title: Unable to login in gtalk using smack in java in remote server
favorite count: 0
tagged with: smack
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/40855910
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26075514
has text: Thanks so much for your answer. Maybe I should have paid more attention to the description of `Pattern.matches`. `Matcher.find` is exactly what I wanted.
type: Comment

http://stackoverflow.com/a/26100700
upvote count: 1
has comment: http://stackoverflow.com/comment/40904605
has body: There already is a method on HttpRequest for getting parameters as a map, is this something you could use? You could iterate through the parameter map, and fill your custom class for each entry YourDataClass data = new YourDataClass(); Map&lt;String, String[]&gt; map = request.getParameterMap(); for (Map.Entry&lt;String, String[]&gt; entry : map.entrySet()) { // do whatever you need data.addParam(entry.getKey(), entry.getValue()); }
has comment: http://stackoverflow.com/comment/40929403
has comment: http://stackoverflow.com/comment/40928244
type: Answer
has comment: http://stackoverflow.com/comment/40929630
downvote count: 0
has comment: http://stackoverflow.com/comment/40902166
has comment: http://stackoverflow.com/comment/40927156
has comment: http://stackoverflow.com/comment/40903006
score: 1
has comment: http://stackoverflow.com/comment/40905663
answers question: http://stackoverflow.com/q/26100587

http://stackoverflow.com/comment/40915051
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26107475
has text: Thanks for your response. Are you saying that the JVM doesn't know how long the tenured collection will take, so it starts it unnecessarily early the first time? I understand not waiting until it's actually full, but in my case it's barely half full. And if that's the case, will setting those two flags force the JVM to wait until old gen is 90% full before doing the first tenured collection?
type: AnswerComment

http://stackoverflow.com/comment/113129494
type: QuestionComment
has text: I found it. See my answer.
type: Comment
comment on: http://stackoverflow.com/q/26097166
score: 0

http://stackoverflow.com/comment/40894483
type: AnswerComment
comment on: http://stackoverflow.com/a/26096228
type: Comment
has text: im working in building android application. So, now i want to know how i can fix this problem.
score: 0

http://stackoverflow.com/q/26168319
type: Question
accepted answer: http://stackoverflow.com/a/26169102
downvote count: 0
has body: I have three android projects under current development - let's call them Alpha, Bravo, and Charlie. Bravo and Charlie both depend on Alpha, an android library. When I create Alpha, I deploy it to my local maven repository using ./gradlew install, which works fine if I use the following in my build.gradle files for Bravo and Charlie: dependencies { compile 'com.blah.alpha:alpha:1.1.0+@aar' } The catch, though, is that all three projects are under development. Thus, when I make an update to Alpha and deploy it to my local Maven repository, Bravo and Charlie don't seem to see the local version unless I do the following: $ cd ~/.m2/repository/com/blah/alpha/ $ rm -rf 1.1.0 $ cd - $ ./gradlew install That is, I manually need to go through and clean my local Maven repository before deploying to it. The version number isn't changing, so I'm wondering if that's the reason it's not getting the most recent build of the library.
tagged with: android
answer count: 1
score: 1
has title: How can I make gradle overwrite the library in my local maven repo?
tagged with: repository
favorite count: 0
has answer: http://stackoverflow.com/a/26169102
upvote count: 1
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: gradle

http://stackoverflow.com/q/26142984
score: 0
has answer: http://stackoverflow.com/a/26143019
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26143100
type: Question
has answer: http://stackoverflow.com/a/26143915
has answer: http://stackoverflow.com/a/26143154
tagged with: http://stackoverflow.com/tag/xml
has title: Android: How to direct to another page?
tagged with: android
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26143019
has answer: http://stackoverflow.com/a/26143100
has body: Hey awesome coding geniuses! I'm a student doing my final year project and i need some help. I hope you coding geniuses can help! I want to direct my Login.java page to my Camera.java once i click the login button. My xml page is Login.xml and Camera.xml respectively. So this is my Login.java public class Login extends Activity { private EditText username=null; private EditText password=null; private TextView attempts; private Button login; int counter = 3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); username = (EditText)findViewById(R.id.editText1); password = (EditText)findViewById(R.id.editText2); attempts = (TextView)findViewById(R.id.textView5); attempts.setText(Integer.toString(counter)); login = (Button)findViewById(R.id.button1); } public void login(View view){ if(username.getText().toString().equals("amirul") &amp;&amp; password.getText().toString().equals("aswa")){ Toast.makeText(getApplicationContext(), "Redirecting...", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getApplicationContext(), "Wrong Credentials, Please try again.", Toast.LENGTH_SHORT).show(); attempts.setBackgroundColor(Color.RED); counter--; attempts.setText(Integer.toString(counter)); if(counter==0){ login.setEnabled(false); } } } @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; } } And this is my Camera.java public class Camera extends Activity { ImageView iv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera); iv = (ImageView) findViewById(R.id.imageView); Button btn = (Button) findViewById(R.id.takephoto); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivi…

http://stackoverflow.com/comment/40875062
score: 0
type: QuestionComment
type: Comment
has text: Check if `request.getParameter("username");` or `request.getParameter("password");` do not return null
comment on: http://stackoverflow.com/q/26085892

http://stackoverflow.com/q/26185863
upvote count: 2
tagged with: java
tagged with: sqlyog
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/26185895
has title: deleting rows in sqlyog having null values
tagged with: sql
answer count: 1
has body: I have a table which dosen't have any key(foreign key and...). Some of table fields have null value. when I use the command: DELETE FROM `woe300websnt` WHERE (Arg1=NULL AND Rel=NULL AND Arg2=NULL); the query is run successfully but when I use select * from woe300websnt I see that no change is applied and these rows are remained. what is wrong with me?
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26185895
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/41003011
has text: Do you have a `main` method?
type: QuestionComment
comment on: http://stackoverflow.com/q/26155907
type: Comment
score: 0

http://stackoverflow.com/comment/40980163
type: QuestionComment
has text: Ok I did this in my batch, but how can I get the JNDI as ${semantic.activation}?
score: 0
comment on: http://stackoverflow.com/q/26140673
type: Comment

http://stackoverflow.com/q/26039266
score: 0
answer count: 1
has title: commandClass setter methods are not invoked while implementing SimpleFormController in spring 3.x
tagged with: spring-webflow
has answer: http://stackoverflow.com/a/26052389
tagged with: spring
tagged with: spring-mvc
has body: commandClass setter methods are not invoked while implementing SimpleFormController in spring 3.x, Calling getter method on command odject returns null value. uploadMessageBundle.jsp <spring:message code="messagebundle.upload.instruction"/> <spring:bind path="command.locale"> <c:forEach var="locale" items="${locales}" varStatus="status"> ${locale} </c:forEach> </spring:bind> <input type="submit" name="_target1" class="active" value="<spring:message code='messagebundle.upload' />"/> <input type="submit" name="_cancel" value="<spring:message code='messagebundle.cancle'/>"/> <jsp:directive.include file="/templates/footer.jsp"/> UploadMessageBundleController.java package org.sakaiproject.adminmessagebundle.tool; import org.sakaiproject.messagebundle.api.MessageBundleService; import org.sakaiproject.messagebundle.api.MessageBundleProperty; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindException; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.multipart.support.ByteArrayMultipartFileEditor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.InputStream; import java.util.*; public class UploadMessageBundleController extends AbstractUploadController { MessageBundleService messageBundleService; protected Map referenceData(HttpServletRequest request) throws Exception { Map map = new HashMap(); map.put("locales",messageBundleService.getLocales()); return map; } protected void doSubmitAction(Object command) throws Exception { try { setCommandClass(FileUploadBean.class); setCommandName("comman…
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26052389
tagged with: sakai

http://stackoverflow.com/comment/41057432
type: Comment
comment on: http://stackoverflow.com/q/26184281
has text: @Tirath yes that would be good.., but in this case i have to eat what i got served :(
score: 0
type: QuestionComment

http://stackoverflow.com/a/26050911
accepted answer of: http://stackoverflow.com/q/26050888
type: Answer
answers question: http://stackoverflow.com/q/26050888
score: 8
has comment: http://stackoverflow.com/comment/40811052
has body: One example arises if we have two functions and we want them both to be executed: if (foo() | bar()) If we had used ||, then bar() will not be executed if foo() returns true, which may not be what we want. (Although this is somewhat of an obscure case, and more often than not || is the more appropriate choice.) An analogous situation can come up with &amp;/&amp;&amp;: if (foo() &amp; bar()) If we had used &amp;&amp;, then bar() will not be executed if foo() returns false, which again may not be what we want.
type: AcceptedAnswer
downvote count: 0
upvote count: 8

http://stackoverflow.com/q/26140651
tagged with: java
has body: I would like to use FFmpeg library on my android app. I have no C/C++/Make knowledge and all the threads I've been reading about it talk about stuff I completely don't understand. Is there any pre-compiled library which I can add to my project, then add a simple 'import' statement on my java class and then call it? Thanks
type: Question
has title: using FFmpeg for android without any C/C++ or make knowledge
has answer: http://stackoverflow.com/a/26140750
answer count: 3
has answer: http://stackoverflow.com/a/26142566
linked to: http://stackoverflow.com/q/20514058
has answer: http://stackoverflow.com/a/26173945
tagged with: ffmpeg
type: UnansweredQuestion
score: 0
tagged with: android
tagged with: c++

http://stackoverflow.com/comment/41020682
comment on: http://stackoverflow.com/q/26165126
has text: Where do you declare the `JdbcTemplate` bean that you're trying to autowire a reference to? If you're not declaring that bean, then that's why it's not able to autowire it in...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41004742
type: Comment
comment on: http://stackoverflow.com/a/26156819
score: 0
has text: not working success: function(res) { var json = $.parseJSON(res); $(json).each(function(i,val){ $.each(val,function(k,v){ console.log(k+" : "+ v); }); }); func(res); },
type: AnswerComment

http://stackoverflow.com/comment/41058271
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26185434
has text: Didn't think that far @Compass but indeed, so that would mean java also has a need for the Object class as well, as String inherits it.
score: 0

http://stackoverflow.com/comment/40978265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26142469
has text: @ElliottFrisch produces the same `java.lang.String`
score: 0

http://stackoverflow.com/comment/40861410
has text: When I run this code you posted, on which line(s) does it not behave like you want it to?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26076096
score: 0

http://stackoverflow.com/comment/41057549
type: Comment
has text: A boolean is only used if youre setting a value. Use `setNull` is you want to clear the column:)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26184974

http://stackoverflow.com/comment/94873075
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26096136
has text: @zgulser if the source is generating data faster than you can process it the source buffers will overflow.
type: Comment

http://stackoverflow.com/comment/40993585
type: Comment
score: 1
has text: And there is no variable with name height in box. And also in java it is customary that class names starts with upper case, i.e. Box instead of box
comment on: http://stackoverflow.com/q/26150710
type: QuestionComment

http://stackoverflow.com/comment/41039641
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26175579
type: Comment
has text: look at the logs, maybe image is too large - there is a limit in how large a parcel can be. I strongly recommend you pass only URI to your ShowImage activity.

http://stackoverflow.com/comment/40806310
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26047915
has text: @azurefrog Thank you! I added another manual solution as well.
score: 0

http://stackoverflow.com/a/26175323
type: AcceptedAnswer
has body: You can access your shared preferences stuff from anywhere in an uniformed way: PreferenceManager.getDefaultSharedPreferences(context) just passing your current context If you wish to access them from your own class you can use Application Context as an argument. If you create your own application-derived class and register it in your Manifest you will be able to create getSharedPreference function you can use from everywhere class MyApp extends Application { private static MyApp instance; public void onCreate() { this.instance = this; } public static SharedPreferences prefs() { return PreferenceManager.getDefaultSharedPrefercnes(instance); } } But don't forget to include it into manifest in this case
type: Answer
has comment: http://stackoverflow.com/comment/41043516
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26175099
answers question: http://stackoverflow.com/q/26175099
upvote count: 1

http://stackoverflow.com/q/26130382
type: Question
answer count: 2
has title: InfluxDB "Couldn't look up columns" when a WHERE clause on time is used
score: 0
tagged with: grafana
has body: Using the Java client, I'll insert a series like this: Serie serie1 = new Serie.Builder(perfStat.pointCut).columns("time", "value").values(perfStat.start, perfStat.end - perfStat.start).build(); influxDB.write("pointcut_performance", TimeUnit.MICROSECONDS, serie1); Grafana tries to run this query, which fails... It also fails in the influxdb admin tool: select mean(value) from "com.xxx.databunker.salesforce.processing.jms.SalesForceLeadMessageListener.onMessage(Message)" where time &gt; now() - 6h group by time(1s) order asc You get this error: ERROR: Couldn't look up columns. If you take out the "where" clause, it runs: select value from "com.springventuregroup.databunker.salesforce.processing.jms.SalesForceLeadMessageListener.onMessage(Message)" I can't find this in the documentation. Any help much appreciated! EDIT The problem is: there is obviously data in the database that is query-able, as long as your query doesn't have a where close. Why am I getting that error?
possible better answer: http://stackoverflow.com/a/26133273
has answer: http://stackoverflow.com/a/26133273
accepted answer: http://stackoverflow.com/a/26154087
tagged with: influxdb
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26154087
tagged with: java

http://stackoverflow.com/comment/56144233
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26099434
has text: Similar issue: http://stackoverflow.com/questions/16631494/cannot-create-jdbc-driver-of-class-for-connect-url-null-oracle-xe-mvc-sprin

http://stackoverflow.com/comment/40830468
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26061569
has text: I tried to remove priority or put it at 999 or 900 it doesn't work more.
type: Comment

http://stackoverflow.com/q/26124417
has answer: http://stackoverflow.com/a/45618618
has answer: http://stackoverflow.com/a/60437231
type: Question
has answer: http://stackoverflow.com/a/41553263
has answer: http://stackoverflow.com/a/41724888
has title: How to convert a csv file to parquet
has answer: http://stackoverflow.com/a/38408752
downvote count: 0
answer count: 10
has answer: http://stackoverflow.com/a/69983349
score: 61
favorite count: 0
has answer: http://stackoverflow.com/a/71093732
upvote count: 61
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46501246
has body: I'm new to BigData. I need to convert a .csv/.txt file to Parquet format. I searched a lot but couldn't find any direct way to do so. Is there any way to achieve that?
linked to: http://stackoverflow.com/q/48449012
tagged with: parquet
tagged with: java
has answer: http://stackoverflow.com/a/38691441
has answer: http://stackoverflow.com/a/68722725

http://stackoverflow.com/q/26046819
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26047252
tagged with: regex
has answer: http://stackoverflow.com/a/26046986
has answer: http://stackoverflow.com/a/26046853
type: AnsweredQuestion
has body: I have a string (for example: "foo12"), and I want to add a delimiting character in between the letters and numbers (e.g. "foo|12"). However, I can't seem to figure out what the appropriate code is for doing this in Java. Should I use a regex + replace or do I need to use a matcher?
possible better answer: http://stackoverflow.com/a/26046986
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26046853
has title: Add separator in string using regex in Java

http://stackoverflow.com/comment/40966035
comment on: http://stackoverflow.com/q/26136000
type: Comment
type: QuestionComment
has text: possible duplicate of [How to get the last date of a particular month with JodaTime?](http://stackoverflow.com/questions/9711454/how-to-get-the-last-date-of-a-particular-month-with-jodatime)
score: 0

http://stackoverflow.com/comment/40804936
score: 1
has text: It's unlikely there's a web server running on your Android device localhost.
type: AnswerComment
comment on: http://stackoverflow.com/a/26047322
type: Comment

http://stackoverflow.com/a/26125379
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26123772
has comment: http://stackoverflow.com/comment/40948571
upvote count: 2
has comment: http://stackoverflow.com/comment/40948308
has body: The problem would seem to be here; while (result.next()) { System.out.print(result.next()); ... The first call to result.next() in the while loop advances the cursor to the first result. The second one in the print advances it to the second result (which may not exist). If there is only one result from the query, the cursor is invalid after the second call to next(), and getting data from the cursor in the next line will fail.
downvote count: 0
has comment: http://stackoverflow.com/comment/40948410

http://stackoverflow.com/q/26183629
has title: Netbeans IDE not installing as a root user in CentOS
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
score: 1
tagged with: centos7
upvote count: 1
has body: trying to install the netbeans ide on my centos pc using ./netbeans-8.0.1-linux.sh and I keep getting the message saying permission denied even though am logged in as the root...what am I not doing right? Thank you
type: Question
has answer: http://stackoverflow.com/a/26183718
tagged with: java
has answer: http://stackoverflow.com/a/26183724
answer count: 2
downvote count: 0

http://stackoverflow.com/a/26111114
answers question: http://stackoverflow.com/q/26110992
score: 1
has body: I would simplify your loop like so: int change; while ((change = sc.nextInt()) &gt;= 0) { //do code } Note the lowercase change, due to Java naming conventions. The main problem with your code as-is is that you have two loops, and you'll exit the first immediately if your number is not less than 1 (or loop infinitely if it is less). You did the verification once, then did your program logic. Try using a single loop.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26043946
upvote count: 3
has comment: http://stackoverflow.com/comment/40799520
answers question: http://stackoverflow.com/q/26043885
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26043885
score: 3
has body: You would need to use the rhc snapshot command, to do a backup of the existing application, then create a new gear in the ea location and do an rhc snapshot restore to that gear, or the rhc create-app with the --from-app. You can check out these resources for more specific information: https://help.openshift.com/hc/en-us/articles/203265710-How-can-I-move-an-existing-application-from-the-US-aws-us-east-1-hosting-region-to-the-European-aws-eu-west-1-hosting-region- https://developers.openshift.com/en/overview-platform-features.html#_migrating_an_existing_application_to_another_region_or_zone

http://stackoverflow.com/comment/40801984
comment on: http://stackoverflow.com/q/26044177
type: QuestionComment
type: Comment
score: 1
has text: Well, sure, a linked list or array has to be faster than I/O. To get the timing, you're back to trial-and-error or simple averaging.

http://stackoverflow.com/a/26081534
has body: Change to cName.setText(String.valueOf(temp)); setText will take charactersequence. There is one that takes int value which is a resource. If not found you end up getting ResourceNotFoundException. public final void setText (int resid) Takes resid which is a int. What you need public final void setText (CharSequence text) Added in API level 1 Sets the string value of the TextView. TextView does not accept HTML-like formatting, which you can do with text strings in XML resource files. To style your strings, attach android.text.style.* objects to a SpannableString, or see the Available Resource Types documentation for an example of setting formatted text in the XML resource file.
type: Answer
has comment: http://stackoverflow.com/comment/40867304
accepted answer of: http://stackoverflow.com/q/26081528
answers question: http://stackoverflow.com/q/26081528
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40867319
score: 0

http://stackoverflow.com/a/26111247
has body: main problem is taking every input as int without checking int or not because "e" is possible to input. if you want user to input "E" or "e" you should first check is user input value numeric or not.you can use try{catch} but good to use regex.and comparing strings not correct in your code.you can use || to check user input e or E but .tolowercase or equalsIgnoreCase is simple public class NewClass { public static void main(String[] args) { String firstChar = "e"; String secondChar = "E"; boolean prompt = true; while (prompt) { //Prompt the student to input their data System.out.print("Please enter your exam score, or press E to exit :"); @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); String userinput = keyboard.next(); if(isNumeric(userinput)){ int letterGrade=Integer.parseInt(userinput); if ((letterGrade &gt;= 90) &amp; (letterGrade &lt;= 100)) { System.out.println("The letter grade is A"); } else if ((letterGrade &gt;= 80) &amp; (letterGrade &lt;= 89)) { System.out.println("The letter grade is B"); } else if ((letterGrade &gt;= 70) &amp; (letterGrade &lt;= 79)) { System.out.println("The letter grade is C"); } else if ((letterGrade &gt;= 60) &amp; (letterGrade &lt;= 69)) { System.out.println("The letter grade is D"); } else if ((letterGrade &gt;= 0) &amp; (letterGrade &lt;= 59)) { System.out.println("The letter grade is F"); } else { System.out.println("Invalid input, try again."); } }else if(userinput.equalsIgnoreCase(firstChar)){ System.out.println("Thank you for using the grading system"); System.exit(0); } } } public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\.\\d+)?"); } } and if you are not allowed to use method equalsignorecase you can use or operator else if(userinput.equals(firstChar)||userinput.equals(secondChar)){ System.out.println("Thank you for using the grading system"); System.exit(0); } and also if you are not allowed to use regex .replace isNumeric method with following try catch logic public sta…
score: 1
has comment: http://stackoverflow.com/comment/40921354
upvote count: 2
has comment: http://stackoverflow.com/comment/40921704
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40921315
answers question: http://stackoverflow.com/q/26111136

http://stackoverflow.com/q/26076468
answer count: 1
has comment: http://stackoverflow.com/comment/40857632
accepted answer: http://stackoverflow.com/a/26076519
tagged with: java
type: AnsweredQuestion
tagged with: url
tagged with: bufferedreader
has body: I'm a building a basic program to query Target's API with a store ID and Product ID which returns the aisle location. I think I'm using the URL constructor incorrectly, however (I've had trouble with it in the past and still don't fully understand them). Below is the code I have, redacted the API Key for obvious reasons. The URL I create is valid when put into a browser and no exceptions are thrown but at the the end when I print out the contents of the page it is null. What am I missing? Any help is really appreciated! package productVerf; import java.net.*; import java.io.*; public class Verify { public static void main(String args[]) { // first input is store id second input is product id String productID = args[0]; String storeID = args[1]; String file = "/v2/products/storeLocations?productId=" + productID + "&amp;storeId=" + storeID + "&amp;storeId=694&amp;key=REDACTED"; URL locQuery; URLConnection lqConection = null; try { locQuery = new URL("http", "api.target.com", file); lqConection = locQuery.openConnection(); } catch (IOException e) { e.printStackTrace(); } BufferedReader response; String responseString = ""; try { response = new BufferedReader(new InputStreamReader( lqConection.getInputStream())); while (response.readLine() != null) { responseString += response.readLine(); } } catch (IOException e) { e.printStackTrace(); } System.out.println(responseString); } }
has title: URLConnection Reading in as null in java
type: Question
has answer: http://stackoverflow.com/a/26076519
tagged with: nul
score: 0

http://stackoverflow.com/a/26177366
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26177093
has body: You already figured out that you'll need a temporary variable to perform a basic swap in Java. But the naming of the variable (index3 in your case) suggests that you mix things up; the goal is not to temporarily store an index of your array, but the value that is represented by that index - otherwise, it would be overwritten (and thus lost). What you want to do in "step 3" of the swap is to restore the temporary value itself, not the value behind an index. So: void swapElements(int[] array, int index1, int index2){ int tempValue = array[index1]; array[index1] = array[index2]; array[index2] = tempValue; }
downvote count: 0

http://stackoverflow.com/comment/40930478
type: AnswerComment
score: 0
has text: that not what i ment. i have this resoult : title <= 1: bad (4.0) title > 1 | positionMatch <= 1 | | countryCode <= 1-> good | | countryCode > 1-> bad | positionMatch > 1-> good. now i have some item and want to check if it's good or not. title =2 , position =0 , country code = 0 => so it's good. how can i do that checking in java?
type: Comment
comment on: http://stackoverflow.com/a/26111133

http://stackoverflow.com/comment/40895399
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26095184
has text: I've already made some progress by myself, but this answer filled some blanks I had. Thank you!

http://stackoverflow.com/comment/40810221
comment on: http://stackoverflow.com/q/26050369
score: 0
type: Comment
type: QuestionComment
has text: The left-hand side of an assignment must be a variable

http://stackoverflow.com/a/26079189
type: Answer
has body: As JRowan says in his comment, the most likely cause of your problem is that you are trying to do network calls on the main thread, which is not allowed. See this: http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html The easiest way to load an ImageView from a Uri is using Square's Picasso library which can be found here: http://square.github.io/picasso/ One you have it downloaded and installed, then you can load your ImageView like so: Picasso.with(context).load(yourUrl).into(yourImageView); If run in an activity, you can just use this, as the context.
accepted answer of: http://stackoverflow.com/q/26077981
score: 0
answers question: http://stackoverflow.com/q/26077981
type: AcceptedAnswer

http://stackoverflow.com/a/26153259
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: I am prefer to use MIG Layout as it give me more control and freedom to adjust my card layout
score: 1
accepted answer of: http://stackoverflow.com/q/26111339
answers question: http://stackoverflow.com/q/26111339
upvote count: 1

http://stackoverflow.com/comment/40959178
has text: OK, i think i got it. You use the second 8 as a marker from where to start reading 8 words?
type: Comment
comment on: http://stackoverflow.com/q/26132059
score: 1
type: QuestionComment

http://stackoverflow.com/a/26152355
answers question: http://stackoverflow.com/q/26152301
downvote count: 0
has body: Your Salama class needs a listIterator method (if you want to use a list iterator). Based on your usage the signature should look like public ListIterator&lt;Faeton&gt; listIterator() { // Create a list iterator and return here. } It may be worth reading up on the standard ListIterator docs: http://docs.oracle.com/javase/7/docs/api/java/util/ListIterator.html
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41105093
type: AnswerComment
comment on: http://stackoverflow.com/a/26139141
score: 0
type: Comment
has text: Thx, helped me to understand concept

http://stackoverflow.com/comment/41066075
type: AnswerComment
score: 0
has text: wow it works perfectly thank you so much! :) now my program is finally complete thank you once again btw just curious to know when i stored values into the string how does the program know which number is represented by the Words Rock, Paper, Scissor?
type: Comment
comment on: http://stackoverflow.com/a/26189589

http://stackoverflow.com/q/26122060
has answer: http://stackoverflow.com/a/26122284
has comment: http://stackoverflow.com/comment/40941149
tagged with: mockito
has comment: http://stackoverflow.com/comment/130418985
has comment: http://stackoverflow.com/comment/40970522
has body: I'm using a mockito mock. I want to control the invocation of method foo(String a, Date b) to call the original method with foo(a, fixed_date) How can I use mockito API to do so? MyObject myObject = mock(MyObject.class); when(myObject.foo(anyString, any(Date.class)) .thenCallRealMethod(); why this doesn't work? It never redirects the call ImagesSorter imagesSorter = spy(new ImagesSorter()); doReturn(imagesSorter.sortImages(images, user, fakeNowDate)).when(imagesSorter).sortImages(images,user);
linked to: http://stackoverflow.com/q/26138436
has comment: http://stackoverflow.com/comment/40968665
score: 3
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40940344
has comment: http://stackoverflow.com/comment/40949743
upvote count: 3
tagged with: java
has title: how can my mockito mock call the original method with changed params?
has comment: http://stackoverflow.com/comment/40940633
tagged with: unit-testing
type: Question

apache-cocoon
tags question: http://stackoverflow.com/q/26064830
type: Tag
tag name: apache-cocoon

oracle-ucm
tag name: oracle-ucm
type: Tag
tags question: http://stackoverflow.com/q/26127924
tags question: http://stackoverflow.com/q/26108760

http://stackoverflow.com/comment/41038241
comment on: http://stackoverflow.com/q/26174807
has text: your SP signature has only only one parameter of type `IN` and no `OUT` param is declared.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/26085020
answers question: http://stackoverflow.com/q/26084837
has body: if you really want to run them in parrallel you might do something like this: new Thread(run1).start(); new Thread(run2).start(); new Thread(run3).start(); .. with the handler.post you add your jobs to a queue to the hanler - and your handler might be configured to run on the UI thread - so this might not be what you want.
accepted answer of: http://stackoverflow.com/q/26084837
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40873752
type: Answer
has comment: http://stackoverflow.com/comment/40873909

apache
tag name: apache
tags question: http://stackoverflow.com/q/26125045
tags question: http://stackoverflow.com/q/26153772
tags question: http://stackoverflow.com/q/26172653
tags question: http://stackoverflow.com/q/26168292
tags question: http://stackoverflow.com/q/26148560
tags question: http://stackoverflow.com/q/26102247
tags question: http://stackoverflow.com/q/26177889
tags question: http://stackoverflow.com/q/26099019
tags question: http://stackoverflow.com/q/26139999
tags question: http://stackoverflow.com/q/26135003
tags question: http://stackoverflow.com/q/26171574
tags question: http://stackoverflow.com/q/26118439
tags question: http://stackoverflow.com/q/26042901
tags question: http://stackoverflow.com/q/26044255
tags question: http://stackoverflow.com/q/26039927
tags question: http://stackoverflow.com/q/26175034
tags question: http://stackoverflow.com/q/26039777
type: Tag
tags question: http://stackoverflow.com/q/26182388
tags question: http://stackoverflow.com/q/26040152
tags question: http://stackoverflow.com/q/26110333
tags question: http://stackoverflow.com/q/26068627
tags question: http://stackoverflow.com/q/26159931
tags question: http://stackoverflow.com/q/26091259
tags question: http://stackoverflow.com/q/26057777
tags question: http://stackoverflow.com/q/26034543

http://stackoverflow.com/q/26128370
type: Question
has title: Method within a method (homework assignment)
has body: I have a homework assignment where I am asked to: Write a method sort(int[] arr) that takes an integer array and uses a method from a previous exercise to determine if the array is sorted in increasing order or not. If it is already sorted, it should return the array, if it is not, the method should sort the array before returning it. My problem is that I don't know how I should approach this assignment? Should I modify the previous method, call it within a new method or can I create a method within the method? This is the previous method that I wrote: public static void isSorted(int[] checkArray) { boolean isSorted = true; for (int i = 1; i &lt; checkArray.length; i++) { if (checkArray[i - 1] &gt; checkArray[i]) { isSorted = false; Thanx in advance
has answer: http://stackoverflow.com/a/26128539
has answer: http://stackoverflow.com/a/26128451
upvote count: 3
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/40952350
has answer: http://stackoverflow.com/a/26129600
possible better answer: http://stackoverflow.com/a/26128451
accepted answer: http://stackoverflow.com/a/26129600
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40952416
score: 3
downvote count: 0
favorite count: 0

processing
tags question: http://stackoverflow.com/q/26178227
tags question: http://stackoverflow.com/q/26152938
type: Tag
tags question: http://stackoverflow.com/q/26107220
tags question: http://stackoverflow.com/q/26132790
tags question: http://stackoverflow.com/q/26142205
tags question: http://stackoverflow.com/q/26089386
tags question: http://stackoverflow.com/q/26101641
tag name: processing

http://stackoverflow.com/comment/40979430
type: AnswerComment
type: Comment
has text: If you use ThreadPoolExecutor you have a remove(Runnable) operation.
comment on: http://stackoverflow.com/a/26143276
score: 0

http://stackoverflow.com/comment/40909663
type: AnswerComment
score: 0
type: Comment
has text: I understand that. But that's not what I meant by answering this question this way. That's why I asked him to take a look at the comments. I apologize if that is how it came across.
comment on: http://stackoverflow.com/a/26104828

http://stackoverflow.com/q/26160973
has comment: http://stackoverflow.com/comment/41012177
type: UnansweredQuestion
has body: I want to do a loadjava of iText 5.5.3 on my database. My database is oracle 10.2.0.4, I think I have a problem of java version. On my database it is: C:\numerisation&gt;java -version java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) The first error I get when doing my load java is: resolving: class com/itextpdf/text/pdf/hyphenation/CharVector errors : class com/itextpdf/text/pdf/hyphenation/CharVector ORA-29552: avertissement de vÚrification : java.lang.UnsupportedClassVersionError: com/itextpdf/text/pdf/hyphenation/CharVector (Unsupported major.minor version 49.0) I searched on the web and it says I have not a compatible version of java. What would you do ? Install a new version of Java on the database ? If yes, which one ? On the database it worked with iText 2.1.3.
tagged with: java
tagged with: itext
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26169961
tagged with: oracle-database
has title: Compatibility between iText 5.5.3 and java 1.6.0.17

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/26140338
tags question: http://stackoverflow.com/q/26107240
tags question: http://stackoverflow.com/q/26194468
tags question: http://stackoverflow.com/q/26080344
tags question: http://stackoverflow.com/q/26080040
tag name: c
tags question: http://stackoverflow.com/q/26094013
type: Tag
tags question: http://stackoverflow.com/q/26083568
tags question: http://stackoverflow.com/q/26127052
tags question: http://stackoverflow.com/q/26116219
tags question: http://stackoverflow.com/q/26084966
tags question: http://stackoverflow.com/q/26101544
tags question: http://stackoverflow.com/q/26187569
tags question: http://stackoverflow.com/q/26142469
tags question: http://stackoverflow.com/q/26130238

http://stackoverflow.com/comment/40807263
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26048153
has text: Be aware that 5.26 cannot be exactly represented as a floating point value. [What Every Computer Scientist Should Know About Floating-Point Arithmetic](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)

http://stackoverflow.com/a/26146374
has body: Unless there is something you're not telling us, it is simply a repeat of what you have already done: newList.addAll(list); As has been said in the comments though, you really should be using full generic typing for your list variables: List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); List&lt;Integer&gt; newList = new ArrayList&lt;&gt;(); List&lt;Integer&gt; list1 = new ArrayList&lt;&gt;();
score: 2
has comment: http://stackoverflow.com/comment/40985419
downvote count: 0
has comment: http://stackoverflow.com/comment/40985391
has comment: http://stackoverflow.com/comment/40985507
has comment: http://stackoverflow.com/comment/40985214
upvote count: 2
has comment: http://stackoverflow.com/comment/40985253
answers question: http://stackoverflow.com/q/26146307
type: Answer

http://stackoverflow.com/a/26069430
type: Answer
has body: As chiastic-security answered, your approach is bad. However, it would have worked except you also made a logical error. Your while condition checked whether the bitwise AND of i1, i2, and i3 is either 0 or 1. It always is when the numbers are 0 or 1. Instead, you might repeat the loop if the sum is not 1. do{ ... } while ( i1 + i2 + i3 != 1 ); // so only (1,0,0), (0,1,0), or (0,0,1) passes
answers question: http://stackoverflow.com/q/26068216
score: 0

http://stackoverflow.com/comment/40972754
comment on: http://stackoverflow.com/a/26139525
score: 0
type: AnswerComment
has text: Thanks for the really quick answer. So if i get it correctly: boolean b = (3 == (Object)null); --> 3 is converted to an Integer (boxing) and then via widening reference conversion turned into a type Object. I agree with you, that it´s a bug, but it seems like a quite big bug.
type: Comment

http://stackoverflow.com/comment/40903952
type: QuestionComment
comment on: http://stackoverflow.com/q/26101321
score: 0
has text: Sounds to me like what you really want is two [Singleton](http://stackoverflow.com/q/70689/823393)s.
type: Comment

http://stackoverflow.com/comment/41072271
type: QuestionComment
comment on: http://stackoverflow.com/q/26192396
has text: Could you say if you use a servlet in a servlet container, or directly use sockets ?
score: 0
type: Comment

http://stackoverflow.com/comment/40965969
type: QuestionComment
comment on: http://stackoverflow.com/q/26135739
has text: And You have to update your `UI` in `onPostExecute()` method. Means set your adapter in `onPostExecute()` method.
score: 0
type: Comment

http://stackoverflow.com/comment/40837679
has text: Seems like the problem is those JFrame insets. The diff between the preferredsize you set and the size value you're getting back is exactly what the insets are. So maybe you need to create an Insets with 0 values and call JFrame.setInsets?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26065368
type: QuestionComment

http://stackoverflow.com/q/26087061
tagged with: java
has comment: http://stackoverflow.com/comment/40877504
has comment: http://stackoverflow.com/comment/40877395
has comment: http://stackoverflow.com/comment/40877495
has answer: http://stackoverflow.com/a/26087162
type: Question
has answer: http://stackoverflow.com/a/26087095
has answer: http://stackoverflow.com/a/26087111
has body: Why do i see so many examples out there that type private in front of a field while afaik fields are private by default. private int number; int number; //Both of these are the same afaik. Yet, in a ton of examples private gets fully written, why?
has comment: http://stackoverflow.com/comment/40877632
has answer: http://stackoverflow.com/a/26087943
has comment: http://stackoverflow.com/comment/40877070
has comment: http://stackoverflow.com/comment/40877116
downvote count: 0
has comment: http://stackoverflow.com/comment/40877149
accepted answer: http://stackoverflow.com/a/26087095
possible better answer: http://stackoverflow.com/a/26087099
favorite count: 0
has answer: http://stackoverflow.com/a/26087099
answer count: 5
has comment: http://stackoverflow.com/comment/40877191
score: 6
has title: Are fields in Java private by default?
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/a/26107139
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26106719
answers question: http://stackoverflow.com/q/26106719
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40916686
has comment: http://stackoverflow.com/comment/40917275
has body: Actually, you seem to need two things here. One is writing a test that checks that an exception was thrown and the other is running the same test for multiple inputs. First, start by parametrizing your test. In this approach your test method is written so that it only runs for a single input, and additional code (usually annotations) make this method run for multiple inputs. This makes your code simpler because you don't have to write the loop or put data in some array or list. You can use JUnit's built-in Parameterized test runner for this (docs and example) but I personally find its syntax cumbersome. My recommendation would be for you to use JUnitParams which has very concise and sweet syntax. For checking that an exception was thrown in a method that tests a single input, you can use the expected parameter in @Test annotation. An alternative would be using catch-exception library which is nicer if you have longer tests. Here, I think the built-in is good enough. So, using JUnitParams and the expected annotation parameter, your test could look like this: @Test(expected = ParseException.class) @Parameters( "[[]", "[]]", "[] hi", "hi", "[h]i", "[hi []", "[[]]" ) public void invalidListFromatShouldFail(String input) { ListUtil.parseList(toTest, TestEnum.class); } This is quite short and readable as well. EDIT: Here is a better example of using Parameterized, which also mentions @Parameter annotation which allows you to inject values directly into a field without the need to create a constructor in your test class. Still, having used both, I really recommend JUnit Params over Parameterized as the difference in ease of use and test readability is huge.
type: AcceptedAnswer

http://stackoverflow.com/comment/40941506
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26122082
type: Comment
has text: You don't name your columns in the question, so one has to guess at column names. If you want to search through multiple columns, then add additional clauses to the `where`: `'Apple' in (col2, col3, col4, col5)`.

http://stackoverflow.com/comment/40973101
has text: @GaneshkumarSR And if your concern is having to type `stu.get(i)` many times, you a temporary variable of type Student, but use it with a PreparedStatement.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26139835

http://stackoverflow.com/comment/40851234
type: Comment
has text: If your question is whether Swing provides that feature, then the answer is "no, not by a long shot". Swing has nothing to do with the solution to your problem.
score: 0
comment on: http://stackoverflow.com/q/26072950
type: QuestionComment

http://stackoverflow.com/a/26139760
type: Answer
answers question: http://stackoverflow.com/q/26138714
has body: If you don't want to use an annotation you can catch all exceptions and test in an assertion that the exception is of instance IllegalArgumentException. Exception e = null; try { // statement that should cause exception } catch(Exception exc) { e = exc; } // Assert that e is not null to make sure an exception was thrown // Assert that e is of type IllegalARgumentException But in the end it is much simpler to just use the JUnit annotation. Which seems to be correct to me.
score: 0

http://stackoverflow.com/a/26170503
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26108931
type: Answer
has body: I believe your correct jndi string should be ejb:/service-All/"+Client.class.getSimpleName()+"!" + IClient.class.getName() The first ocurrence of "service-All" you had doesn't belong because you are not packaging your ejb in an ear. Also, don't forget to pass username and password in your properties jndiProps.put(Context.SECURITY_PRINCIPAL, "peter"); jndiProps.put(Context.SECURITY_CREDENTIALS, "lois"); remember that you have to add the user ("peter" in this example) to your jboss. There's a script for that in jboss-eap-6.0/bin/add-user.sh (or add-user.bat for windows) Here you can find documentation for remote lookups https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project
answers question: http://stackoverflow.com/q/26108931

http://stackoverflow.com/q/26051331
possible better answer: http://stackoverflow.com/a/26051835
has comment: http://stackoverflow.com/comment/40811845
has answer: http://stackoverflow.com/a/26051835
has answer: http://stackoverflow.com/a/26052106
has comment: http://stackoverflow.com/comment/40811788
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40811804
has comment: http://stackoverflow.com/comment/40811791
answer count: 3
has comment: http://stackoverflow.com/comment/40811985
score: 1
tagged with: permutation
has title: Java recursion to find all the possible permutations & combinations in Arraylist quits too early
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26052106
has answer: http://stackoverflow.com/a/26051966
type: AnsweredQuestion
tagged with: recursion
linked to: http://stackoverflow.com/q/4240080
has body: I'm writing a recursive permutations program in Java to find all the possible permutation of the Strings in an Arraylist. I know there are a lot of posts similar to this, but I haven't found one that addresses this issue specifically. The problem I have with my code is that it only runs the first permutation and then quits I know that it's doing this because every time it is called, an item is removed but the indexes shift so its only doing one call per element, but I don't know how to fix it. I've tried changing the for-loop conditions, removing the element at different spots, adding base cases, but everything seems to only make it worse. As it is now, the input[w,h,a,t]would return an arrayList with elements [what,hat,at,t]. The expected output is all the permutations of the four letters. Where do I go from here? I know I'm close but I've been stuck on this for several days Any help would be greatly appreciated public class wordFinder { static ArrayList&lt;String&gt; permutations = new ArrayList&lt;String&gt;(); public static String findPermutations(ArrayList&lt;String&gt; letterArray) { String prefix = ""; for (int i = 0; i &lt; letterArray.size(); i++) { String temp = letterArray.remove(i); prefix = temp + findPermutations(letterArray); permutations.add(prefix); } return prefix; } }
tagged with: java
has comment: http://stackoverflow.com/comment/40811958
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40811893
has comment: http://stackoverflow.com/comment/40812344
has comment: http://stackoverflow.com/comment/40811760
tagged with: for-loop

http://stackoverflow.com/comment/41067743
type: Comment
score: 1
type: AnswerComment
has text: @o11c But the C way mixes type and instance declarations. It is a very broken and counter intuitive syntax. It is a pity Java adopted it.
comment on: http://stackoverflow.com/a/26187607

http://stackoverflow.com/q/26105775
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40948893
tagged with: expandablelistview
has body: I'm trying to create button at runtime in expandablelistview, when you click in one of the elements of the listview public class ExpandAnimationDemo extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //To change body of overridden methods use File | Settings | File Templates. setContentView(R.layout.main); ListView list = (ListView)findViewById(R.id.udiniList); final LinearLayout lm = (LinearLayout) findViewById(R.id.toolbar); ArrayAdapter&lt;String&gt; listAdapter = new CustomListAdapter(this, R.layout.list_item); for (int i=0; i&lt;5;i++) listAdapter.add("udini"+i); // create the layout params that will be used to define how your // button will be displayed LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.HORIZONTAL); // Create Button final Button btn = new Button(this); // Give button an ID //btn.setId(j+1); btn.setText("Add To Cart"); // set the layoutParams on the button btn.setLayoutParams(params); //Add button to LinearLayout ll.addView(btn); //Add button to LinearLayout defined in XML lm.addView(ll); here i have de null pointer! list.setAdapter(listAdapter); // Creating an item click listener, to open/close our toolbar for each item list.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, final View view, int position, long id) { View toolbar = view.findViewById(R.id.toolbar); // Creating the expand animation for the item ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500); // Start the animation on the toolbar toolbar.startAnimation(expandAni); } }); } /** * A simple implementation of list adapter. */ class CustomListAdapter extends ArrayAdapter&lt;String&gt; { public CustomListAdapter(Context context, int textViewResourceId) { super(context, textView…
answer count: 0
has comment: http://stackoverflow.com/comment/40961481
tagged with: java
has title: NPE error trying to create button at runtime in expandablelistview android studio
has comment: http://stackoverflow.com/comment/40911340
type: Question
tagged with: button

http://stackoverflow.com/q/26180642
tagged with: iframe
has title: Selenium WebDriver's sendKeys only types new lines
type: AnsweredQuestion
tagged with: java
tagged with: selenium
type: Question
accepted answer: http://stackoverflow.com/a/26214814
has comment: http://stackoverflow.com/comment/41053163
has comment: http://stackoverflow.com/comment/41055337
tagged with: tinymce
has answer: http://stackoverflow.com/a/26214814
score: 0
has body: I'm trying to send some content to a cell inside a table. The table is inside an iFrame, generated by TinyMCE. For some reason, the only characters that are typed are "\n". I have two methods: switchToFrame() and switchToDefault(), for switching between the iFrame and the window. I have a method which types inside the &lt;body&gt; of the iFrame, which works just fine: public void typeInBody(String content) { switchToFrame(); WebElement body = driver.findElement(BODY_LOC); body.click(); body.sendKeys(content); switchToDefault(); } And here is the method to type inside a column: public void typeInColumn(int index, String content) { switchToFrame(); WebElement column = driver.findElement(COLS_LOC[index]); column.click(); column.sendKeys(content); switchToDefault(); } Finally, here is "the test" (is not a final test, is just for testing that the above methods work): @Test(description = "see if tinyMCE methods work") public void test() { String content = "Neque porro quisquam est \n" + "qui dolorem ipsum quia \n" + "dolor sit amet, \n" + "consectetur, adipisci velit..."; form = page.getForm(); form.emptyFields(); // driver.findElement(BODY_LOC).clear(); form.insertColumns(); // it's an option from tinyMC (just clicks the button) form.typeInColumn(0, content); // calls typeInColumn(0, content); form.clickSave(); // saves the form form = page.getForm(); // opens the form again // no assert for now } This is the TinyMCE after the test. and here is with form.typeInBody(content); which calls typeInBody(content). Any idea why Selenium behave like this?
answer count: 1

http://stackoverflow.com/comment/40874722
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26085302
has text: can you post the built in methods @Lonenebula
score: 0

http://stackoverflow.com/comment/40791980
score: 0
has text: How come the method .add is defined, and addFirst isn't? This might not be an advanced question, but I'm missing something here, I really don't have an idea.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26040741

http://stackoverflow.com/comment/40819035
type: Comment
has text: @Jeff what you describe with disks becoming full is also another form of parallelism; other processes are writing to a disk while our application is running. Java often uses exceptions in this kind of case to communicate that something BAD has happened during disk IO (eg. ran out of disk space) and the Java libraries handle the concurrency primitives for us relating to the disk IO parts.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26055394

http://stackoverflow.com/comment/41061530
comment on: http://stackoverflow.com/q/26186377
type: QuestionComment
has text: I did disable the restriction but if you want to help you can set it to 128 bit, doesnt matter in that case. Is the standard padding in javascript not AES/CBC/PKCS7 and equals to java AES/CBC/PKCS5 padding?
score: 0
type: Comment

http://stackoverflow.com/comment/41045171
has text: Are you using the default test runner, or a different one? e.g. junit test runner or spring test runner.
type: Comment
comment on: http://stackoverflow.com/a/26178545
score: 0
type: AnswerComment

http://stackoverflow.com/a/26036498
accepted answer of: http://stackoverflow.com/q/26036354
answers question: http://stackoverflow.com/q/26036354
score: 0
type: AcceptedAnswer
type: Answer
has body: Try this : int l1 = ArrayList1.size(); int l2 = ArrayList2.size(); int max = Math.max(l1, l2); ArrayList&lt;Integer&gt; ArrayListResult = new ArrayList&lt;Integer&gt;(max); for (int i = 0; i&lt;max; i++ ) { ArrayListResult.set(i,0); if(i &lt; l1) { ArrayListResult.set(i,ArrayList1.get(i)+ArrayListResult.get(i)); } if(i &lt; l2) { ArrayListResult.set(i,ArrayList2.get(i)+ArrayListResult.get(i)); } } Might be a more elegant solution than having 2 tests in the loop but that should work.

http://stackoverflow.com/a/26176820
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26175381
answers question: http://stackoverflow.com/q/26175381
type: Answer
score: 2
downvote count: 0
has body: Not with IZpack on its own, but you can wrap up an IZpack installer JAR as a .exe using a tool such as Launch4J, and when users run the .exe it will prompt them to download a JRE if there is no suitable one installed already.
upvote count: 2

http://stackoverflow.com/comment/51544396
type: AnswerComment
comment on: http://stackoverflow.com/a/26169630
has text: Here's a fairly recent post of a Google employee which confirms that Java 8 is coming to GAE: https://groups.google.com/d/msg/google-appengine/8y80sEhr7Rc/66WnFoBvL3AJ
type: Comment
score: 2

http://stackoverflow.com/q/26038692
downvote count: 0
has answer: http://stackoverflow.com/a/26041461
favorite count: 0
accepted answer: http://stackoverflow.com/a/26055535
tagged with: android
has comment: http://stackoverflow.com/comment/40788447
tagged with: regex
score: 2
has title: Sqlite sorting using regex
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/40788636
has comment: http://stackoverflow.com/comment/40787986
type: Question
has body: Sqlite sorting using regex I have rows in an sqlite db text field (codes) with values like: M1 M2/4527 M101 1 2/5 3/1003 101 102 I wish to sort codes with all the rows that start with a number first followed by all the codes that start with a letter A through Z. This is the nearest I've got rawdata = database.rawQuery("SELECT * FROM tablename ORDER BY CASE WHEN " + codes + " GLOB '*^[0-9]*' THEN CAST(" + codes + " AS INTEGER) ELSE CAST(" + codes + " AS TEXT) END, " + codes + " COLLATE NOCASE ASC", null); Which gives me this: 1 101 102 2/5 3/1003 M1 M101 M2/4527 The sort order I'm trying to achieve is: 1 2/5 3/1003 101 102 M1 M2/4527 M101 The codes that contain a slash can, if easier, have the slash and characters after ignored, as long as the character preceding the slash are sorted as per my requirement. So 2/5 would be 2 and 3/1003 would be 3.
has answer: http://stackoverflow.com/a/26055535
tagged with: java
has comment: http://stackoverflow.com/comment/40801001
tagged with: sorting
has comment: http://stackoverflow.com/comment/40816908
answer count: 2
possible better answer: http://stackoverflow.com/a/26041461
tagged with: sqlite

http://stackoverflow.com/comment/41036811
score: 0
has text: Is control even reaching your RegisterServlet? Try adding some print statements to confirm that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26174003

http://stackoverflow.com/q/26146540
favorite count: 0
has comment: http://stackoverflow.com/comment/40985646
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/40986020
linked to: http://stackoverflow.com/q/14349011
tagged with: c++
score: 4
linked to: http://stackoverflow.com/q/24403340
has answer: http://stackoverflow.com/a/26183707
linked to: http://stackoverflow.com/q/7776800
has comment: http://stackoverflow.com/comment/40986194
answer count: 1
has comment: http://stackoverflow.com/comment/40986357
tagged with: java-native-interface
tagged with: java
type: UnansweredQuestion
has title: How can I convert ArrayList<Integer> in Java to C++ int array using JNI?
upvote count: 4
has body: I'm using JNI to call c++ methods in my java client. In one of the methods, I'm passing in an ArrayList of integers and want to get out an array of integers in c++. When I pass the ArrayList through the JNI, I get a jObject. How do I convert that object to an integer array? I have found this post that is similar, but uses an arraylist of strings: JNI - java ArrayList conversion to c++ std::string* Any ideas on how to modify that do use integers? I tried just changing the std::string refrences to int, but with no luck.
downvote count: 0

http://stackoverflow.com/a/26041994
score: 0
type: Answer
has body: not sure how you are using js file in junit test but just try using javascript/envJSOptions.js src/main/java src/main/resources src/test/java src/test/resources all these folders can be considered to be in classpath (same level) so the paths will be started from that point on, if you are using a resource as stream..
answers question: http://stackoverflow.com/q/26041817

http://stackoverflow.com/a/26151387
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26150434
answers question: http://stackoverflow.com/q/26150434
type: Answer
has body: You need to define the credentials for your "integration-tomcat" server; this is normally done in your ~/.m2/settings.xml file: integration-tomcat manager manager
has comment: http://stackoverflow.com/comment/104729457
score: 5
upvote count: 5

http://stackoverflow.com/comment/40788490
comment on: http://stackoverflow.com/a/26038184
has text: yha you where right my bad that worked out perfectly thanks again
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26192332
type: AnsweredQuestion
score: 3
tagged with: java
answer count: 2
tagged with: arrays
downvote count: 0
has title: Passing existing array gives different results than passing new array with elements out of that array
has answer: http://stackoverflow.com/a/26192398
favorite count: 0
tagged with: android
has body: I'm programming a game for Android. The color of game elements is set through ColorTheme objects that store RGBA-values. On initialization of e.g. a triangle an array with RGBA-values out of an ColorTheme object is being passed to the constructor. Although the Colors in the ColorTheme-Object never change after initialization, the color of the triangle does. I'm trying to figure out why. I noticed that it works like I want it if I pass a new Array with elements from the ColorTheme-Array rather than passing the ColorTheme object itself to the Triangle constructor. This really shouldn't matter because there is no such thing as pointers in Java (right?). @Override public void onSurfaceChanged(GL10 gl10, int width, int height) { //... mThemes = new ColorTheme[]{ new ColorTheme( new float[]{0.20f, 0.71f, 0.91f, 1.00f}, // blue circle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white obstacle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white triangle new float[]{0.00f, 0.60f, 0.80f, 1.00f} // shadow ), new ColorTheme( new float[]{0.27f, 0.40f, 0.80f, 1.00f}, // purple circle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white obstacle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white triangle new float[]{0.60f, 0.20f, 0.80f, 1.00f} // shadow ), new ColorTheme( new float[]{0.60f, 0.80f, 0.00f, 1.00f}, // green circle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white obstacle new float[]{1.00f, 1.00f, 1.00f, 1.00f}, // white triangle new float[]{0.40f, 0.60f, 0.00f, 1.00f} // shadow ) }; //... // Values keep changing after initialization like this mShadowTriangle = new Triangle(mScreenRatio, mThemes[outerThemeIndex].theme[3],true); // They don't like this mShadowTriangle = new Triangle(mScreenRatio, new float[]{mThemes[outerThemeIndex].theme[3][0],mThemes[outerThemeIndex].theme[3][1],mThemes[outerThemeIndex].theme[3][2],mThemes[outerThemeIndex].theme[3][3]},true); }
possible better answer: http://stackoverflow.com/a/26192409
has answer: http://stackoverflow.com/a/26192409
upvote count: 3
accepted answer: http://stackoverflow.com/a/26192398
type: Question

http://stackoverflow.com/a/26167724
answers question: http://stackoverflow.com/q/26167178
has body: In simple terms Abstraction: Showing what is necessary and hiding unnecessary details. Ex if your class has 10 functions but only 2 should be useful by the consumer of the class that you make those functions as public and other are private, so what is visible to the consumer is what is needed, instead of showing it all. Encapsulation: Hiding the complexity to the consumer of the class. Ex. if your class needs two variables to store min and max, you encapsulate them under getter and setter and implement all the validations and checks in the getter and setter. this way you hide the complexities.
score: 0
type: Answer

http://stackoverflow.com/comment/41013972
type: QuestionComment
comment on: http://stackoverflow.com/q/26161734
has text: 99.9% of the time you don't care what remaining items are. And if you do you can fill them with nulls youself. Avoiding pointless performance overhead is the key.
score: 0
type: Comment

http://stackoverflow.com/comment/40974323
has text: I don't understand your setup - the application has some REST endpoints that the client-facing javascript code can call? And now you have another client that doesn't acquire a session id before talking to your REST endpoint?
comment on: http://stackoverflow.com/q/26140375
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/26088757
has comment: http://stackoverflow.com/comment/40880708
type: UnansweredQuestion
tagged with: list
tagged with: java
has body: I have a problem with an algoritm in Java. This algoritm have to remove elements from a list, but only one time (the first element). I tried this, i compile good but problems when i run it... /** * Returns in "list" the previous content of "list" after removing "subList" if it is present in "list" * * @param list (input/output) The list where search and remove the first occurrence of "subList" * @param subList (input) The sub list to search within "list" */ public void removeSubList(PositionList&lt;E&gt; list,PositionList&lt;E&gt; subList) { Position&lt;E&gt; cursor1 = list.first(); Position&lt;E&gt; cursor2 = subList.first(); while(cursor1 != null &amp;&amp; cursor2 != null) if(cursor1.element()==cursor2.element()){ Position&lt;E&gt; borrar = cursor1; cursor1=list.next(cursor1); cursor2=list.next(cursor2); list.remove(borrar); } } This is what i want on the console output: removeSubList([3,2,3,4,5,3],[3])[2,3,4,5,3] removeSubList([2,3,4,5,3,4],[3,4])--------> [2,5,3,4] removeSubList([3,2,3,4,7],[3,7])--------> [3,2,3,4,7] removeSubList([3,2,3,4,5,3],[])--------> [3,2,3,4,5,3] removeSubList([],[3,7])--------> [] removeSubList(null,[3,7])--------> null removeSubList([3,2,3,4,5,3],null)--------> [3,2,3,4,5,3] Only remove the first. Thanks for help.
has title: PositionList error removing elements
type: Question
score: 0
has answer: http://stackoverflow.com/a/26089018
answer count: 1

http://stackoverflow.com/comment/40963405
has text: possible duplicate of [String replace a Backslash](http://stackoverflow.com/questions/5596458/string-replace-a-backslash)
comment on: http://stackoverflow.com/q/26134499
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26239980
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/26177874
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: ok, after some research I ended up with this piece of code, which is perfectly working for me. So, I post it in here, in case if someone is looking for the same solution. KeyStore keystore; java.security.Security.addProvider( new org.bouncycastle.jce.provider.BouncyCastleProvider() ); PEMParser pemParser = new PEMParser(new StringReader(privateKey)); Object object = pemParser.readObject(); PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder().build(pwd.toCharArray()); JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC"); KeyPair kp; if (object instanceof PEMEncryptedKeyPair) { kp = converter.getKeyPair(((PEMEncryptedKeyPair) object).decryptKeyPair(decProv)); } else { kp = converter.getKeyPair((PEMKeyPair) object); } RSAPrivateKey result = (RSAPrivateKey)kp.getPrivate(); keystore= KeyStore.getInstance("pkcs12"); keystore.load(null, pwd.toCharArray()); keystore.setKeyEntry(keyStoreAlias, result, pwd.toCharArray(), new Certificate[]{certificate}); Thanks to all who suggested any solutions or put questions.
answers question: http://stackoverflow.com/q/26177874

http://stackoverflow.com/comment/40908127
score: 1
type: AnswerComment
has text: @Eran: In general, your answer is correct, hence my upvote. In the specific case of the question, most of the `public` methods are really defined on a base class (`View`) that the OP's class will also need to extend to be the OP's own "UI widget class". Hence, in practice, in this situation, this will result in a lot of code and very little additional visibility control.
type: Comment
comment on: http://stackoverflow.com/a/26103990

http://stackoverflow.com/a/26069774
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26069668
has body: To convert between char and int you can use typecasting. For example: char myChar = (char) 65; System.out.println(myChar); will result in A. Hope that helps!

http://stackoverflow.com/comment/41069743
has text: Well, using any of your parameterized constructors would do this, so I think a redesign is in order.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26191782
type: Comment

http://stackoverflow.com/q/26046608
type: AnsweredQuestion
tagged with: java
score: 10
upvote count: 10
tagged with: dom
type: Question
has body: I am new to javax.xml.transform.Transformer. I am applying an XSLT on an XML document and It works fine. What I want to achieve is to be able to write the output of that tranformation to an OutputStream. This is my code: OutputStream outputStream = null; InputStream agent = new FileInputStream("src/res/testxmlfile.xml"); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource("src/res/trans.xslt")); transformer.transform(new StreamSource(agent), outputStream ????????); I know it can be used to write a file like this, but I want to write it to a OutputStream Object. transformer.transform(new StreamSource(agent), new StreamResult(new FileOutputStream("/result.xml"))); How can I pass an OutputStream to be used here? This is the error I am getting when I am passing the Outputstream: Exception in thread "main" javax.xml.transform.TransformerException: Result object passed to ''{0}'' is invalid. at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl .getOutputHandler(TransformerImpl.java:468) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl .transform(TransformerImpl.java:344) at com.gohealth.TestXmlStream.main(TestXmlStream.java:75)
answer count: 2
tagged with: transformation
downvote count: 0
favorite count: 0
has title: Java Transformer: How do you make its result into an OutputStream?
has answer: http://stackoverflow.com/a/26046678
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/26046663
accepted answer: http://stackoverflow.com/a/26046678
has answer: http://stackoverflow.com/a/26046663
tagged with: xslt

http://stackoverflow.com/q/26114325
tagged with: openssl
downvote count: 0
has body: As part of encrypting and saving data, we have generated KEY's using AES algorithm with openssl. openssl enc -aes-256-cbc -P -nosalt Openssl has generated KEY &amp; IV values, which are been stored in a plain text file. Since, storing of keys in a plain document is a not secure standard, thought of moving it to Keystore. Therefore, we have generated a Keystore using keytool by executing the below command. keytool -genseckey -keyalg AES -alias aesstore -keysize 256 -keypass changeit -storetype jceks -keystore hello.jceks -storepass changeit This Keystore holds a random secrey key. So, we wanted to move our KEY &amp; IV values to the Keystore, so that we can fetch from there and use them for encryption of data. I have found below link for storing customized KEY value to Keystore, but not the IV value. http://java.dzone.com/articles/secret-key-import-java Hence, if any one has any ideas on how to store both KEY &amp; IV values to keystore., please do share. Also, we are looking for a way, where we can pass the customized keys to keystore from the command line itself. Thanks in advance.
answer count: 1
tagged with: keytool
has title: Keystore -- Customized SecretKey entry into Keystore from command line
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
tagged with: aes
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26122105

http://stackoverflow.com/a/26120393
has comment: http://stackoverflow.com/comment/40937123
score: 0
answers question: http://stackoverflow.com/q/26120131
has body: You can try in this way TIntObjectHashMap&lt;String&gt; map = new TIntObjectHashMap&lt;&gt;(); map.put(1, "a"); map.put(2, "b"); //convert TIntObjectHashMap to java.util.Map&lt;Integer,String&gt; Map&lt;Integer, String&gt; utilMap = new HashMap&lt;&gt;(); for (int i : map.keys()) { utilMap.put(i, map.get(i)); } Integer key=null; if (map.containsValue("a")) { for (Map.Entry&lt;Integer, String&gt; entry : utilMap.entrySet()) { // issue solved if (entry.getValue().equals("a")) { key=entry.getKey(); } } } System.out.println(key); Out put: 1
has comment: http://stackoverflow.com/comment/40937052
type: Answer

http://stackoverflow.com/comment/40837654
type: QuestionComment
type: Comment
has text: and i recived 2014-09-26T14:48:25.190-0300|Informações: Data Inicialllllllllll
comment on: http://stackoverflow.com/q/26065271
score: 0

http://stackoverflow.com/q/26187229
has comment: http://stackoverflow.com/comment/41062291
score: 0
has comment: http://stackoverflow.com/comment/41061618
answer count: 3
has comment: http://stackoverflow.com/comment/41061769
tagged with: parseint
tagged with: string
has answer: http://stackoverflow.com/a/26187398
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41061944
has answer: http://stackoverflow.com/a/26187668
has comment: http://stackoverflow.com/comment/41062095
has answer: http://stackoverflow.com/a/26187292
has comment: http://stackoverflow.com/comment/41062132
has comment: http://stackoverflow.com/comment/41062153
has comment: http://stackoverflow.com/comment/41061589
has comment: http://stackoverflow.com/comment/41061593
has comment: http://stackoverflow.com/comment/41061614
has comment: http://stackoverflow.com/comment/41062238
tagged with: java
has comment: http://stackoverflow.com/comment/41061730
has body: Why would this not work and throw the following error? System.out.println(Integer.parseInt("A5")); Error is: at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at DecisionTreeImpl.createTree(DecisionTreeImpl.java:321) at DecisionTreeImpl.&lt;init&gt;(DecisionTreeImpl.java:59) Also if this is not a good method for converting the strings like "A5" to integer, what's the way to do it correctly in Java? I am given a class (and I am supposed not to modify it at all) which is like this: public class DecTreeNode { Integer label; //for Integer attribute; Integer parentAttributeValue; // if is the root, set to "-1" boolean terminal; List&lt;DecTreeNode&gt; children; So when I am instantiating this class all the values which I need to pass to it (including attributes and labels are all string) so I have no idea what I should do now that Integer.ParseInt is failing me! It is given as a hint that you might want to inherit from DecTreeNode class but I was not sure if that is related at all! Any idea how to tackle this problem? root= new DecTreeNode((trainingSet.labels.get(getMajority(instances, trainingSet.labels.size())),trainingSet.attributes.get(biggestEntropy), -1, TRUE); Here's the error I receive : The constructor DecTreeNode(String, String, int, boolean) is undefined However the problem is I am not allowed to modify the class DecTreeNode to have a new constructor. Here's the complete DecTreeNode that is supposed not to be modified: /** * Possible class for internal organization of a decision tree. * Included to show standardized output method, print(). * * Do not modify. If you use, * create child class DecTreeNodeImpl that inherits the methods. * */ public class DecTreeNode { Integer label; //for Integer attribute; Integer parentAttributeValue; // if is the root, set to "-1" boolean terminal; List&lt;DecTreeNode&gt; children; DecTreeNode(Integer _…
type: Question
has comment: http://stackoverflow.com/comment/41061600
has comment: http://stackoverflow.com/comment/41062184
has title: Converting String to int--java.lang.NumberFormatException.forInputString

http://stackoverflow.com/comment/102024469
has text: Fantastic answer! I really appreciate the time you put into this. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/38061562
type: Comment
score: 3

http://stackoverflow.com/a/26145204
has body: You cannot do it this way public static int divTwoNumbers(int iNum1, int iNum2 param){} //you cannot have a space in variable name either it should be public static int divTwoNumbers(int iNum1, int iNum2,int param){} or public static int divTwoNumbers(int iNum1, int iNum2param){} Or As I dont see any use of param just remove it public static int divTwoNumbers(int iNum1, int iNum2){}
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26145057

http://stackoverflow.com/q/26176043
upvote count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41040596
type: UnansweredQuestion
has body: I have code like this : List&lt;RFeeAtmbVO&gt; list = RFeeAtmbBO.getInstance().listRFeeAtmb(mapParam, null); if (list != null &amp;&amp; list.size() &gt; 0) { for (RFeeAtmbVO vo : list) { vo.setIdFeeType(edit_biaya_jenisBiayaId.getValue()); String name = edit_biaya_name.getValue().trim(); if (vo.getName().indexOf("(Gagal Berbayar)") &gt; -1) { name = name.substring(0, name.indexOf(" (Gagal Berbayar)")) + " (Gagal Berbayar)"; System.out.println("Hasilnya 1: "+name); } else { if (name.indexOf("(Gagal Berbayar)") &gt; -1 ) { name = name.substring(0, name.indexOf(" (Gagal Berbayar)")); System.out.println("Hasilnya2 : "+name); } } vo.setName(name); vo.setSdate(edit_biaya_sdate.getValue()); vo.setEdate(edit_biaya_edate.getValue()); vo.setKodeFee(edit_biaya_kodeFee.getValue()); vo.setMappingCode(edit_biaya_mappingCode.getValue()); RFeeAtmbBO.getInstance().updateRFeeAtmb(vo); } } When I add in textbox with "(Gagal Berbayar)" without quote is no problem and saved in database, but add some text without "(Gagal Berbayar)", I get the error like this : [err] java.lang.StringIndexOutOfBoundsException: String index out of range: -1 [err] at java.lang.String.substring(String.java:1904) [err] at controller.fee.fee.EditBiayaController.onClick$edit_biaya_btnSave(EditBiayaController.java:413) And Line 413 is name = name.substring(0, name.indexOf(" (Gagal Berbayar)")) + " (Gagal Berbayar)"; What the problem? Can help me please? sorry for late update code :)
has comment: http://stackoverflow.com/comment/41040497
downvote count: 0
score: 1
has title: Java Error substring
type: Question
has answer: http://stackoverflow.com/a/26176287
tagged with: java
has answer: http://stackoverflow.com/a/26176286
tagged with: substring
answer count: 2
has comment: http://stackoverflow.com/comment/41040692

http://stackoverflow.com/a/26148643
has comment: http://stackoverflow.com/comment/40989537
score: 0
type: Answer
has body: The integer is a variable inside the method; it has scope of the method which means it can't be accessed from outside the method. The String is a field; it has scope of the class, so it can be accessed from anywhere inside the class including inside the method.
answers question: http://stackoverflow.com/q/26148591

http://stackoverflow.com/a/26085010
upvote count: 1
has comment: http://stackoverflow.com/comment/40873483
has comment: http://stackoverflow.com/comment/40873496
type: AcceptedAnswer
downvote count: 0
has body: This should work: jsonStr = "..."; Class&lt;? extends HashMap&gt; mapType = new HashMap&lt;String, Object&gt;().getClass(); Map data = new Gson().fromJson(job.jobContext, mapType); JsonObject locations = data.get("Locations").getAsJsonObject(); JsonArray locationAry = locations.get("Location").getAsJsonArray(); for(JsonElement jsonEle: locationAry) { Location loc = new Location(); JsonObject jsLoc = jsonEle.getAsJsonObject(); loc.elevation = jsLoc.get("elevation").getAsInt(); // ... }
type: Answer
has comment: http://stackoverflow.com/comment/40873462
accepted answer of: http://stackoverflow.com/q/26084892
answers question: http://stackoverflow.com/q/26084892
score: 1

http://stackoverflow.com/a/26064973
has body: If setDest is a static method of Turtle, you would call it by using the class name rather than via a specific instance, for example: Turtle.setDest(x, y);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26064483
upvote count: 1

http://stackoverflow.com/a/26092493
score: 0
answers question: http://stackoverflow.com/q/26092467
type: Answer
has body: You can write a filter , and then you can print all the parameters of request via it.
has comment: http://stackoverflow.com/comment/40894367

jakarta-ee
tags question: http://stackoverflow.com/q/26036756
tags question: http://stackoverflow.com/q/26131857
tags question: http://stackoverflow.com/q/26121496
tags question: http://stackoverflow.com/q/26064437
tags question: http://stackoverflow.com/q/26099331
type: Tag
tags question: http://stackoverflow.com/q/26187763
tags question: http://stackoverflow.com/q/26069312
tags question: http://stackoverflow.com/q/26086425
tags question: http://stackoverflow.com/q/26084385
tags question: http://stackoverflow.com/q/26083994
tags question: http://stackoverflow.com/q/26176008
tags question: http://stackoverflow.com/q/26092467
tags question: http://stackoverflow.com/q/26089205
tags question: http://stackoverflow.com/q/26065700
tags question: http://stackoverflow.com/q/26054657
tags question: http://stackoverflow.com/q/26148873
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/26145408
tags question: http://stackoverflow.com/q/26169246
tags question: http://stackoverflow.com/q/26056989
tags question: http://stackoverflow.com/q/26135990
tags question: http://stackoverflow.com/q/26101987
tags question: http://stackoverflow.com/q/26184285
tags question: http://stackoverflow.com/q/26036178
tags question: http://stackoverflow.com/q/26127554
tags question: http://stackoverflow.com/q/26149080
tags question: http://stackoverflow.com/q/26046937
tags question: http://stackoverflow.com/q/26054770
tags question: http://stackoverflow.com/q/26170039
tags question: http://stackoverflow.com/q/26184018
tags question: http://stackoverflow.com/q/26113079
tags question: http://stackoverflow.com/q/26035813
tags question: http://stackoverflow.com/q/26149009
tags question: http://stackoverflow.com/q/26177469
tags question: http://stackoverflow.com/q/26118287
tags question: http://stackoverflow.com/q/26049975
tags question: http://stackoverflow.com/q/26052516
tags question: http://stackoverflow.com/q/26136711
tags question: http://stackoverflow.com/q/26112874
tags question: http://stackoverflow.com/q/26123606
tags question: http://stackoverflow.com/q/26145730
tags question: http://stackoverflow.com/q/26124097
tags question: http://stackoverflow.com/q/26139999
tags question: http://stackoverflow.com/q/26076613
tags question: http://stackoverflow.com/q/26144104
tags question: http://stackoverflow.com/q/26081635
tags question: http://stackoverflow.com/q/26122894
tags question: http://stackoverflow.com/q/26140673

http://stackoverflow.com/a/26173526
type: Answer
has body: So I'm guessing your HashSet called 'list' is defined somewhere else in the code. Regardless, the add method on the HashSet class returns a boolean. It will return true if it can add the new item to the set, false if it is already in the set. So you just need to use something like; if( list.add(eText.getText().toString()) ) { //it has been added to the list } else { // show an alert } See the Java docs for more... http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html
answers question: http://stackoverflow.com/q/26173347
has comment: http://stackoverflow.com/comment/41035974
score: 0

http://stackoverflow.com/q/26107364
type: UnansweredQuestion
tagged with: codepages
has comment: http://stackoverflow.com/comment/40914978
has comment: http://stackoverflow.com/comment/40914545
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40914682
has comment: http://stackoverflow.com/comment/40914509
score: 1
tagged with: java
has title: codepage or arabic characters
tagged with: eclipse
has body: Consider this code: public class lamAlifTestClass { public static void main(String[] args) { String a = "لا"; String b = "a"; byte[] y = a.getBytes(); // -28 &amp; -57 byte[] z = b.getBytes(); // 97 System.out.println("Special character length: " + y.length); System.out.println("Normal character length: " + z.length); } } The special character takes 2 bytes using eclipse's default codepage Cp1046. Is there a codepage where this character only takes 1 byte? the character is called lam-alif. How can i get eclipse/java to use this codepage where the character is only taking 1 byte? I tried to change the codepage in the properties of the file, but it's taking any effect? http://www.fileformat.info/info/charset/x-IBM1046/list.htm
type: Question
has comment: http://stackoverflow.com/comment/40915111
has comment: http://stackoverflow.com/comment/40915239
has comment: http://stackoverflow.com/comment/40915379
has comment: http://stackoverflow.com/comment/40915180
upvote count: 1
has comment: http://stackoverflow.com/comment/40914904
favorite count: 0

http://stackoverflow.com/comment/40925255
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26102236
score: 1
has text: Well there must be some reference (indirect maybe) to it. Also you are mixing versions of Spring. You shouldn't include the `spring-dao-2.0.8` dependency as that is, as the version already mentions, for Spring 2.0.8 and nog 3.2.8. It has been replaced with the `spring-orm` jar.

http://stackoverflow.com/q/26042679
tagged with: link-header
answer count: 2
linked to: http://stackoverflow.com/q/21431935
has body: I use Jersey's Link Headers feature to create HTTP link headers: @InjectLink(value="users/?orgId=12345&amp;page=0",rel="first") Works well except question mark - this is encoded in %3F and resulting URL looks like: http://localhost:8080/app/users/%3ForgId=12345&amp;page=0 I there any way to prevent encoding and leave question mark char as is?
favorite count: 0
has title: Question mark in value of @InjectLink is encoded as %3F. How to prevent this?
has answer: http://stackoverflow.com/a/27524331
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/26043580
downvote count: 0

http://stackoverflow.com/a/26067888
has body: The EJB doesn't technically need to have access to the JSESSION_ID of the client because, like any basic pojo, it's alive and usable, as long as the calling client is alive. Once the calling client is destroyed or otherwise relinquishes control of the SFSB, the bean is liable to be passivated or destroyed (and hence "forget" the conversation) From the Oracle JavaEE-6 tutorial The state is retained for the duration of the client/bean session. If the client removes the bean, the session ends and the state disappears. This transient nature of the state is not a problem, however, because when the conversation between the client and the bean ends, there is no need to retain the state Think of it the same way you get hold of a regular java object in a has-a relationship: once you've set the composed object to null, you've basically ended your conversation with that object. The same applies here (sort of). There's no need for the client to pass specific session information to the EJB. The EJB's normal lifecycle and annotations (specifically @Remove) take care care of everything else. A word of caution about SFSBs: They are heavyweight and they last longer than SLSBs. Don't use them unless you really need a full-scale EJB's trappings. In many cases, a plain HttpSession and an SLSB would suffice. Further Reading Lifecycle of an EJB
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40854825
accepted answer of: http://stackoverflow.com/q/26046937
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26046937

http://stackoverflow.com/comment/40919414
score: 1
comment on: http://stackoverflow.com/a/26110197
type: AnswerComment
type: Comment
has text: The `100` in the last step must be `double`, so add a "d" to it, like this `100d` - see edited answer. If you don't do that, you get integer arithmetic. If one operands is floating point, the result is floating point.

http://stackoverflow.com/q/26132046
has body: My Android app sends requests to an external HTTP server using the DefaultHttpClient API. I am having trouble switching to HTTPS. My server uses a self-signed certificate which obviously isn't trusted by default. When the app connects to the server, I want to show the server certificate's fingerprint to the user and make him accept or reject the certificate. Is this possible with DefaultHttpClient? If yes, could I see a code snippet showing how it's done. I have seen many supposed solutions to this and similar problems, but none worked for me.
tagged with: https
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40959009
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26132163
accepted answer: http://stackoverflow.com/a/26151896
tagged with: android
has title: How do I prompt the user to accept or reject a HTTPS certificate?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40968514
has answer: http://stackoverflow.com/a/26151896
has answer: http://stackoverflow.com/a/26132163

http://stackoverflow.com/q/26056098
tagged with: cors
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26575268
type: Question
has body: Currently i'm facing the problem that my thetransactioncompany corsfilter on an Tomcat 7 with Jersey 1.18 (can't update) works for the path /v2/users on PUT but not on /v2/plans. There is no difference between those - same package only the class is different. I also need to say that GET, POST works fine only PUT doesn't work. My web.xml looks like this: CORS com.thetransactioncompany.cors.CORSFilter cors.allowGenericHttpRequests true cors.allowOrigin * cors.allowSubdomains true cors.supportedMethods GET, POST, PUT, DELETE, OPTIONS, HEAD cors.supportedHeaders * cors.supportsCredentials true cors.maxAge -1 CORS /* this should allow PUT on all paths after root - or am i wrong? also the OPTIONS on /v2/plans would give me the allowed methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
tagged with: put
tagged with: java
upvote count: 1
answer count: 1
has title: CORS thetransactioncompany does not work for one specific path
accepted answer: http://stackoverflow.com/a/26575268

http://stackoverflow.com/comment/40878465
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26087768
score: 1
has text: The title of the post says otherwise

http://stackoverflow.com/a/26064250
has body: if you use socket and send the data is like dedicated chat. you might want to use MulticastSocket to make a chat where your message is visible all others who are in that group. http://download.java.net/jdk7/archive/b123/docs/api/java/net/MulticastSocket.html
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26064134
answers question: http://stackoverflow.com/q/26064134
type: Answer
has comment: http://stackoverflow.com/comment/40835464

http://stackoverflow.com/comment/40957111
score: 0
has text: Your test shows it can't be a string. You need to change your code to expect an Exception.
comment on: http://stackoverflow.com/q/26130797
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41043686
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26177977
type: QuestionComment
has text: i have just debugged it ..but always the first loop is getting skip

http://stackoverflow.com/comment/41004486
comment on: http://stackoverflow.com/a/26156508
type: Comment
has text: If he can't change the classpath what's the chance he can add any additional arguments to calling the java runtime?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40798736
type: Comment
type: QuestionComment
has text: There is absolutely no reason at all that it should run slowly as at runtime they are just similar byte code. I suspect when for first time the class loader loads it and say it loaded some native library, then it might take time for first time usage.
comment on: http://stackoverflow.com/q/26041475
score: 0

http://stackoverflow.com/q/26078332
tagged with: android
has title: Remove sprites Libgdx Java
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26079784
tagged with: sprite
has body: So I have a sprite that intersects another sprite, and when that happens i want to remove the first sprite, so that it can't be seen or interacted with. I am currently drawing a texture, and then drawing a rectangle in the same place so that i can interact for the rectangle. I could also use the 'sprite' instead. Problem: I don't know how i can remove the sprite so that it can not be seen and can not be interacted with. I also want to be able to do it the other way, not there then be able to see and interact with it. Any ideas?
tagged with: libgdx
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/26178681
accepted answer: http://stackoverflow.com/a/26179372
type: Question
has title: Get Maven AbstractMojo @parameters pom tag attributes
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26179372
has body: I'm new on java. Given that I have a configuration on my pom.xml <plugin> org.custom.plugin <artifactId>my-maven/artifactId> 1.0-SNAPSHOT 2.0 How do I call the URL attribute ID with in my class? /** * The properties files that will be used when reading properties. * * @parameter * @required */ private String url; // hot to get attribute of ID?
tagged with: maven
tagged with: pom.xml
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/40893578
type: Comment
has text: Thanks for your response. I would want to do it from Java and I have specified my approach above. It's just that I want to optimize it so that performance does not get impacted when there is huge amount of data.
comment on: http://stackoverflow.com/a/26052444
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40864194
type: QuestionComment
has text: You should almost never add a KeyListener to a text component such as a JTextField. There's likely a better way to do this, such as with Key Bindings. And in fact that is a potential solution. What key press are you trying to trap?
comment on: http://stackoverflow.com/q/26080000
score: 0
type: Comment

http://stackoverflow.com/a/26087933
has body: you can use the third constructor: ForkJoinPool(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory factory, Thread.UncaughtExceptionHandler handler, boolean asyncMode) No. But the nice thing about open-source software is that you can create your own copy and modify it any way you want.
score: 0
answers question: http://stackoverflow.com/q/26079987
type: Answer

http://stackoverflow.com/comment/40798924
type: Comment
has text: As soon as I commented the val1 and val2 at the beginning of actionPerformed method it gave me the desired result. Thanks a lot for your answer! So suggest me what would be the better way to getText at the start or in the buttons if/else blocks in actionPerformed?
comment on: http://stackoverflow.com/a/26044365
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41036807
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26173983
has text: @KickButtowski what do you mean..it accept chat .it accept only primitives.not objects
score: 1

http://stackoverflow.com/q/26141315
has comment: http://stackoverflow.com/comment/40975977
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28224178
tagged with: java
tagged with: servlets
type: Question
has title: Injection exception on servlet
has body: Successfully deploy to Glassfish. Go to run it and com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class com.wellpoint.mobility.aggregation.admin.HomeServlet at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:329) at com.sun.enterprise.web.WebContainer.createServletInstance(WebContainer.java:983) at com.sun.enterprise.web.WebModule.createServletInstance(WebModule.java:2130) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1404) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1211) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execu…
answer count: 1
tagged with: hibernate-entitymanager
has comment: http://stackoverflow.com/comment/40975668
score: 0

http://stackoverflow.com/q/26146307
tagged with: java
has answer: http://stackoverflow.com/a/26146464
type: Question
score: -2
has answer: http://stackoverflow.com/a/26146374
has answer: http://stackoverflow.com/a/26146437
has comment: http://stackoverflow.com/comment/40985099
has answer: http://stackoverflow.com/a/63917551
has comment: http://stackoverflow.com/comment/40985252
downvote count: 2
has comment: http://stackoverflow.com/comment/40985086
linked to: http://stackoverflow.com/q/20144826
has answer: http://stackoverflow.com/a/26424496
has comment: http://stackoverflow.com/comment/40985590
has title: Nested List In One List
favorite count: 0
has comment: http://stackoverflow.com/comment/40985374
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40985630
has comment: http://stackoverflow.com/comment/40985702
has body: How to convert a nested list into a single list in java? List list = new ArrayList(); List newList = new ArrayList(); List&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;(); list1.add(2); list1.add(4); list.add(5); list.addAll(list1); list.add(6); How can i add the elements of list to newList so that when i print newList it prints [5,2,4,6]
has comment: http://stackoverflow.com/comment/40985730
upvote count: 0
tagged with: list
linked to: http://stackoverflow.com/q/7431006

http://stackoverflow.com/a/26609206
has body: I am not sure if it solves the problem in your particular use case, but have a look at Tapestry Functional Flows. Among the other things it allows collection filtering.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26184814

http://stackoverflow.com/comment/40944536
type: QuestionComment
has text: You should debug this. Are you really trying to call image(imgRainCloud, x, y) 7 times when xpos is 140 or greater? I highly doubt that.
comment on: http://stackoverflow.com/q/26124007
score: 0
type: Comment

http://stackoverflow.com/q/26052010
has answer: http://stackoverflow.com/a/26052065
upvote count: 4
tagged with: spring
has title: Scope of inner beans
has answer: http://stackoverflow.com/a/26052103
downvote count: 0
type: UnansweredQuestion
tagged with: java
has body: I am new to Spring’s framework. I came across inner beans concept and want to know what will be scope of inner beans. Can anyone explain me what will be inner beans scope, will it depend on the bean in which it is defined.
type: Question
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/26052048
tagged with: javabeans
favorite count: 0

http://stackoverflow.com/comment/40884933
type: Comment
type: QuestionComment
has text: No, i don't have it.
comment on: http://stackoverflow.com/q/26090639
score: 0

http://stackoverflow.com/a/26957624
type: Answer
has body: I solved this by downgrading my version of the JDK from 8 to 7.
answers question: http://stackoverflow.com/q/26165251
score: 0

http://stackoverflow.com/q/26108672
tagged with: java
tagged with: rsa
type: Question
score: 20
answer count: 2
downvote count: 0
favorite count: 0
has title: RSA: encrypt in iOS, decrypt in Java
has answer: http://stackoverflow.com/a/27446066
possible better answer: http://stackoverflow.com/a/26147479
has answer: http://stackoverflow.com/a/26147479
has body: I have a public key that's sent from a Java server. The base64 encoded strings match before I decode and strip out the ASN.1 headers. I store the public key in the keychain with SecItemAdd. So I'm trying to encrypt the data using the public key and decrypt it with the private key in Java. I'm using SecKeyEncrypt on the iOS side and Cipher on the Java side. What I'm encrypting is the symmetric AES key that encrypts my actual data, so the key length is 16 bytes. When simply base64 encoding the key, everything works, so I know something is wrong with this RSA encryption. Here's an example of my iOS call: OSStatus sanityCheck = SecKeyEncrypt(publicKey, kSecPaddingPKCS1, (const uint8_t *) [incomingData bytes], keyBufferSize, cipherBuffer, &amp;cipherBufferSize ); Here's an example of my Java call: public static byte[] decryptMessage (byte[] message, PrivateKey privateKey, String algorithm) { if (message == null || privateKey == null) { return null; } Cipher cipher = createCipher(Cipher.DECRYPT_MODE, privateKey, algorithm, false); if (cipher == null) { return null; } try { return cipher.doFinal(message); } catch (IllegalBlockSizeException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return null; } catch (BadPaddingException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return null; } } private static Cipher createCipher (int mode, Key encryptionKey, String algorithm, boolean useBouncyCastle) { Cipher cipher; try { if (useBouncyCastle) { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); cipher = Cipher.getInstance(algorithm, "BC"); } else { cipher = Cipher.getInstance(algorithm); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return null; } catch (NoSuchPaddingException e) { e.printStackTrace(); //To change body of catch statement use File | Setting…
accepted answer: http://stackoverflow.com/a/27446066
type: AnsweredQuestion
upvote count: 20
tagged with: ios7

http://stackoverflow.com/q/26076532
has body: I have 2 classes, each is on different folders Main class src/mainclass/Main.java Display class src/swingclass/Display.java Main Class: package src.mainclass; import src.swingclass.Display; public class Main{ public static void main(String[] args){ Display sM = new Display(); } } Display Class: package src.swingclass; public class Display{ public Display(){ System.out.println("Display class"); } } i run it on cmd and it is stated error: package src.swingclass does not exist and also, Main class could not see Display class. overall, i have 3 errors. I know that using IDE will make this easier, but i want to learn this on cmd. I followed the tutorials on net, but it still has errors.
favorite count: 0
answer count: 5
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/26076615
has answer: http://stackoverflow.com/a/26076608
has title: How to access another class in another package?
has comment: http://stackoverflow.com/comment/40857777
has comment: http://stackoverflow.com/comment/40857859
tagged with: java
has answer: http://stackoverflow.com/a/26076784
downvote count: 2
has comment: http://stackoverflow.com/comment/40857748
has answer: http://stackoverflow.com/a/26076561
type: Question
has answer: http://stackoverflow.com/a/26076634
has comment: http://stackoverflow.com/comment/40857720
has comment: http://stackoverflow.com/comment/40857839
has comment: http://stackoverflow.com/comment/40857744
upvote count: 0
has comment: http://stackoverflow.com/comment/40857797

size
type: Tag
tags question: http://stackoverflow.com/q/26055767
tag name: size

http://stackoverflow.com/comment/40981982
has text: Yes, my problem lies in the fact that I cannot use checked exceptions, but I do want to enforce handling the unchecked one. Seems like findbugs doesn't have a rule that I can use out of the box. I'll have a look at the links later on, but it just seems like too much work to get this working, I may just have to settle with a massive ********* WARNING DO NOT REMOVE TRY/CATCH******** comment : )
comment on: http://stackoverflow.com/a/26144501
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40835402
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26063600
has text: Using a cell factory is probably the appropriate method. You just need to code it without any assumptions about when the cells are created and updated. Can you post a simplified version of what you tried?
score: 0

http://stackoverflow.com/comment/40828748
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26060812
has text: LayoutGroup1 and LayoutGroup2 already need different parent classes though. They are both TYPES of layouts, but not common layout types, if that makes sense.

http://stackoverflow.com/comment/40793059
comment on: http://stackoverflow.com/a/26040727
score: 0
type: AnswerComment
has text: It depends on the type signature of `q.getResultList()`. If it returns just raw `List` you will get just a warning, if it returns `<T> List<T>` then type inference will assume T is whatever you said on the left side of the assignment and no type error.
type: Comment

http://stackoverflow.com/comment/40796769
has text: This doesn't work for me:(
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26043212

http://stackoverflow.com/a/26125812
score: 1
has body: If all the classes that extend FileTransfer will be in the same package, you can make download(), upload(), and process() protected methods. That way you are limiting who can call them. Then keep your template method, doTransfer() public so that is the only method that can be called by outside classes (outside of the package) I would also add a javadoc comment specifying that only doTransfer() should be invoked. Like this: public abstract class FileTransfer { /** * Handles the file transfer process */ public void doTransfer() { // private methods since we want to enforce this order of execution download(); // implem provided process(); // abstract method upload(); // implem provided } /** * Invoking outside of doTransfer can cause unexpected behavior. */ // If you never want subclasses to override this, make it private protected void download() { // implementation provided } /** * Invoking outside of doTransfer can cause unexpected behavior. */ // If you never want subclasses to override this, make it private public void upload() { // implementation provided } /** * Invoking outside of doTransfer can cause unexpected behavior. */ // Only the subclasses in the same package will be able to access this // for implementation purposes protected abstract void process(); // implementation not provided } Your API for the method to others using your class will just be FileTransfer void doTransfer() Handles transfering the files etc... None of the other methods should be available from the API. Note: It will however, still possible for your subclasses that are implementing process() to invoke it. There is no way from completely preventing them from doing that. The best you can do is add documentation specifying that it is not encouraged. The other problem is that because you don't know how the subclasses are actually implementing process() you can't say for certain that it can't be called alone. You are only assuming that they are implementing it in a way you expect them to t…
downvote count: 0
has comment: http://stackoverflow.com/comment/40947757
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26125721

http://stackoverflow.com/comment/40841503
type: QuestionComment
has text: is the `center` changed from the outside? It may be changed to `null` between the log and `float[]` creation?
score: 0
comment on: http://stackoverflow.com/q/26067330
type: Comment

http://stackoverflow.com/q/26085322
tagged with: querying
tagged with: sql
has comment: http://stackoverflow.com/comment/40874237
answer count: 0
has comment: http://stackoverflow.com/comment/40919247
type: UnansweredQuestion
tagged with: if-statement
score: 0
tagged with: java
type: Question
has body: This might be stupid question but this code is not working.. String sql= "SELECT field, question, choice1, choice2, choice3, choice4, answer " + "FROM WineQuiz ORDER BY RANDOM() LIMIT 5"; Intent i = getIntent(); String mField1 = i.getStringExtra("FIELD1"); String mField2 = i.getStringExtra("FIELD2"); String mField3 = i.getStringExtra("FIELD3"); if(mField1!="" || mField2!="" || mField3!=""){ sql = "SELECT field, question, choice1, choice2, choice3, choice4, answer " + "FROM WineQuiz WHERE field='"+mField1+"' or field='"+mField2+"' or field='"+mField3+"' ORDER BY RANDOM() LIMIT 5"; Cursor c =db.rawQuery(sql, null); What I'm trying to do is simple. I'm creating quiz app, which has SelectActivity sending string data of quiz field into this class receiving it with variables of mField1,2,3. If SelectActivity does not send any string, the first sql(variable) is put into the query. If one of the field is chosen, mField1 or 2 or 3 receives string data, then the second sql is put into the query. However, the first sql querying does not work while the second one works well. When I use the first sql query independently, it works pretty well. Thus, the first and second sql seems unable to exist at the same time though those two query has no problem by themselves. Why is that?? Replying the comments, "Not work" means cursor has no data. My continuing code is below, and the error log "Cursor has no data" shows up. It literally means those array does not store any data. Cursor c =db.rawQuery(sql, null); if (c.getCount() &gt; 0) { // If cursor has at least one row c.moveToFirst(); do { // always prefer do while loop while you deal with database cPos = c.getPosition(); array[cPos][0] = c.getString(c.getColumnIndex("field")); array[cPos][1] = c.getString(c.getColumnIndex("question")); array[cPos][2] = c.getString(c.getColumnIndex("choice1")); array[cPos][3] = c.getString(c.getColumnIndex("choice2")); array[cPos][4] = c.getString(c.getColumnIndex("choice3")); array[cPos][5] = c.getStri…
has comment: http://stackoverflow.com/comment/40884234
has comment: http://stackoverflow.com/comment/40874309
has title: Querying sql database with if conditions
has comment: http://stackoverflow.com/comment/40874058
tagged with: variables

http://stackoverflow.com/a/26169130
type: Answer
has body: You're right, it doesn't make any sense. Here's what rev 2 used to say: This is useful at times, but it’s more limited since the size of the array is determined at compile-time. The final comma in the list of initializers is optional. (This feature makes for easier maintenance of long lists.) "This" here refers to "initialize arrays of objects using the curly-brace-enclosed list", which is true. It looks like someone made a bad edit, thinking "this" referred to "the first form". It goes on to say that the second form is a useful way of simulating varargs, which was true at the time, but Java has since gotten actual varargs. (The first form can only be used in array declarations, not in method calls, and is therefore not useful for varargs).
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41029917
has comment: http://stackoverflow.com/comment/41028098
upvote count: 1
answers question: http://stackoverflow.com/q/26168846

http://stackoverflow.com/comment/40910950
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26073244
has text: This actually *is* using Spring and, as Peter said, it needs to be bootstraped or replaced. But, before anything else, verify that you actually have camel-jms dependency added. This is the type of error you get when you miss the component on the classpath.

http://stackoverflow.com/comment/40899562
comment on: http://stackoverflow.com/q/26098927
score: 0
has text: I have no idea, I'm sorry. It looks like some sort of lock around the file system, but I'm not sure at all. I can only suggest you to add more debug lines around each I/O statement (open / close / read / write).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40898160
comment on: http://stackoverflow.com/q/26098604
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik And what is? Can it be a trouble in that way?

http://stackoverflow.com/comment/40788636
type: QuestionComment
comment on: http://stackoverflow.com/q/26038692
has text: not sure about simpler with the SQL query. Imagine having a change in the order/comparison later on, and debugging/fixing that query... It's probably non-trivial with `Comparator` either, but at least way easier to debug!
score: 0
type: Comment

http://stackoverflow.com/comment/40805922
has text: I edited your answer to correct the method name. The method name isn't camel-cased.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26047942

http://stackoverflow.com/q/26185746
has comment: http://stackoverflow.com/comment/41064463
type: AnsweredQuestion
tagged with: java
has title: Adding NumberPicker value to database
tagged with: numberpicker
type: Question
accepted answer: http://stackoverflow.com/a/26195667
possible better answer: http://stackoverflow.com/a/26186776
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26195667
has answer: http://stackoverflow.com/a/26186776
has comment: http://stackoverflow.com/comment/41059968
has body: Update, I got this working finally by calling an onValueChangedListener. layout.setLayoutParams(params); final EditText input = new EditText(MainActivity.this); final EditText inputNotes = new EditText(MainActivity.this); final NumberPicker inputCount = new NumberPicker(MainActivity.this); inputCount.setMaxValue(50); inputCount.setMinValue(0); inputCount.clearFocus(); inputCount.setOnValueChangedListener( new NumberPicker. OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { } }); And calling that value when I post to the Parse.com database. Thank you. public void onClick(DialogInterface dialog, int which) { // Create a post. AnywallPost post = new AnywallPost(); // Set the location to the current user's location post.setLocation(myPoint); post.setText(input.getText().toString()); post.setNotes(inputNotes.getText().toString()); final int valueCount = inputCount.getValue(); //getting valueCount from above post.setNumber(valueCount); End update. I want to add the value from my NumberPicker to the backend Parse.com database I have set up for my app. I've added the NumberPicker to the Post form. When I look at the table after saving a Post, I don't see a number but a nonsense text entry. Does anyone have suggestions on what I need to add to my code? Thanks. The NumberPicker code in MainActivity: layout.setLayoutParams(params); final EditText input = new EditText(MainActivity.this); final EditText inputNotes = new EditText(MainActivity.this); final NumberPicker inputCount = new NumberPicker(MainActivity.this); inputCount.setMinValue(0); inputCount.setMaxValue(50); I'm saving the input with code further down in MainActivity. public void onClick(DialogInterface dialog, int which) { // Create a post. AnywallPost post = new AnywallPost(); // Set the location to the current user's location post.setLocation(myPoint); post.setText(input.getText().toString()); post.setNotes(inputNotes.getText().toString()); post.setNumber(i…
tagged with: parse-platform
tagged with: android

http://stackoverflow.com/comment/40907909
type: Comment
has text: also i am supposed to get the cpu usage on the server that i check but was informed that i may not be able to do that through this approach. i was told that a good way to get that kind of info was through unix. do you have some more tutorials that i could read up on for that as well?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26063235

http://stackoverflow.com/comment/40875004
has text: Which line is the line n°45?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26085892
type: QuestionComment

http://stackoverflow.com/comment/41290289
type: AnswerComment
type: Comment
has text: I'm sorry, I tried, but I can't figure out how to get the code to format in a comment. I'll keep looking for instructions for that... Anyway, the boolean was the missing piece. Thanks again!
comment on: http://stackoverflow.com/a/26157237
score: 0

http://stackoverflow.com/comment/40989424
comment on: http://stackoverflow.com/a/26108534
type: Comment
has text: you did not answer my question. I am trying to get the text content of the name element without losing the attributes or subnodes. I do not mean to be critical, but it seems like you just posted an advertisement for your web site without really considering my question.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26185802
has body: Hi I have created code that uses a HashSet array. I am brand new to Java programming and I would like to know how to accomplish these two tasks: *Get an item by index from the HashSet array *display the average length of each item in the list My code isn't long at all so I am pasting the entire code here. Thanks for all your help. public class MainActivity extends Activity { Button aButton; // Global Scope Button sButton; TextView text2; EditText eText; HashSet&lt;String&gt; list = new HashSet&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_layout); aButton = (Button) this.findViewById(R.id.button1); text2 = (TextView) this.findViewById(R.id.textView1); //Clickable Saved Input will display alert text2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Complete!", Toast.LENGTH_LONG).show(); } }); aButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { list.add("Books"); list.add("Newspapers"); list.add("Magazines"); String listString = ""; for (String s : list) { listString += s + " - "; } text2.setText(listString); } }); sButton = (Button) this.findViewById(R.id.button2); eText = (EditText) this.findViewById(R.id.editText1); sButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { //Log.v("EditText", eText.getText().toString()); if( !list.add(eText.getText().toString()) ) { System.out.println("Not Unique Item"); Toast.makeText(getApplicationContext(), "Already Saved!", Toast.LENGTH_LONG).show(); } else { System.out.println("Unique Entry Added"); Toast.makeText(getApplicationContext(), "Saved To Items.", Toast.LENGTH_LONG).show(); } } }); } }
type: Question
tagged with: arrays
downvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/26185955
has comment: http://stackoverflow.com/comment/41059481
has answer: http://stackoverflow.com/a/26185955
has comment: http://stackoverflow.com/comment/41058923
favorite count: 0
has answer: http://stackoverflow.com/a/26189039
score: -3
has title: Get an item by index from the HashSet array and also display the average length of each item in the list
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26189039

http://stackoverflow.com/comment/41020214
score: 0
comment on: http://stackoverflow.com/a/26164609
type: Comment
type: AnswerComment
has text: thanks so much for you reply,So this autowired WebApplicationContext should contain all beans from parent context to child context ?

http://stackoverflow.com/comment/40856652
has text: So that the issue problem! You have to declare the variable in Java before you can use it.
comment on: http://stackoverflow.com/q/26069651
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26105203
answer count: 0
downvote count: 0
has title: How to delete email with javax.email?
tagged with: java
type: Question
upvote count: 2
tagged with: jakarta-mail
has body: I have already seen another similar posts but it is still not working. I am using javax.email with Gmail and I can read messages successfully , but when I want to delete them, it does not do anything... I am doing this: // Open folder this.folder = this.store.getFolder("Inbox"); this.folder.open(Folder.READ_WRITE); // Get messages with specified filters messages = this.folder.search(messagesFilters); // Delete message[0].setFlag(Flag.DELETED,true); // Close this.folder.expunge(); this.folder.close(true); this.store.close(); But nothing happens in Gmail. Do you know how to do it?
tagged with: email
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40940730
score: 2

http://stackoverflow.com/comment/40994600
comment on: http://stackoverflow.com/q/26151271
has text: Have a look at your imports, looks like your IDE picked up a wrong package containing a class called Message. You need `javax.mail.Message`
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/26066257
has body: There's a few ways to do it. Assuming you only have one tic tac toe board running, the easiest thing to do is declare turn as static. static int turn = 0; Then you can make the get and set static, and you only have to change it for one of the CellPanels for all of them to recognize the turn has changed. CellPanel.setTurn(1); //sets turn for static int turn to 1. All CellPanels share the same turn value and recognize this as such That being said, I'm not sure what the purpose of your turn item is. Is it denoting Player 1, Player 2? Which turn it physically is? Something else?
has comment: http://stackoverflow.com/comment/40839759
score: 0
answers question: http://stackoverflow.com/q/26066032
type: Answer
has comment: http://stackoverflow.com/comment/40839834

http://stackoverflow.com/a/26059983
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26047093
has body: Add a panel to the Centre position of your border layout with the grid layout with 2 columns and then add the east and west contents to the panel. This approach is good if you want both the West and East to take up half the display each in terms of width. Similar to Compass' answer.
downvote count: 0

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/26127732
tags question: http://stackoverflow.com/q/26072939

http://stackoverflow.com/comment/40995931
has text: Nice! That reduced my time down to a more reasonable `650 ms`. I noticed you also changed my `/` to `quot`, which ended up being the biggest performance improvement. Why is `quot` more efficient?
type: Comment
comment on: http://stackoverflow.com/a/26151771
score: 1
type: AnswerComment

http://stackoverflow.com/q/26108760
has comment: http://stackoverflow.com/comment/41102036
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26304068
has comment: http://stackoverflow.com/comment/40997107
type: Question
tagged with: oracle-ucm
has comment: http://stackoverflow.com/comment/40917209
has comment: http://stackoverflow.com/comment/40917440
has comment: http://stackoverflow.com/comment/40917597
score: 0
answer count: 1
tagged with: junit
has body: I have a web Application that uses the CIS-API to communicate with Oracle UCM. I've been tasked with writing automated tests on the web Interface. I've been able to get that running with selenium-webdriver. However, due to the nature of the site and my tests, the tests are somewhat tightly coupled to the Data. How can I do proper Automated Testing on my site and ensure consistent data for my tests? Oracle UCM is backed by an MS SQL Server Database.
has answer: http://stackoverflow.com/a/26304068
has comment: http://stackoverflow.com/comment/41249794
has comment: http://stackoverflow.com/comment/40997122
has comment: http://stackoverflow.com/comment/40919280
has title: How Can I perform Integration Testing against Oracle UCM with consistent data?

http://stackoverflow.com/a/26134431
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40963706
answers question: http://stackoverflow.com/q/26132940
accepted answer of: http://stackoverflow.com/q/26132940
has body: Hibernate itself implemented JPA through the Hibernate Annotations and Hibernate EntityManager libraries (or flavors), which are built on top of the Hibernate Core libraries. Hibernate EntityManager is a complete implementation of JPA and it follows the JPA lifecycle JPA is like an interface which is implemented by other ORM's and these ORM's are act as a vendor for this.. So, there is no question of difference... and for to learn more you can go through this link. https://blogs.oracle.com/carolmcdonald/entry/jpa_caching
has comment: http://stackoverflow.com/comment/40963670
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40964400

http://stackoverflow.com/comment/68505438
type: QuestionComment
comment on: http://stackoverflow.com/q/26049329
score: 0
has text: Note that, at least for one project I'm compiling, the following works: `mvn clean package -Dadditionalparam=-Xdoclint:none`
type: Comment

http://stackoverflow.com/a/68666254
score: 0
has body: It says you can not change your working directory. Maybe start a new session. Also one of your backslashes is going the wrong way. To find your NetLogo path try file.choose() and then navigate to the NetLogo Jar file. Then when you open the path to file will show in R studios console. Copy the file path into the NLStart command which should look something like below. file.choose() NLStart("C:\\Program Files\\NetLogo 6.2.0\\app", gui = TRUE, nl.jarname = "netlogo-6.2.0.jar") Finally, make sure your Java, NetLogo and R are all running on 64 bit (works for me) or 32 bit but try not to mix. Finally try and run code directly from R GUI instead of RStudio. This helped the first time I opened Netlogo with R. I have a youtube video (https://www.youtube.com/watch?v=zWMdaTEPTOc) explaining how to open NetLogo from R and all my functional code (August 2021) can be found here.
type: Answer
answers question: http://stackoverflow.com/q/26140018

http://stackoverflow.com/q/26162017
has comment: http://stackoverflow.com/comment/41015378
type: Question
has comment: http://stackoverflow.com/comment/41376168
downvote count: 0
answer count: 1
tagged with: ooad
favorite count: 0
tagged with: tdd
has answer: http://stackoverflow.com/a/27885043
has comment: http://stackoverflow.com/comment/41029360
has comment: http://stackoverflow.com/comment/41348714
has body: I came across a shopping cart exercise to learn OOAD and TDD using Java. The exercise is: First Step: Design a checkout system Build a checkout system for a shop which sells 3 products say Bread, Milk, and Bananas. Costs of the products are : Bread - $1, Milk - $0.60 and Banana - $0.40 Build a system to checkout a shopping cart that can have multiples of these 3 products and displays the order total. Examples are: Bread, Milk, Banana = $2.00 Bread, Bread, Milk, Banana = $3.00 Milk, Banana, Milk, Banana = $2.00 As a next step: enhance the code to apply the below discounts and offers Buy one bread and get another bread for free Buy 3 Milk for the price of 2 Buy 2 Bananas and get one free First build a simplest solution to satisfy the first case alone. Then re-factor the code to extend it for 2nd step. The first step seems to be easy but when it comes to the second step, applying the proper OOAD principles and design patterns is challenging. I took a look at couple of related questions like this one. But it did not help much. Appreciate any suggestions on how to go ahead. The code I could come up for the first step is : ShoppingCartTest.java : public class ShoppingCartTest { ShoppingCart cart; @Before public void setUp(){ cart = new ShoppingCart(); } @Test public void addOneItemToCart() { cart.add("Bread"); assertThat(cart.getTotalItems(), is(1)); assertThat(cart.doesContain("Bread"), is(true)); } @Test public void addTwoItemsToCart(){ cart.add("Bread"); cart.add("Milk"); assertThat(cart.getTotalItems(), is(2)); assertTrue(cart.doesContain("Bread")); assertTrue(cart.doesContain("Milk")); } @Test public void addThreeItemsToCart(){ cart.add("Bread"); cart.add("Milk"); cart.add("Banana"); assertThat(cart.getTotalItems(), is(3)); assertTrue(cart.doesContain("Bread")); assertTrue(cart.doesContain("Milk")); assertTrue(cart.doesContain("Banana")); } @Test public void addAnItemTwice(){ cart.add("Bread"); cart.add("Bread"); assertThat(cart.getTotalItems(), is(2)); } @Test publi…
type: UnansweredQuestion
has title: How to design the classes for a simple shopping cart example using TDD approach?
upvote count: 1
has comment: http://stackoverflow.com/comment/41340359
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/41626816
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/5825619

http://stackoverflow.com/comment/40790373
score: 2
comment on: http://stackoverflow.com/q/26039862
type: QuestionComment
type: Comment
has text: You are not providing enough details to help you. What kind of application is this? what is your Spring configuration? can we take a look at a piece of code where you are having the problem?

http://stackoverflow.com/q/26099616
upvote count: 2
has comment: http://stackoverflow.com/comment/40902183
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40900114
has answer: http://stackoverflow.com/a/26099765
has comment: http://stackoverflow.com/comment/40899830
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26099811
downvote count: 1
has body: How do I throw an checked exception preventing compiling the code if one of my Enum constant name lenght is greater than 10 characters ?
type: Question
tagged with: enums
answer count: 2
has comment: http://stackoverflow.com/comment/40902197
has comment: http://stackoverflow.com/comment/40899764
favorite count: 0
has title: Throw checked exception when Enum constant name length is greater than 10 characters?
has comment: http://stackoverflow.com/comment/40900021

http://stackoverflow.com/comment/40968466
type: Comment
type: QuestionComment
has text: @AbhijitKalamkar In my particular case Service Account Number has already been generated automatically. The error gone for me when I updated my project to AppEngine SDK 1.9.12
comment on: http://stackoverflow.com/q/26102319
score: 0

http://stackoverflow.com/a/52499921
downvote count: 0
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/93564418
has body: Those who are getting "EXECUTION FAILURE" on running sonar-runner in the project folder add -Dproject.settings=./sonar-project.properties As it can't able to find setting file, you have to mention it explicitly sonar-project.properties is the file name in my project where I have gave projectKey, projectName For me, Run sonar runner with the above mentioned argument. Sonar runner was there in the folder path sonar-plugin\agent\sonar-plugin-agent\sonar-qube-runner\bin\sonar-runner or add it in environment path sonar-runner -Dproject.settings=./sonar-project.properties
answers question: http://stackoverflow.com/q/26092773
type: Answer
has comment: http://stackoverflow.com/comment/93659806

http://stackoverflow.com/comment/40949534
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26126657
has text: You could also just save the powerpoint as a `.pps` file. That would open into a show automatically.
score: 0

http://stackoverflow.com/a/26135179
accepted answer of: http://stackoverflow.com/q/26134896
has body: Here is an example of a local branch: void foo() { if (someCondition) { doSomething(); } else { doSomethingElse(); } } The branching is quite forward to understand, right? The reason for this simplicity is that all branching logic is defined within foo. Locally, so to speak. This means, a condition is checked and its path is taken depending on someCondition but the branching does not escape foo. By only looking at this one method, you know how the code flow might look like. Now think of this less-readable implementation: void foo() { if(bar()) { // branch is handled by bar } else { doSomethingElse(); } } boolean bar() { if(somethingWrong) { return false; } doSomething(); } This is less readable. But why is that? If you are calling a method bar from foo, the control flow is handled by bar. bar might however do something unexpected and still rely on foo to handle this unexpected condition. This is not a good practice as you distribute connected logic among foo and bar where a change at one place might cause a misbehavior at another place. This is somewhat what exceptions do if they are treated too far down the stack. You can even extend the complexity of the above example by adding more intermediate methods. Therefore, the book suggests, to keep branching locally as this often is more human readable and traceable what I would equally suggest as a good idea. Look at this exception-based implementation of the above code to visualize this more: void foo() { try { bar() } catch(SomeException e) { doSomethingElse(); } } boolean bar() { if(somethingWrong) { throw new SomeException(); } doSomething(); } Obviously, this distributed branch is more error-prone than an if-else statement.
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40964878
has comment: http://stackoverflow.com/comment/40964964
has comment: http://stackoverflow.com/comment/40964717
upvote count: 5
answers question: http://stackoverflow.com/q/26134896
type: Answer

http://stackoverflow.com/comment/40824993
type: AnswerComment
has text: @ent30 Yes, Actionbarsherlock library is required to add.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26058676

http://stackoverflow.com/comment/40952495
type: Comment
comment on: http://stackoverflow.com/q/26128352
type: QuestionComment
has text: its actually not returned, it just doesnt display anything
score: 0

http://stackoverflow.com/q/26136711
has comment: http://stackoverflow.com/comment/40975939
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40974285
has title: error-page tag not rendering appropriate error page when request comes as forward
has comment: http://stackoverflow.com/comment/40974887
tagged with: servlets
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40969802
tagged with: web.xml
has comment: http://stackoverflow.com/comment/40971057
tagged with: ofbiz
has comment: http://stackoverflow.com/comment/40971360
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40971521
has answer: http://stackoverflow.com/a/26217174
accepted answer: http://stackoverflow.com/a/26217174
tagged with: java
has body: I have an application and so web.xml. In web.xml I configured error page as below 404 /error/err404.jsp The above thing works perfectly for a uri that is not exists in web.xml. For Eg: 1. localhost:8080/appName/testServlet (Exists in web.xml) 2. localhost:8080/appName/testServletXXX (Not exists) Both urls work perfectly(first url renders actual page, second url renders err404.jsp) when I enter urls directly on browser. When I forward the request to uri "testServlet ", it works fine as it exists in web.xml. The problem comes when the uri(testServletXXX) is not exist in web.xml. If uri is not exists in web.xml, it is not rendering err404.jsp instead it is rendering error: HTTP Status 404 - /appName/xxxx type Status report message /appName/xxxx description The requested resource is not available. Apache Tomcat/7.0.32 which is from tomcat. Below is the code for forwarding request. ServletContext scRoot = getServletConfig().getServletContext().getContext("/appName"); rd = scRoot.getRequestDispatcher("testServlet"); rd.forward(request, response); Why the error-page is not rendering err404 page for the uri that is not exist in web.xml. It is happening especially in forwarding case. Am not able to figure it out. Did I miss any concept/ logic. Appreciate any help. Thanks in advance.

http://stackoverflow.com/q/26085361
score: 0
has answer: http://stackoverflow.com/a/26085490
answer count: 1
tagged with: superscript
type: UnansweredQuestion
has title: How to put characters beyond 9 in superscript in java?
tagged with: binomial-theorem
has body: So I am making a program in Java on a BlueJ environment that computes Binary expansion. However, I can't seem to figure out how to add powers more than 9 in the output. If I have an input power of anything more than 9 the program goes haywire, presumably because there are no cases after 9. Also, I personally feel my program in general is extremely inefficient but I just did it this morning and this was the first approach I saw, so if you see a way to make it more efficient than using switch case, that'd be great too. This is my code so far. It's not all mine, but I'm not sure if intellectual property and stuff applies on here, so just putting it out there. import java.util.*; class Binomial_Theorem_Expansion { public static void main(String args[]) { Scanner s=new Scanner(System.in); System.out.println("Enter the value of x in (x+a)^n"); int x=s.nextInt(); System.out.println("Enter the value of a in (x+a)^n"); int a=s.nextInt(); System.out.println("Enter the value of n in (x+a)^n"); int n=s.nextInt(); System.out.println ("The expanded answer is"); int r=0; int powx=n; while (r&lt;=n) { long nCr=calculatenCr(n,r); if(nCr!=-1) { double y=Math.pow((double)x,(double)n-r); double z=Math.pow((double)a,(double)r); switch (powx) { case 0: System.out.print ("("+nCr*y*z); break; case 1: System.out.print ("("+nCr*y*z+"x"); break; case 2: System.out.print ("("+nCr*y*z+"x\u00B2"); break; case 3: System.out.print ("("+nCr*y*z+"x\u00B3"); break; case 4: System.out.print ("("+nCr*y*z+"x\u2074"); break; case 5: System.out.print ("("+nCr*y*z+"x\u2075"); break; case 6: System.out.print ("("+nCr*y*z+"x\u2076"); break; case 7: System.out.print ("("+nCr*y*z+"x\u2077"); break; case 8: System.out.print ("("+nCr*y*z+"x\u2078"); break; case 9: System.out.print ("("+nCr*y*z+"x\u2079"); break; case 10: System.out.print ("("+nCr*y*z+"x\u2071\u00B2"); break; } switch (r) { case 0: System.out.print (")"); break; case 1: System.out.print ("y"+")"); break; case 2: System.out.print ("y\u00B2"+")"); …
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/40877125
type: Question

http://stackoverflow.com/comment/40835735
score: 0
type: Comment
has text: I'll test on monday but was also thinking that direction. Accept and vote will follow on monday if correct.
comment on: http://stackoverflow.com/a/26062293
type: AnswerComment

http://stackoverflow.com/q/26110068
answer count: 1
tagged with: directory
has title: Why can I not rename the directory of my file?
has answer: http://stackoverflow.com/a/26110123
accepted answer: http://stackoverflow.com/a/26110123
type: AnsweredQuestion
tagged with: java
tagged with: filewriter
type: Question
has body: I have a directory that is the name of a "fullName" if the full name is updated, I want to update the directory name as well. How can I rename the directory? Here is my code so far: try { System.out.print("Enter new first name: "); firstName = sc.nextLine(); File fileLN = new File(fullName + "\\lastName.txt"); FileReader fr = new FileReader(fileLN); BufferedReader br = new BufferedReader(fr); lastName = br.readLine(); // set new full name newFullName = firstName + lastName; System.out.println(newFullName); // debug File file = new File(fullName); File newFile = new File(newFullName); if(file.isDirectory()) { file.renameTo(newFile); System.out.println("worked"); //debug } else { System.out.println("Directory not found"); } } catch(IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/40919141
tagged with: rename
score: 0

http://stackoverflow.com/comment/40781039
comment on: http://stackoverflow.com/q/26034785
score: 0
type: Comment
type: QuestionComment
has text: What is `d. findInLine`?

http://stackoverflow.com/a/26088350
has body: According to the openrocket site, running is as simple as java -jar OpenRocket-14.06.jar. Do note, though that the Sun runtime is recommended. Indeed, I just verified the command on my system.
answers question: http://stackoverflow.com/q/26088209
score: 0
type: Answer

http://stackoverflow.com/a/26132803
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26132721
has body: Another complete solution : import java.io.File; import java.io.IOException; public class Programme { public static void main(String[] args) { String yourDesktopPath = System.getProperty("user.home") + "\\Desktop\\"; try { File file = new File(yourDesktopPath + "temperatures.txt"); if (file.createNewFile()) { System.out.println("File is created!"); } else { System.out.println("File already exists."); } } catch (IOException e) { e.printStackTrace(); } } }

http://stackoverflow.com/comment/40806854
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26048551
type: QuestionComment
has text: nothing happens, it doesn't create txt but on cmd works fine

http://stackoverflow.com/comment/40975451
score: 0
has text: I took a small peak at the source code, but it seams non-trivial to support something like what you are asking. Of course I am no expert on Spring internals so I might be missing something obvious
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26137932

http://stackoverflow.com/q/26109258
upvote count: 2
has answer: http://stackoverflow.com/a/26115680
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/26115680
has answer: http://stackoverflow.com/a/26150685
tagged with: wowza
answer count: 2
has title: My module is stopping my Wowza application from loading because of required dependencies
downvote count: 0
favorite count: 0
has body: Local - Wowza Streaming Engine 4.1.0, Windows 8, Java version 1.7.0_67 Server - The Wowza Streaming Engine AMI here. Java version 1.7.0_65 I have Wowza running locally and on an EC2 instance. Locally it works fine and I can connect and publish streams to my application without a problem. I cannot connect or publish streams to the application on my server, however. I removed the .jar (module) that went with the application, and I was able to connect and publish to my app, though it gave me a warning that it couldn't find the associated module, which was to be expected. I put the module back in, restarted the server, and I was unable to connect. It appears that my .jar file is stopping the application from loading for some reason. Here's the source for my module: package com.xxxxxxxxxxxxxxx.recorder; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.S3ClientOptions; import com.amazonaws.services.s3.model.CannedAccessControlList; import com.amazonaws.services.s3.model.PutObjectRequest; import com.wowza.wms.application.*; import com.wowza.wms.amf.*; import com.wowza.wms.client.*; import com.wowza.wms.module.*; import com.wowza.wms.request.*; import com.wowza.wms.stream.*; import com.wowza.wms.rtp.model.*; import com.wowza.wms.httpstreamer.model.*; import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*; import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*; public class RecorderModules extends ModuleBase implements AWSCredentialsProvider { IApplicationInstance appInstance; private String videoBucket; private String thumbBucket; private String vid…
accepted answer: http://stackoverflow.com/a/26150685
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/26173083
has answer: http://stackoverflow.com/a/26173118
accepted answer: http://stackoverflow.com/a/26173532
answer count: 3
tagged with: sql
tagged with: jpa
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/24452376
has body: I am using UCanAccess and was setting up my Entities and Persistence Unit when I realized that the DB location is hard coded into the PU.xml (which is fine to build my entities, but I need to have it variable). I am creating an application that will be given to people that will need to access their own db's, but this is a random path. I am curious how exactly I would be able to change the information in the PU? The only way I can think of is somhow editing the xml file, or creating the xml file on the fly. Anyone have any idea how I can do this? It's simple using regular java.sql commands, so I would expect it to work easy with JPA as well. thanks all!
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26173104
has answer: http://stackoverflow.com/a/26173532
has title: How to use JPA with a random database i.e., user submitted
possible better answer: http://stackoverflow.com/a/26173104

http://stackoverflow.com/a/26192007
has comment: http://stackoverflow.com/comment/41070116
type: AcceptedAnswer
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/26191909
upvote count: 4
has comment: http://stackoverflow.com/comment/41070022
answers question: http://stackoverflow.com/q/26191909
downvote count: 0
has comment: http://stackoverflow.com/comment/41070140
has body: You'll get a StackOverflowError if you try to initialize one of the classes, since the initializer of KindA creates a new object of type KindB and therefore the initializer of KindB runs, which creates a new object of type KindA and KindA's initializer runs again, which creates and initializes a new object of type KindB and so on ... This is a infinite recursion, therefore the stackoverflow.

http://stackoverflow.com/comment/41023033
comment on: http://stackoverflow.com/q/26166542
type: Comment
type: QuestionComment
score: 1
has text: Do you mean "why can't I place *more than one* statement following an "else if" statement? The answer is that you can, but you have to mark the statements as a block by enclosing them within curly braces { }. if statements only support a single following statement by default in the absence of a curly brace marked block.

http://stackoverflow.com/q/26180919
tagged with: java
has answer: http://stackoverflow.com/a/26181474
has comment: http://stackoverflow.com/comment/41049612
type: Question
has comment: http://stackoverflow.com/comment/41049505
has answer: http://stackoverflow.com/a/26181029
has title: Decrease number length by rounding in java
has comment: http://stackoverflow.com/comment/41049638
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41049552
has body: There's a functionality in my project that does a multiplication of 3 different big decimals. Sometimes, the result could give some really large numbers like: 213215648783612154.334 or 421342342342342344.123 The thing is: the column which keeps record of this value is defined like NUMBER(8,3). Is there a way to decrease the length of this number by doing some rounding operations? I really don't want to redefine the column because it's being used in other parts of the system.
favorite count: 0
has comment: http://stackoverflow.com/comment/41049479
has comment: http://stackoverflow.com/comment/41049542
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26181110

http://stackoverflow.com/comment/40944423
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26123638
has text: @Biffen so you think that if I do something like this it will work? http://stackoverflow.com/questions/3283234/http-basic-authentication-in-java-using-httpclient

http://stackoverflow.com/q/26174551
answer count: 1
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26174704
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have a large image and I want to print it inside my PDF document, I am writing the follows: InputStream in = new FileInputStream(new File("C:/mylargeimage.jpg")); PDJpeg img = new PDJpeg(doc, in); img.setHeight(100); img.setWidth(100); contentStream.drawImage(img,50,pageYaxis); I am getting the image printed but the image getting blurred and not getting the full image inside. I needed the image to be resized 100X100. How can I overcome this? Please help me guys?? I had refereed a lot but nothing is clear.
tagged with: pdfbox
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/41066862
has title: Pdf image resized getting blurred only getting partial in pdfbox
accepted answer: http://stackoverflow.com/a/26174704
downvote count: 0
has comment: http://stackoverflow.com/comment/41038060

http://stackoverflow.com/a/26191937
score: 2
downvote count: 0
has body: As the ActorRef is just a proxy to the implementation it doesn't give you the information you need. The way I manage this is to store a reference to the actors I create in the supervisor which indicates the type. There are various ways you could do this, one approach I've used is to store the ActorRef's in a Map. You can then use the Terminated ActorRef to get the value from the Map that tells you what type it was. Alternatively just create internal properties on the UntypedActor to hold the refs then check one until you find a match and recreate it.
answers question: http://stackoverflow.com/q/26191161
has comment: http://stackoverflow.com/comment/41069877
upvote count: 2
has comment: http://stackoverflow.com/comment/41070064
type: Answer

atomic
type: Tag
tags question: http://stackoverflow.com/q/26125723
tag name: atomic
tags question: http://stackoverflow.com/q/26111014
tags question: http://stackoverflow.com/q/26167150

http://stackoverflow.com/q/26165386
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/41021050
score: 0
possible better answer: http://stackoverflow.com/a/26165478
answer count: 2
has body: I am going to produce some text files(number of files is entered by user) using a for loop, but when the program runs only one file is produced because the file name doesn't change. I don't know how to change the names of file every time. my code is below which produces only one text file not as many as the user enters. Scanner sc = new Scanner(System.in); int p1 = sc.nextInt(); for (int i = 0; i &lt; p1; i++) { try { FileWriter f = new FileWriter("textfile.txt"); f.close(); } catch (IOException e) { e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/26165478
has answer: http://stackoverflow.com/a/26165457
accepted answer: http://stackoverflow.com/a/26165457
has comment: http://stackoverflow.com/comment/41020933
has title: producing some text file using a for loop in java?
tagged with: text-files
type: AnsweredQuestion
tagged with: java
tagged with: filewriter

http://stackoverflow.com/q/26180862
tagged with: java1.4
has title: Getting a value from a map (Using Java 1.4)
type: Question
has answer: http://stackoverflow.com/a/26180903
has comment: http://stackoverflow.com/comment/41049361
has comment: http://stackoverflow.com/comment/41050051
score: 0
answer count: 1
has body: I am currently working on some old legacy application, and must use Java 1.4 which has been EOL for several years now. I need to get a value from a map. My map looks like this: Key | Value --------------- String1 | int1 String2 | String6 String3 | Float1 String4 | String7 String5 | Object1 I tried the following, but I keep getting a null String myVal = (String) map.get(String2); Is it possible to get a value without using an Iterator?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41049385
accepted answer: http://stackoverflow.com/a/26180903
tagged with: java

http://stackoverflow.com/comment/40894448
comment on: http://stackoverflow.com/q/26095954
score: 0
type: QuestionComment
has text: @Rei - *yann's* solution will work if you are *holding* the key. My solution is for just one press.
type: Comment

http://stackoverflow.com/comment/40945372
score: 0
type: Comment
has text: I'm using Java JDK 1.6 and it's only java.
type: QuestionComment
comment on: http://stackoverflow.com/q/26124423

http://stackoverflow.com/q/26184696
has comment: http://stackoverflow.com/comment/41057285
has comment: http://stackoverflow.com/comment/41057476
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41056791
has title: Opening The Downloads Folder Of The Windows File Explorer
tagged with: jbutton
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41057794
has comment: http://stackoverflow.com/comment/41057513
has comment: http://stackoverflow.com/comment/41056865
has comment: http://stackoverflow.com/comment/41057755
has body: I'm making a little program that when a jButton is clicked, it opens the downloads folder from the file explorer. I have the button set up, I'm just having troubles getting the folder open. Here is my code. private void downloadsActionPerformed(java.awt.event.ActionEvent evt) { String download = System.getenv("downloads"); File downloadsDir = new File(download); try { Desktop.getDesktop().open(downloadsDir); } catch (IOException ex) { Logger.getLogger(GettingFile.class.getName()).log(Level.SEVERE, null, ex); } }
has comment: http://stackoverflow.com/comment/41057546

http://stackoverflow.com/comment/41049881
type: QuestionComment
comment on: http://stackoverflow.com/q/26181063
has text: if it was me I would have a map<String,Order> where String is the orderId, then get the order/orderId(depending on what you want to show) by using orderID.
score: 0
type: Comment

http://stackoverflow.com/q/26127257
upvote count: 1
answer count: 1
has title: How to take gallery image as input stream
tagged with: image
has answer: http://stackoverflow.com/a/26128911
has body: I am trying to read image from gallery and then use that image for input straming , below is my code @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mGetImageButton = (Button) findViewById(R.id.button_getImage); mGetImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // SET action AND miniType Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setType("image/*"); // REQUEST Uri of image startActivityForResult(intent, REQUEST_IMAGE); } }); mImageViewForGallery = (ImageView) findViewById(R.id.imageView2); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) {return;} if (requestCode == REQUEST_IMAGE) { Uri uri = data.getData(); // SET image mImageViewForGallery.setImageURI(uri); Drawable drawable = mImageViewForGallery.getDrawable(); InputStream is; is = this.getResources().openRawResource(R.drawable.img1); Bitmap bmInImg = BitmapFactory.decodeStream(is); } } In above code is = this.getResources().openRawResource(R.drawable.img1); is reading image from drawable folder name img1 , but now my image is the image I select from gallery , How I can take that image as input stream, as I tried it like InputStream is; is=uri; But its showing error , well am new to java from c++. Edit, after @Shawn answer I put this code in onActivityResult function after line Drawable drawable = mImageViewForGallery.getDrawable(); : InputStream is = this.getContentResolver().openInputStream(uri); Bitmap bmInImg = BitmapFactory.decodeStream(is); InputStream Vign = this.getResources().openRawResource(R.drawable.p); Bitmap bmInImg2 = BitmapFactory.decodeStream(Vign); mPhotoIntArray = new int[bmInImg.getWidth() * bmInImg.getHeight()]; nPhotoIntArray = new int[bmInImg.getWidth() * bmInImg.getHeight()]; vPhotoIntArray …
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/26128911
tagged with: java

http://stackoverflow.com/q/26101159
has comment: http://stackoverflow.com/comment/40902924
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40904460
has answer: http://stackoverflow.com/a/26107736
has comment: http://stackoverflow.com/comment/40903352
has comment: http://stackoverflow.com/comment/40911686
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40904178
has comment: http://stackoverflow.com/comment/40903282
has comment: http://stackoverflow.com/comment/40903125
has comment: http://stackoverflow.com/comment/40913161
type: Question
has comment: http://stackoverflow.com/comment/40903034
has body: I have been able to set up a connection between my socket server (running on ruby) and my client, which is an Android(java) application. I will explain what my goal is. I have to send a string to my server through the socket. Depending on the contents of the string, the server would execute a process in the database (store, delete, view data, etc). The first option is to validate the user name/password. Im able to send the correct string, and the server receives it and replies back to me with the correct response (after validating whether or not my username is capable of logging into the application). Now, depending on this response i need to change the current activity (loginActivity) with the next activity (MenuActivity) so that the user can proceed to use the application menu. Since the socket has to run on a different thread other than the UIThread, im running it using the AsyncTask way. However im having problems triggering the activity change thing after the AsyncTask process is over. What im doing is, after the whole Async task is done (onPostExecute method) im trying to call up the activity, but its not working. This is what i've tried (based on similar cases i've found during research): (AsyncTask class) Context context; private void AppContext(Context context) { this.context = context.getApplicationContext(); } OnPostExecute Intent NewActivity = new Intent(); NewActivity.setClass(context.getApplicationContext(),MainActivity.class); context.startActivity(NewActivity); However this is not working and its causing my app to crash with a "thread exciting with uncaught exception" I've tried showing only a Toast message that says "Granted" or "Denied" just to test it with a simpler task, but i keep getting the same error so im assuming its got to do with handling the change between the thread on which the Async task is running and the UI thread. Any ideas? P.S: I've checked the other questions that are similar to mine and tried the suggested code, but nothing's w…
has title: Async PostExecute
has answer: http://stackoverflow.com/a/26106438
has comment: http://stackoverflow.com/comment/40912755
answer count: 2
has comment: http://stackoverflow.com/comment/40904396
has comment: http://stackoverflow.com/comment/40903831

http://stackoverflow.com/comment/40989459
type: AnswerComment
comment on: http://stackoverflow.com/a/26134187
score: 0
type: Comment
has text: @iali87: so to answer your "second approach" -- I wouldn't do it that way, I'd do it the way outlined in my answer above.

android-spinner
tags question: http://stackoverflow.com/q/26039322
type: Tag
tag name: android-spinner

http://stackoverflow.com/a/26149322
answers question: http://stackoverflow.com/q/26137824
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40991967
has comment: http://stackoverflow.com/comment/40991259
score: 0
has body: Could you try adding an @Produces annotation to your resource, e.g. @Produces(MediaType.APPLICATION_JSON), either above the specific method or on the whole class and see if that works? I think I've just stubled across the same thing. If it is the case it means that Dropwizard can't determine the MessageBodyWriter to use for a response of that tupe (I think)
accepted answer of: http://stackoverflow.com/q/26137824
type: Answer

final
tags question: http://stackoverflow.com/q/26088769
tags question: http://stackoverflow.com/q/26077935
tags question: http://stackoverflow.com/q/26042833
type: Tag
tag name: final

http://stackoverflow.com/comment/41077419
comment on: http://stackoverflow.com/a/26168786
score: 0
type: AnswerComment
type: Comment
has text: super(new TypeToken<T>(getClass())) ?

http://stackoverflow.com/q/26074642
tagged with: android
has answer: http://stackoverflow.com/a/26075085
tagged with: java
type: Question
has title: Update Available message appears automatically - android
score: 0
answer count: 1
has body: May I ask you a question? I built an android application but it's not on google play store. I would like to add an update alert message there so i try WVersionManager - https://github.com/winsontan520/Android-WVersionManager. It clearly run in test but nothing happened after clicking "Update Now" button. The main problem is where can i add my application apk link - I uploaded update_content_json_format.txt and it worked well. That text file is only for the update information - {"version_code":2,"content":"Version 2.0 New features: Added feature A Added feature B Added feature C Added feature D Added feature E Added feature F Added feature G "} please point me where can i add my update application apk link which is not from playstore. -- or -- According to the idea, I would like to know how to show update available dialog box automatically whenever I open the application. Thank you very much! With Regards,
type: UnansweredQuestion

http://stackoverflow.com/comment/41064867
type: QuestionComment
has text: I believe what you're asking about is called "hotswapping".
comment on: http://stackoverflow.com/q/26188915
score: 0
type: Comment

http://stackoverflow.com/q/26083545
favorite count: 0
possible better answer: http://stackoverflow.com/a/26083618
has answer: http://stackoverflow.com/a/26083618
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40870767
tagged with: java
accepted answer: http://stackoverflow.com/a/26083562
type: Question
upvote count: 4
has body: In this question the output gives as Rose0. But when I go through the logic I feel the answer must be Rose100 instead of Rose0. How does compiler differentiate the i s in both classes. Since Rosea extends _39 class it has the super class i as well. But in line 1 if I change super.i then Im getting Rose100. How this differs? class _39 { int i; _39(){ i=100; foo(); } public void foo(){ System.out.println("Flower"+i);} } } public class Rosea extends _39{ int i=200; Rosea(){ i=300; } public void foo(){ System.out.println("Rose"+i); } //line 1 public static void main(String[] args) { new Rosea(); } }
linked to: http://stackoverflow.com/q/10580
answer count: 2
downvote count: 0
score: 4
has title: Having a same variable in both sub and super classes
has answer: http://stackoverflow.com/a/26083562

http://stackoverflow.com/q/26080646
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26086053
has title: Supply value to Observable
has answer: http://stackoverflow.com/a/26086053
has answer: http://stackoverflow.com/a/26083988
accepted answer: http://stackoverflow.com/a/26083988
score: 0
has body: I am new to rxjava and I have the following problem: Objects are irregularly dropped into a FIFO queue by an outside system. I need an Observable which runs every second, takes an item from the queue (if there is one) and emits it to subscribers. Two problems: The queue items are produced while the Observable is alive, it is not possible to provide all items upfront. The queue may run empty, in which case the Observable must standby and not emit anything. (It would be nice if the Observable would jump-start immediately when an item becomes available in the queue after a pause, but then the queue would probably need to be an Observable as well if we don't want to poll more frequently, no idea how.) It must be possible for the outside system to complete the Observable. I could set a variable and read it from within the Observable, but I'd like to know if there is a more elegant way to do that. LinkedList&lt;Layer&gt; queue = new LinkedList&lt;Layer&gt;(); // the queue boolean stopObservable = false; // the variable to stop the observable Observable.create(new Observable.OnSubscribe&lt;Layer&gt;() { @Override public void call(Subscriber&lt;? super Layer&gt; subscriber) { try { if (!queue.isEmpty()) { Layer layer = queue.poll(); subscriber.onNext(layer); } else { if (stopObservable) { subscriber.onCompleted(); } } } catch (Exception e) { subscriber.onError(e); } } }).somethingThatCreatesTheInterval().subscribeOnEtc. For the interval, I cannot use .sample(), because it drops items, and it is important that all items are emitted. .throttleWithTimeout() looks better, but it also seems to drop items. rx is very cool, but tough to get into. Any input appreciated.
tagged with: rx-java
has comment: http://stackoverflow.com/comment/40870514
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40870624

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/26067882
type: Tag

http://stackoverflow.com/comment/111716662
comment on: http://stackoverflow.com/a/26164155
type: Comment
score: 1
type: AnswerComment
has text: Sorry, my Java skill is to weak.The second `Either` class, where I do not have a field. How can I decide that a object is Left or Right?

http://stackoverflow.com/a/26075479
upvote count: 2
answers question: http://stackoverflow.com/q/26075366
type: Answer
score: 2
has body: In order to close pop up window automatically, you have to set new thread and set timer in it. Try code below public class FrmPopUpInfo extends JDialog{ public boolean isCancel = false; private String trackHeader = "Pop Up is:"; private final String message; public FrmPopUpInfo(String message){ this.message = message; initComponents(); } private void initComponents() { Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();// size of the screen Insets toolHeight = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());// height of the task bar setLocation(scrSize.width - 275, scrSize.height - toolHeight.bottom - 120); ImageIcon image; setSize(225,120); setLayout(null); setUndecorated(true); setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 1.0f; constraints.weighty = 1.0f; constraints.insets = new Insets(5, 5, 5, 5); constraints.fill = GridBagConstraints.BOTH; JLabel headingLabel = new JLabel(trackHeader + message); image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(FrmPopUpInfo.class.getResource("/images/yourImage.jpg"))); headingLabel .setIcon(image); headingLabel.setOpaque(false); add(headingLabel, constraints); constraints.gridx++; constraints.weightx = 0f; constraints.weighty = 0f; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.NORTH; JButton cloesButton = new JButton(new AbstractAction("x") { @Override public void actionPerformed(final ActionEvent e) { dispose(); } }); cloesButton.setMargin(new Insets(1, 4, 1, 4)); cloesButton.setFocusable(false); add(cloesButton, constraints); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setVisible(true); setAlwaysOnTop(true); new Thread(){ @Override public void run() { try { Thread.sleep(5000); // time after which pop up will be disappeared. dispose(); } catch (InterruptedException e) { e.printStackTrace(); } }; }.start(); } } You…
downvote count: 0

http://stackoverflow.com/q/26101626
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26102088
has answer: http://stackoverflow.com/a/26101989
favorite count: 0
answer count: 3
tagged with: android
has body: I have a class with 6 async methods, each one should call a blocking method. (meaning, a blocking method is posted on a background thread, and the result is posted on the ui thread) I find my self writing the following code 6 times (1 per each async method), having only the blocking method and 'result' object type different. mBackgroundThreadHandler.post(new Runnable() { @Override public void run() { final String result = myBlockingMethod(); mUIHandler.post(new Runnable() { @Override public void run() { //use result on UI thread } }); } }); mBackgroundThreadHandler - a handler for a background thread mUIHandler - a handler for the ui thread Is there a "pretty" way to reuse this code?
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has title: Reuse code that performs async code and posts back to the UI thread
has answer: http://stackoverflow.com/a/26101985
score: 2
has comment: http://stackoverflow.com/comment/40903788

http://stackoverflow.com/q/26067350
linked to: http://stackoverflow.com/q/14106936
tagged with: encoding
score: 21
tagged with: ascii
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26067568
has comment: http://stackoverflow.com/comment/40841658
has comment: http://stackoverflow.com/comment/40841559
tagged with: utf-8
type: AnsweredQuestion
tagged with: java
has title: Unmappable character for encoding ASCII but my files are in UTF-8
upvote count: 21
has body: I have the following error launching my ant script: [javac] /****/TextUtils.java:25: error: unmappable character for encoding ASCII But this file is encoded in UTF-8, if i do the info command: /***/TextUtils.java: text/plain; charset=utf-8 Why is this file compiled in ASCII and not in utf-8? I tried to force the encoding in utf-8 on the javac command in my ant build file but without success
type: Question
accepted answer: http://stackoverflow.com/a/26067568

http://stackoverflow.com/comment/40898223
type: QuestionComment
has text: Just commenting on the `\\d+` regex...
comment on: http://stackoverflow.com/q/26098604
score: 0
type: Comment

http://stackoverflow.com/q/26161174
answer count: 1
has comment: http://stackoverflow.com/comment/41013902
has comment: http://stackoverflow.com/comment/41013362
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/41012720
linked to: http://stackoverflow.com/q/4967885
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26161679
has comment: http://stackoverflow.com/comment/41012530
has body: In other words -- with 1MB stacks (-Xss1m), do you actually bump your RSS by 1M every time you create a thread, or do you just consume 1MB of VSZ, plus a few actual pages top and/or bottom? In other, other words, on 64b systems, and assuming it does the right thing (just map), is there any real downside to large (say, 10MB) "just-in-case" stacks?
tagged with: java
has comment: http://stackoverflow.com/comment/41055222
has title: Does the JVM just map stack pages?
type: Question
has comment: http://stackoverflow.com/comment/41013000

http://stackoverflow.com/q/26045702
has comment: http://stackoverflow.com/comment/40865866
has title: Camel http component does not close connections - Close_Wait
has comment: http://stackoverflow.com/comment/40804957
tagged with: apache-camel
upvote count: 7
answer count: 1
has comment: http://stackoverflow.com/comment/40804877
has comment: http://stackoverflow.com/comment/40819374
favorite count: 0
has answer: http://stackoverflow.com/a/58740606
type: UnansweredQuestion
downvote count: 0
score: 7
tagged with: java
has body: Camel http component does not close connections properly? Having below route I have observed that connections are being created on the server, but not terminated. After a while this is causing a problem java.io.IOException: Too many open files route: from("seda:testSeda?concurrentConsumers=20") .setHeader("Connection", constant("Close")) .to("http://testServer/testFile.xml?authMethod=Basic&amp;throwExceptionOnFailure=false&amp;authUsername=user&amp;authPassword=password") .to("file://abc") .end(); connections are in Close_Wait state any ideas? I am using camel-http lib in version 2.14
has comment: http://stackoverflow.com/comment/83342723
type: Question

http://stackoverflow.com/comment/40920998
score: 0
type: QuestionComment
has text: They want me to change my checking method to a double I/O a string. When I do that my parseDouble in the checker wants me to change it back to a string
type: Comment
comment on: http://stackoverflow.com/q/26111046

http://stackoverflow.com/comment/41045696
has text: For syntax parsing, regex is not the best tool. It's likely to be feasible in your case, but very fragile. You should implement your own parser.
score: 1
comment on: http://stackoverflow.com/q/26179049
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26105606
has comment: http://stackoverflow.com/comment/40912399
has comment: http://stackoverflow.com/comment/40911129
has body: I don't think the logic you are using is correct. I suppose the code for arranging 5 int variables in decending order will be Assume that the variables are initialized and assigned int max; int temp; for(int i=1 ; i&lt;=4 ; i++) { if(i==1) { max=n1; } if(i==2) { max=n2; } if(i==3) { max=n3; } if(i==4) { max=n4; } for(int j=i+1 ; j&lt;=5 ; j++) { if(j&lt;=2) { if(n2&gt;max) { temp=n2; n2=max; max=temp; } } if(j&lt;=3) { if(n3&gt;max) { temp=n3; n3=max; max=temp; } } if(j&lt;=4) { if(n4&gt;max) { temp=n4; n4=max; max=temp; } } if(j&lt;=5) { if(n5&gt;max) { temp=n5; n5=max; max=temp; } } } if(i==1) { n1=max; } if(i==2) { n2=max; } if(i==3) { n3=max; } if(i==4) { n4=max; } } System.out.print(n1 + "," + n2 + "," + n3 + "," + n4 + "," + n5); Well..I am basically using Selection Sort here.
upvote count: 1
answers question: http://stackoverflow.com/q/26104767
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26059493
has answer: http://stackoverflow.com/a/26060067
score: 1
has comment: http://stackoverflow.com/comment/40827517
tagged with: java
possible better answer: http://stackoverflow.com/a/26059906
has title: text entered in an edittext vanishes on newer android versions when the text has a condition
upvote count: 1
linked to: http://stackoverflow.com/q/3349121
has comment: http://stackoverflow.com/comment/40827561
has answer: http://stackoverflow.com/a/26059906
type: Question
accepted answer: http://stackoverflow.com/a/26060370
answer count: 3
downvote count: 0
has body: I am working on a project where in certain edittexts i want it to contain only alphabets(both small and caps) and white spaces.So i set it dynamically in code as follows: txtoccupation.setFilters(new InputFilter[] { new InputFilter() { public CharSequence filter(CharSequence src, int start, int end, Spanned dst, int dstart, int dend) { if(src.equals("")){ // for backspace return src; } if(src.toString().matches("[a-zA-Z ]+")){ return src; } return ""; } } }); The above code works fine in my older android 2.6 phone.That is , when i type in anything other than alphabets and white spaces it wont be shown on the edittext.But when i try the above on a new kitkat device, the text disappears and is shown in the suggestions below.How do i fix this issue? EDIT: I used an input filter filter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i &lt; end; i++) { if (!Character.isLetter(source.charAt(i))&amp;&amp;!Character.isWhitespace(source.charAt(i))) { return ""; } if(Character.isWhitespace(source.charAt(i))){ return " "; } } return null; } };
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26060370

http://stackoverflow.com/q/26076595
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26076637
tagged with: parsing
accepted answer: http://stackoverflow.com/a/26076637
has title: Java SimpleDatetime parse
possible better answer: http://stackoverflow.com/a/26082623
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26082623
tagged with: simpledateformat
tagged with: java
tagged with: date
type: Question
has body: Maybe i'm just missing the obvious, but I can't get SimpleDateTimes parse() method to work: I want to parse dates like June 19, 2011. So, according to the documentation: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html for my needs it should be: M: Month in year. If the number of pattern letters is 3 or more, the month is interpreted as text; --> MMM d: Day in month. For parsing, the number of pattern letters is ignored unless it's needed to separate two adjacent fields --> d y: Year. For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. --> yyyy but with SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy"); Date d = sdf.parse("June 19, 2011"); I'll always get java.text.ParseException: Unparseable date: "June 19, 2011" Where am I thinking wrong? :)

http://stackoverflow.com/comment/40913161
type: QuestionComment
has text: I just dont understand why its context coming up null all the time. I've tried declaring an object for the activity class (LoginActivity login) and pass login.getApplicationContext as a parameter for AppContext and it keeps coming up null.
comment on: http://stackoverflow.com/q/26101159
score: 0
type: Comment

http://stackoverflow.com/q/26062781
has answer: http://stackoverflow.com/a/27398901
answer count: 1
downvote count: 0
tagged with: shell
favorite count: 0
tagged with: root
tagged with: recovery
upvote count: 2
has body: I'm trying to build an app which will automatically reboot recovery and flash a zip from my sd card. This app can use system app permission since I am going to use it as a system app, How can I do this? I tried this code File zip = new File("/sdcard/test.zip"); if(zip.exists()) { Toast.makeText(context,"ZIP EXIST!",Toast.LENGTH_LONG).show(); Process p = Runtime.getRuntime().exec("sh"); OutputStream os = p.getOutputStream(); os.write("mkdir -p /cache/recovery/\n".getBytes()); os.write("echo 'boot-recovery' &gt;/cache/recovery/command\n".getBytes()); String cmd = "echo '--update_package=/sdcard/test.zip' &gt;&gt; /cache/recovery/command\n"; os.write(cmd.getBytes()); os.flush(); // Trigger the reboot PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); powerManager.reboot("recovery"); } else{ Toast.makeText(context,"ZIP NOT EXIST!",Toast.LENGTH_LONG).show(); } I also tried this code: Process p = Runtime.getRuntime().exec("/system/bin/sh"); OutputStream os = p.getOutputStream(); os.write("echo 'boot-recovery ' &gt; /cache/recovery/command".getBytes()); os.write("echo '--update_package=/sdcard/test.zip' &gt;&gt; /cache/recovery/command".getBytes()); os.write("echo '--wipe_cache' &gt;&gt; /cache/recovery/command".getBytes()); os.write("echo 'reboot' &gt;&gt; /cache/recovery/command".getBytes()); os.write("reboot recovery".getBytes()); os.flush(); PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); powerManager.reboot("recovery"); But all it does is to reboot recovery, it does not flash my zip. Please help. P.S I'm using android L on nexus 5 with TWRP recovery
type: UnansweredQuestion
tagged with: android
has title: How can I flash a zip programmatically from an app in android
score: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/40931168
score: 0
comment on: http://stackoverflow.com/q/26116765
type: Comment
type: QuestionComment
has text: @Tom stackoverflow editor is not showing it correctly.

http://stackoverflow.com/comment/40835070
type: QuestionComment
has text: Performance issues, I don't think so. Security issues, only if you go and distribute the dump to anyone who might be interesting in loading it and transversing all your objects (which might be storing some critical data, or not)
type: Comment
comment on: http://stackoverflow.com/q/26063607
score: 0

character-encoding
tags question: http://stackoverflow.com/q/26146456
tags question: http://stackoverflow.com/q/26102789
tag name: character-encoding
tags question: http://stackoverflow.com/q/26148732
tags question: http://stackoverflow.com/q/26034565
type: Tag
tags question: http://stackoverflow.com/q/26043808
tags question: http://stackoverflow.com/q/26113553
tags question: http://stackoverflow.com/q/26050143
tags question: http://stackoverflow.com/q/26179006

http://stackoverflow.com/q/26165776
downvote count: 0
linked to: http://stackoverflow.com/q/1524299
favorite count: 0
has answer: http://stackoverflow.com/a/26245370
possible better answer: http://stackoverflow.com/a/26235603
tagged with: android
has answer: http://stackoverflow.com/a/26235603
has body: I am trying to make a file transfer Bluetooth app work using these sources: http://developer.android.com/guide/topics/connectivity/bluetooth.html https://android.googlesource.com/platform/development/+/25b6aed7b2e01ce7bdc0dfa1a79eaf009ad178fe/samples/BluetoothChat/ When I attempt to get the InputStream bytes using InputStream.read() method this way: public class ConnectedThread extends Thread { ...(some code here) public void run(){ byte[] buffer = new byte[1024]; int bytes = -1; //Keep listening to the InputStream while connected while (true){ try { bytes = this.mmInStream.read(buffer); //* this part is not reached if (bytes==-1){ Log.d("NoData:","-1"); } } catch(Exception e){ Log.d("inStream exception:",e.getMessage()); break; } } } ...(some code here) } The next part of the code ("if" part in this case) is never reached, nor a Log.D debug output or whatever else I put in following. I just get this message from LogCat: BluetoothSocket read in: android.net.LocalStocketImpl$SocketInputStream@f7e b08 len: 1024 To transfer the data from the Client to the Server I am doing this: public class MainActivity extends Activity { ...(some code here) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); clientConnect(); //serverConnect(); } ...(some code here) public void clientConnect(){ Set&lt;BluetoothDevice&gt; devices; devices = bConfig.getPairedDevices(); if (devices == null){ return; } if (devices.size() &gt; 0) { BluetoothDevice device = devices.iterator().next(); ConnectThread connectTransmit = new ConnectThread(device,bConfig.getBluetoothAdapter(),BluetoothConfig.mUUID); connectTransmit.start(); Toast.makeText(this, "connected", Toast.LENGTH_SHORT).show(); socket = connectTransmit.mmSocket; ConnectedThread connectedThread = new ConnectedThread(socket); //write file bytes to the connected thread, so the thread can receive its own input written bytes later File file_to_transfer = new F…
has title: Bluetooth transfer App stops after using InputStream.read() with no error
tagged with: data-transfer
answer count: 4
accepted answer: http://stackoverflow.com/a/26171535
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26249424
score: 4
tagged with: bluetooth
upvote count: 4
has answer: http://stackoverflow.com/a/26171535

http://stackoverflow.com/a/26188592
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/26188574
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Method invocations, at compile time, are determined based on the type of the expression they are invoked on. In your example, you are attempting to invoke b() on an expression of type A. A does not declare a b() method and so it won't work. It does not work on your concrete B class example either A notAnonA = new B(); notAnonA.b(); // fails to compile You can very well add a new method inside the body of the new anonymous class, but you'll only be able to use it within the class or on the actual new anonymous class instance creation expression. new A() { void undeclared() {} }.undeclared();
accepted answer of: http://stackoverflow.com/q/26188574

http://stackoverflow.com/a/26143276
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26143233
has body: Once an executor service has been shut down it can't be reactivated. Create a new executor service to restart execution: listenDataExecutorService = Executors.newSingleThreadExecutor(); (You'd have to drop the final modifier though.) Another option is to cancel all pending tasks instead, and then reschedule them when you want to resume execution.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26143233
has comment: http://stackoverflow.com/comment/40979430
has comment: http://stackoverflow.com/comment/40979798
downvote count: 0
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/40979370

http://stackoverflow.com/comment/41022004
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26165958
has text: @jameslarge You're right I wouldn't use a CB either, but based on his question title, I assume at least one was required.

http://stackoverflow.com/q/26072872
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40851891
tagged with: cloudbees
has comment: http://stackoverflow.com/comment/40851764
has answer: http://stackoverflow.com/a/26092022
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40851790
has body: Techies-- This is a simple servlet/jsp/tomcat application. I want to add a style sheet, images and a few java script files. I'm using eclipse (kepler). The deployment is to a PaaS, Cloudbees server. I've added the js library to the project -- which shows up in the eclipse project as a resource library under the JavaScript Resources. The actual files show up in the js directory in the project. I've added the style sheet under src\main\webapp\WEB-INF as style.css Here's what the links look like in my jsp page <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Water Conservation and Reservoir Data Depot The images are under the project under a directory called images images are referenced as follows in my jsp pages: I thought I set up the js and css files correctly. I'm not sure about the image files, but since none of them are showing, apparently I didn't get any of it right! :(
has comment: http://stackoverflow.com/comment/40851594
tagged with: http://stackoverflow.com/tag/html
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40851567
has title: image, js and css resources aren't working on jsp pages
has comment: http://stackoverflow.com/comment/40851449
tagged with: java
has answer: http://stackoverflow.com/a/26081994

http://stackoverflow.com/comment/73631125
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26077472
has text: The class `[LC;` is a subclass of `Object`, and inherits all of the methods in the `Object` API. However, obviously, `Object` is a class not an interface. However, the class `[LC;` exists in a conceptual sense only. It has no code, no methods *of its own* and cannot be instantiated l*ike a normal class*, either in Java source code, bytecodes, or reflectively.

http://stackoverflow.com/q/26097818
has answer: http://stackoverflow.com/a/26106656
tagged with: asterisk
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/40896940
type: Question
tagged with: agi
has answer: http://stackoverflow.com/a/52163363
score: 0
answer count: 2
has body: Getting the below error when trying to initiate call. &lt;SIP/xx.xxx.xxx.xx-00000000&gt;AGI Rx &lt;&lt; VERBOSE "No script configured for URL 'AGI://localhost/xxx.agi' (script 'xxx.agi')" 1 Can anyone help me to resolve this error. Thanks
has comment: http://stackoverflow.com/comment/40896819
favorite count: 0
has title: No Script Configured for URL 'AGI://localhost/xxx.agi'
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/26037549
downvote count: 0
type: Answer
has body: It will work with @RequestBody. With @RequestBody you specify to Spring MVC that the annotated object is inside HTTP request's body. Spring MVC will then try to decode the object using appropriate HTTPMessageConverter - you want it to use message converter for json, so your POST request should include correct Content-Type header (e.g. Content-Type: application/json). If you don't specify @RequestBody Spring MVC will try to populate the object using request parameters (e.g. as if you submitted regular HTTP POST form). Hence: public String doControl(@RequestBody User user, HttpServletRequest request ){...}
score: 1
answers question: http://stackoverflow.com/q/26035784
upvote count: 1

http://stackoverflow.com/q/26192666
type: UnansweredQuestion
has body: I have installed java 8 SDK on my mac and terminal says java -version is java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode) bur when i create a project in eclipse with JSE 1.8 this is what happens: as you can see, no library is assigned: when i try to add a new environment, this is what i get: any help or suggestions?
score: 2
tagged with: java
has title: Eclipse doesn't find my java 8 library (mac)
has comment: http://stackoverflow.com/comment/41071555
type: Question
has answer: http://stackoverflow.com/a/26192742
tagged with: eclipse
has answer: http://stackoverflow.com/a/28051184
has answer: http://stackoverflow.com/a/30095898
upvote count: 2
has comment: http://stackoverflow.com/comment/41071590
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40828504
score: 1
has text: Does it need to be a list? With a header-less, single-column table it would be easy.
comment on: http://stackoverflow.com/q/26060664
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40885960
has text: This is not something to be asked on Stack Overflow. We're here to help with specific problems you're facing, not for structural or architectural advice that is completely subjective.
comment on: http://stackoverflow.com/q/26091654
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41056434
has text: @ControlAltDel yep, How would you do that?
type: QuestionComment
comment on: http://stackoverflow.com/q/26184453
score: 0
type: Comment

http://stackoverflow.com/comment/41059857
type: Comment
type: QuestionComment
has text: Now add *how* did you try it and what went wrong (did you get wrong results/errors?)
comment on: http://stackoverflow.com/q/26186267
score: 0

http://stackoverflow.com/a/26147807
upvote count: 1
has comment: http://stackoverflow.com/comment/40988161
score: 1
has comment: http://stackoverflow.com/comment/40987982
has comment: http://stackoverflow.com/comment/40987937
type: AcceptedAnswer
downvote count: 0
has body: You use the this keyword. JDialog myDialog = new JDialog(this, Dialog.ModalityType.DOCUMENT_MODAL); More info here: http://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html Side note: You shouldn't extend JFrame for no reason. You should favor composition over inheritence. More info here and here.
answers question: http://stackoverflow.com/q/26147759
type: Answer
accepted answer of: http://stackoverflow.com/q/26147759

http://stackoverflow.com/comment/41003298
has text: I have also added the image for libraries and updated with stacktrace
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26155767
type: AnswerComment

http://stackoverflow.com/comment/41028095
score: 0
has text: I have content in a html page which is processed by MathJax JS library and yeilds the actual DOM content. This DOM is dynamic is not available unless the DOM content is processed by MathJax. Thats the reason Javascript is in question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26167306

http://stackoverflow.com/q/26136681
tagged with: c++
answer count: 0
has comment: http://stackoverflow.com/comment/40969104
tagged with: java
has body: I need to find memeory leaks in a c++ program which uses JNI calls to call into java apis . I cant use valgrind as it crashes as soon as java api gets called . what is alternative to find memory leaks ?
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/33334126
tagged with: java-native-interface
has title: Finding memory leaks in c++ , jni java code together
has comment: http://stackoverflow.com/comment/40968402
score: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: memory-leaks

http://stackoverflow.com/comment/40877991
score: 1
has text: When the regex engine see a `[` character then it considered as a start of a character class.
type: QuestionComment
comment on: http://stackoverflow.com/q/26087492
type: Comment

http://stackoverflow.com/comment/41019131
score: 1
comment on: http://stackoverflow.com/q/26164494
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/java/generics/index.html

http://stackoverflow.com/comment/40927864
comment on: http://stackoverflow.com/a/26113216
score: 0
type: AnswerComment
has text: @pjs: The code was edited to remove the instantiation of Random, so your answer doesn't apply anymore. There's still a problem if `setRandomVerticies()` is called multiple times at once, since the generator is reseeded each time with `System.currentTimeMillis()`.
type: Comment

http://stackoverflow.com/a/27666289
type: Answer
answers question: http://stackoverflow.com/q/26041712
has body: I had this proble. Turns out I found an embarrasingly easy sollution (in my case). Jetty didn't find my slf4j-*.jar(s) unless I added them as dependencies to the plugin configuration itself. I will not include my entire pom.xml but merely the plugin conf. Hope this helps. Cheers ... org.mortbay.jetty jetty-maven-plugin 8.1.10.v20130312 org.slf4j slf4j-api 1.7.7 org.slf4j slf4j-log4j12 1.7.7 org.slf4j log4j-over-slf4j 1.7.7 org.codehaus.fabric3 fabric3-atomikos-library 1.9.6 javax.transaction jta 1.1 runtime org.codehaus.btm btm-jetty6-lifecycle 1.3.3 ... I then checked the project dependency tree using the Maven Dependency Plugin and removed/excluded all unwanted logging frameworks included by dependencies and it worked.
score: 0

http://stackoverflow.com/a/26182789
score: 1
has body: First way will need memory for the variable for entire execution of the method or if its in a class then till the class is given to GC. Second way will leave the memory of the splitted strings for GC after the loop executes. To Answer your question Will the code lion tiger zebra".split(" ") be executed all the time the loop is repeated or just the first time. It will be done just once.
type: Answer
answers question: http://stackoverflow.com/q/26182752
accepted answer of: http://stackoverflow.com/q/26182752
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26124151
accepted answer: http://stackoverflow.com/a/26124568
upvote count: 7
type: Question
has body: I'm using Guava TypeToken class in my project, but I'm getting an unexpected result. I have MyGenericClass&lt;T&gt;: public class MyGenericClass&lt;T&gt; implements MyInterface { private TypeToken&lt;T&gt; recordType; public MyGenericClass(String name) { this.recordType = new TypeToken&lt;T&gt;(getClass()) {}; // ... } // ... @SuppressWarnings("unchecked") protected Class&lt;T&gt; getRecordType() { return (Class&lt;T&gt;) recordType.getRawType(); } } So if I instantiate an object via new MyGenericClass&lt;String&gt;() and then invoke getRecordType() I expect to get java.lang.String, instead I'm getting java.lang.Object. But, if I extend generic class: public class MyStringImpl extends MyGenericClass&lt;String&gt; { // ... } and instantiate this new class: new MyStringImpl() then I get the correct result. Why is this happening? Is this the expected behaviour of TypeToken?
has title: Guava TypeToken and generic classes
has answer: http://stackoverflow.com/a/26132071
answer count: 2
has comment: http://stackoverflow.com/comment/40959850
downvote count: 0
possible better answer: http://stackoverflow.com/a/26132071
tagged with: generics
has answer: http://stackoverflow.com/a/26124568
favorite count: 0
type: AnsweredQuestion
tagged with: guava
score: 7
tagged with: java

http://stackoverflow.com/a/26114010
type: Answer
has body: The textual system is a really bad choice if you want him to use the sword or other things like armors, shields and so on. You could make several classes like Weapon, Armor and shield: public class Weapon { private int damage; private int durability; public class Weapon(int damage, int durability) { this.damage = damage; this.durability = durability; } } Now your golden sword can implement the Weapon class. You can add methods and maybe the name to this Weapon class and have the "golden sword" class implement these methods. After this you add some variables to your player like Weapon, Armor, Shield. If he picks up a weapon you can say: player.setWeapon(goldenWeapon); This is the better approach in the long run.
accepted answer of: http://stackoverflow.com/q/26113846
answers question: http://stackoverflow.com/q/26113846
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/44548992
has text: That is not how JDBC works unfortunately. Upto JDBC 4.2, JDBC didn't even have 'with timezone' support. And as pre-JSR-310 (`java.time`) Java always needed a timezone for time interpretation, knowing which timezone to use (and using a 'reasonable' default) is simply a necessity.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28084905
type: Comment

http://stackoverflow.com/q/26133246
has comment: http://stackoverflow.com/comment/40961286
has answer: http://stackoverflow.com/a/26133314
score: 0
tagged with: android
has title: how to display logcat in text view in the other page?
type: UnansweredQuestion
tagged with: logging
type: Question
tagged with: text
tagged with: java
has comment: http://stackoverflow.com/comment/41414497
tagged with: eclipse
has body: i have question here.how to display log cat in text view on other page? below shows the code for log cat. try.java Log.e("MENU A","Total Price: RM "+price); price is a double type... what should i do to display the price in a text view on the other page? right now i just can display the total price in log cat at the bottom of eclipse page. should i declare new text view? i want to display the price in a page called testing.xml. try.java is the process page for testing.xml help me please....
answer count: 1

http://stackoverflow.com/a/26165501
upvote count: 4
downvote count: 0
score: 4
has body: I think, the problem is, that you extend the JdbcTemplate. Spring Boot only creates a JdbcTemplate, if no other bean with this type is found. But your class is a bean of type JdbcTemplate, so the autoconfiguration for the JdbcTemplate is skipped. Try to remove the "extends JdbcTemplate", it doesn't seem to be required for your class.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41023875
type: Answer
accepted answer of: http://stackoverflow.com/q/26165126
answers question: http://stackoverflow.com/q/26165126

http://stackoverflow.com/comment/41065469
score: 0
comment on: http://stackoverflow.com/q/26189257
type: Comment
type: QuestionComment
has text: And you are returning the last element of the array if you want to return complete array then return the reference

http://stackoverflow.com/comment/40847900
comment on: http://stackoverflow.com/a/26070680
type: Comment
score: 1
has text: @Rane: if you make the variables static a puppy is killed somewhere, so please just don't do this. To set and access them use getters and setters.
type: AnswerComment

http://stackoverflow.com/a/26048965
answers question: http://stackoverflow.com/q/26048941
has body: You keep doing checks on the variable x, but you are not updating its value in the loop body. Therefore, the condition keeps being verified. In other words First iteration: Is x different from a vowel? If so, build the s string and print it Second iteration: Is x different from a vowel? Same as 2... and so on.
type: Answer
score: 0

http://stackoverflow.com/comment/40806085
has text: AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, Zamanlayici.class); intent.putExtra(ONE_TIME, Boolean.FALSE); PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0); //After after 5 seconds am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000 * 10, pi); like this code, i can do this specific time between but i can't do this specific time
type: Comment
comment on: http://stackoverflow.com/q/26048155
score: 0
type: QuestionComment

http://stackoverflow.com/a/26167470
has body: In this case, firstName and secondName (as function parameters) only have method level scope, therefore as soon as control returns from this method, the data will be lost. On the other hand, name and surname will be stored and available for other calls into the object created by this constructor.
type: Answer
answers question: http://stackoverflow.com/q/26167426
score: 0

http://stackoverflow.com/a/26078373
has comment: http://stackoverflow.com/comment/40869814
answers question: http://stackoverflow.com/q/26042901
has comment: http://stackoverflow.com/comment/40869869
has comment: http://stackoverflow.com/comment/40907381
has body: I would recommend you keep the environment variables separate for each layer of your application. For example it might seem like putting everything in one place makes sense, but I don't feel it's good design to share a configuration directory for Apache and Tomcat. Both have standard locations for config files (e.g., $CATALINA_HOME/conf). I wouldn't think you're using log4j on Apache so why put it in a custom directory that's shared with Apache. Put it in a conf folder inside your webapp, or in the previously mentioned top level conf directory. Maybe you'll have more than one webapp on Tomcat -- in that case it makes even more sense to have logging config files within the particular webapp directory. It's also cleaner to have the environment variables contained within the process. They don't gum up the global environment variables. For example when you start Tomcat, the setenv.sh script runs and sets all the enviroment variables just for the java process that's running Tomcat.
score: 0
has comment: http://stackoverflow.com/comment/40925758
type: Answer

http://stackoverflow.com/a/26149771
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26138714
has body: I usually try catching the Exception I'm interrested in, and pass the test if it's caught. Try something like this: try { myProgram.register(-23); // (optional) fail test here } catch (IllegalArgumentException e){ // pass test here } catch (Exception e) { // (optional) fail test here }
answers question: http://stackoverflow.com/q/26138714
has comment: http://stackoverflow.com/comment/41003422
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40999002
score: 1

http://stackoverflow.com/q/26144251
upvote count: 5
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 5
tagged with: spring-data-mongodb
has body: I have the following documents in my Mongo database (_ids skipped): &gt; db.names.find({}) { "name": "John" } { "name": "Jack" } { "name": "Johny" } { "name": "Jenny" } I have created the Spring Data repository for this collection: public interface NameRepository extends MongoRepository&lt;Name, ObjectId&gt; { Collection&lt;Name&gt; findByNameLike(String name); } The results are as follows: nameRepository.findByNameLike("John"); // John, Johny nameRepository.findByNameLike("John$"); // John nameRepository.findByNameLike("J*ny"); // Johny, Jenny nameRepository.findByNameLike("Jo?*ny"); // Johny, Jenny nameRepository.findByNameLike("Jo[]]?*ny"); // empty, without error So it behaves like a smart regular expression. Now I want to implement such behavior myself: class MyNameRepository { MongoOperations mongoOperations; // injected public Collection&lt;Name&gt; findByName(String like) { Query query = new Query(); query.addCriteria(Criteria.where("name").regex(like)); return mongoOperations.find(query, Name.class) } } But the behavior of my method is different: myNameRepository.findByName("John"); // John, Johny myNameRepository.findByName("John$"); // John myNameRepository.findByName("J*ny"); // empty, without error myNameRepository.findByName("Jo?*ny"); // error (invalid regex) myNameRepository.findByName("Jo[]]?*ny"); // error (invalid regex) So my custom methods works exactly as I would have defined findByNameRegex method in Spring data repository. How to implement the findByNameLike behavior? Why I need this: When I need filtering my collection by many attributes (e.g. by name only, by name and surname, by name and postal code, by name, surname and postal code etc.) its easier for me to support queries as parameters rather than create many very-long-named methods in repository.
tagged with: spring
has answer: http://stackoverflow.com/a/26148020
answer count: 1
has title: How does Spring build its like* queries in mongo?
tagged with: java
accepted answer: http://stackoverflow.com/a/26148020
tagged with: spring-data
tagged with: mongodb

http://stackoverflow.com/q/26092969
has answer: http://stackoverflow.com/a/26092998
accepted answer: http://stackoverflow.com/a/26092998
downvote count: 0
favorite count: 0
has body: I am trying to understand the garbage collector method. "In Java, your program must call the garbage collector method frequently; otherwise your program will be overrun with garbage objects" I believe this is false because the program should do this automatically, running in the background correct?
has title: Java Garbage Collector method
possible better answer: http://stackoverflow.com/a/26093090
has comment: http://stackoverflow.com/comment/43498265
type: AnsweredQuestion
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/26093113
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26093090
answer count: 3
upvote count: 1

http://stackoverflow.com/q/26152228
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/41001202
upvote count: 4
has comment: http://stackoverflow.com/comment/71353200
linked to: http://stackoverflow.com/q/16794783
downvote count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/51300686
type: Question
has title: Reading Oracle Java 8 gc logs
has body: I have enabled GC logging for one of my application. Here is a part of the log. I have searched around to learn how to read this but it appears a bit different to old articles written ofr java 7 or older. I am specifically interested in the value in marked withh **. Why the value is close but diffferent in each line GC parameters as printed in log Java HotSpot(TM) 64-Bit Server VM (25.5-b02) for linux-amd64 JRE (1.8.0_05-b13), built on Mar 18 2014 00:29:27 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8) Memory: 4k page, physical 8061636k(1507688k free), swap 8355832k(5938840k free) CommandLine flags: -XX:InitialHeapSize=268435456 -XX:+ManagementServer -XX:MaxHeapSize=268435456 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 85.003: [GC (Allocation Failure) [PSYoungGen: 74018K->350K(81408K)] 236281K->162693K(**256512K**), 0.0158446 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 85.200: [GC (Allocation Failure) [PSYoungGen: 75598K->406K(80896K)] 237941K->162843K(**256000K**), 0.0177163 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 85.405: [GC (Allocation Failure) [PSYoungGen: 75654K->390K(81920K)] 238092K->162915K(**257024K**), 0.0237740 secs] [Times: user=0.04 sys=0.00, real=0.03 secs] 86.921: [GC (Allocation Failure) [PSYoungGen: 77173K->2579K(81920K)] 239698K->165199K(**257024K**), 0.0315362 secs] [Times: user=0.06 sys=0.00, real=0.03 secs] 87.225: [GC (Allocation Failure) [PSYoungGen: 79373K->512K(81920K)] 241993K->163869K(**257024K**), 0.0306456 secs] [Times: user=0.05 sys=0.01, real=0.03 secs] 87.551: [GC (Metadata GC Threshold) [PSYoungGen: 42769K->594K(81920K)] 206126K->164086K(257024K), 0.0229454 secs] [Times: user=0.04 sys=0.00, real=0.02 secs] 87.574: [Full GC (Metadata GC Threshold) [PSYoungGen: 594K->0K(81920K)] [ParOldGen: 163492K->47257K(**175104K**)] 164086K->47257K(**257024K**), [Metaspace: 53346K->53346K(1099776K)], 0.9669507 secs] [Times: user=1.77 sys=0.…
tagged with: java
has answer: http://stackoverflow.com/a/26283090
has comment: http://stackoverflow.com/comment/40996748
answer count: 1
score: 4

http://stackoverflow.com/comment/41077007
score: 2
type: QuestionComment
has text: Then you should start with reading the guidelines for posting StackOverflow and edit your question to meet the rules. Whether your question has to do with general Java functions or a library, you can't ask "why am I getting this exception?" if you won't show us what you're doing that's causing it.
type: Comment
comment on: http://stackoverflow.com/q/26184336

http://stackoverflow.com/a/26135961
has body: There is an issues in your for loop for(i=0;i&lt;arr.length-1;i++){} It should iterate up to i&lt;arr.length for(i=0;i&lt;arr.length;i++){}
downvote count: 0
answers question: http://stackoverflow.com/q/26135900
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26035562
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40810300
possible better answer: http://stackoverflow.com/a/26060447
has answer: http://stackoverflow.com/a/26073042
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40787377
has comment: http://stackoverflow.com/comment/40813623
has comment: http://stackoverflow.com/comment/40820696
accepted answer: http://stackoverflow.com/a/26103305
tagged with: drag-and-drop
answer count: 3
has body: I want Drag and Drop a file that particular file must opened in new/separate tab.I wrote the code for DragAndDrop.But It has worked when I taken Newfile then I Drag and Drop the text File from the Computer.It has copied or override the contents of a file. But,when I Drag and drop a file,It should open in a separate tab.How can I do this.Please give me suggestions.Thank you.I have post my original application.It has two classes. Main class: public class OpenDemo extends javax.swing.JFrame implements ChangeListener{ private ArrayList&lt;OInternalFrame&gt; frames = new ArrayList&lt;OInternalFrame&gt;(); private OInternalFrame currentFrame; int i=0; JTabbedPane tabbedPane2; public OpenDemo() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { tabbedPane2=new JTabbedPane(); this.add(tabbedPane2); enableDragAndDrop(); tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); open = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); open.setText("Open"); open.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openActionPerformed(evt); } }); jMenu1.add(open); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tp, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)); pack(); } private void openActionPerformed(java.awt.event.ActionEvent evt) { FileDialog fd = new FileDialog(OpenDemo.this, "Select File", FileDialog.…
type: AnsweredQuestion
tagged with: tabs
has answer: http://stackoverflow.com/a/26060447
has answer: http://stackoverflow.com/a/26103305
has title: How to Drag and Drop a text file in new tab using swing
tagged with: file

http://stackoverflow.com/q/26091800
tagged with: android
tagged with: android-asynctask
type: AnsweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/26091957
upvote count: 1
tagged with: bitmap
type: Question
accepted answer: http://stackoverflow.com/a/26091957
has title: Returning a bitmap from AsyncTask
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has body: Following this tutorial: http://developer.android.com/training/displaying-bitmaps/process-bitmap.html It says to use AsyncTask to load bitmaps. Sounds great, but in their example it uses an ImageView. I don't want to use an ImageView, I've created my own View that I will draw to. After I load the bitmap in the AsyncTask, how can I return the newly loaded bitmap to the main thread? private Bitmap mLoadedBitmap; public void loadBitmap(String path, int width, int height) { BitmapWorkerTask task = new BitmapWorkerTask(mLoadedBitmap); BitmapTaskParams params = new BitmapTaskParams(path, width, height); task.execute(params); } public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if(height &gt; reqHeight || width &gt; reqWidth) { final int halfHeight = height / 2; final int halfWidth = width / 2; // Calculate the largest inSampleSize value that is a power of 2 and keeps both // height and width larger than the requested height and width. while ((halfHeight / inSampleSize) &gt; reqHeight &amp;&amp; (halfWidth / inSampleSize) &gt; reqWidth) { inSampleSize *= 2; } } return inSampleSize; } public static Bitmap decodeSampledBitmapFromFile(String file, int reqWidth, int reqHeight) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(file, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(file, options); } private static class BitmapTaskParams { private String path; private int width; private int height; BitmapTaskParams(String path, int width, int height) { this.path = path; this.width = width; this.height = height; } } class BitmapWorkerTask extends AsyncTask&lt;BitmapTaskParams, Void, Bitmap&gt; { private final WeakReference&lt;Bitmap&gt; bitmapReference; pr…

http://stackoverflow.com/a/26293331
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Apparently this was a bug in Java 8. I posted to the Nashorn mailing list; here is the reply: I can reproduce the problem with 8u20, however it seems to be fixed in JDK 9 and JDK8u40. You can download a preview release of 8u40 here: https://jdk8.java.net/download.html The email: http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-October/003614.html ( Edit: There's another ArrayIndexOutOfBounds error in 8u40, read more here: http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-March/004268.html "Cannot parse JSON: { 0: null, 100: null }". That problem has been fixed in 8u60. )
accepted answer of: http://stackoverflow.com/q/26189940
type: Answer
answers question: http://stackoverflow.com/q/26189940
downvote count: 0

http://stackoverflow.com/a/26051658
has comment: http://stackoverflow.com/comment/40924044
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40919435
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26050639
has body: No, there is no standard/reliable way to do this. Some libraries take advantage of common patterns of ClassLoader.getResources implementations (specifically, that they usually always return "file:" or "jar:file:" URLs) in order to support wildcards in resource lookups. For example, the Wildcards in application context constructor resource paths explains how Spring does this, and it lists several caveats ("Implications on portability", "Classpath*: portability", "notes relating to wildcards").
has comment: http://stackoverflow.com/comment/43067970
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26050639
type: Answer

http://stackoverflow.com/comment/40991894
has text: You requestmapping is to `/addOrder/{clientId}` and your from submits to `/clients/addOrder/${client.id}`. That doesn't look right to me.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26149822
score: 0

client-server
tags question: http://stackoverflow.com/q/26057777
tags question: http://stackoverflow.com/q/26097977
tags question: http://stackoverflow.com/q/26036942
type: Tag
tag name: client-server
tags question: http://stackoverflow.com/q/26107987
tags question: http://stackoverflow.com/q/26036652

http://stackoverflow.com/a/26173956
upvote count: 6
has body: I find the right way to do that, and all my attempt was bad because I was thinking "like object" and not in SQL... but CriteriaQuery is a "object wrapper" to build SQL query. So, I wrote the query I want in SQL and I found the solution : What I want in SQL was : select * from applicant applicant0_ inner join document documents1_ on applicant0_.id=documents1_.applicant where documents1_.id in (? , ?) So my predicate seems to be the following : public static Specification&lt;Applicant&gt; applicantHasDoc(final Set&lt;Document&gt; documents) { return new Specification&lt;Applicant&gt;() { @Override public Predicate toPredicate(Root&lt;Applicant&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder cb) { SetJoin&lt;Applicant, Document&gt; documentApplicantJoin = root.join(Applicant_.documents); return documentApplicantJoin.in(documents); } }; }
score: 6
has comment: http://stackoverflow.com/comment/89886680
downvote count: 0
answers question: http://stackoverflow.com/q/26163305
type: Answer

http://stackoverflow.com/a/26190974
upvote count: 5
answers question: http://stackoverflow.com/q/26190959
type: Answer
has body: The answer is in the question. You're using the type HTMLDocument.Iterator, instead of using java.util.Iterator. Fix your imports.
downvote count: 0
score: 5

http://stackoverflow.com/comment/41029414
score: 0
type: Comment
type: QuestionComment
has text: A couple of things... 1st, you don't need to add the jdk to your classpath. 2nd, if you're programming in java you probably should at least google 'classpath' and read a couple of short articles before continuing.
comment on: http://stackoverflow.com/q/26169595

http://stackoverflow.com/comment/40900522
type: QuestionComment
comment on: http://stackoverflow.com/q/26100006
type: Comment
score: 0
has text: nothing will happens. IntentService runs already in Background. What do you need an Asynctask for?

http://stackoverflow.com/q/26061662
score: 0
has comment: http://stackoverflow.com/comment/40830947
has comment: http://stackoverflow.com/comment/40830481
accepted answer: http://stackoverflow.com/a/26062527
has body: So I've been making this program in java that's going to store data for users. I've already made login and registration screen using sqlite database. And now, after the user logs in, the main screen opens, and here the user can add stuff (just text for now). This text is stored in form of JLabels on the main screen of the program. But what i don't know is, how to open everything that user changed last time he used the program? And of course for each user it has to be different.
type: AnsweredQuestion
tagged with: java
has title: How to save the exact state of the programe for specific user?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26062527

http://stackoverflow.com/comment/40791571
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26039100
has text: Does your worker thread notify the controlling code when it is done processing and waiting to write? Because obviously, at that point you should proceed with creating a new thread to do more work. Also, do you pre-load the chunks into a buffer so there's no latency when a thread wants to grab a chunk?
score: 0

multiple-file-upload
tags question: http://stackoverflow.com/q/26125334
type: Tag
tag name: multiple-file-upload

http://stackoverflow.com/a/26151083
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26150843
has body: OK, for your basic question: Is it a good practice to use the same Hibernate Session over and over? Answer is no,the session objects should not be kept open for a long time because they are not usually thread safe and they should be created and destroyed them as needed. What it is usually done in hibernate is: You open a session (which is basically a database connection), do transactions, and then close your connection (close your session). In other words, you can check some other post's analogy : What is the difference between a session and a transaction in JPA 2.0? Hope it helps

http://stackoverflow.com/comment/44316325
has text: this is usually the issue if a webserver is sending a 403 when it shouldn't be. Honestly this is less an issue with jsp and moreso a systems administration / filesystem permissions issue
type: AnswerComment
comment on: http://stackoverflow.com/a/27946921
score: 0
type: Comment

http://stackoverflow.com/comment/41070825
has text: But sir, I need you later on this coding. Sorry for bad english I'm from Philippines.
comment on: http://stackoverflow.com/q/26192209
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26075960
type: Answer
answers question: http://stackoverflow.com/q/26075904
score: 0
has body: As an alternative, you can also try this: &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="content" /&gt; &lt;data android:scheme="file" /&gt; &lt;data android:pathPattern=".*mp3" /&gt; &lt;data android:mimeType="audio/*" /&gt; &lt;/intent-filter&gt;

http://stackoverflow.com/comment/40935282
comment on: http://stackoverflow.com/q/26118439
score: 0
type: Comment
type: QuestionComment
has text: Java console showing no errors

http://stackoverflow.com/comment/137072823
score: 0
type: Comment
comment on: http://stackoverflow.com/a/37062788
has text: Regarding spring's builder. `build().toUri()` will not produce a correct URI, if `key` or `value` need encoding. Don't forget to manually encode them. It's also better to use `build(true).toUri()` for validation. Don't `.build().encode().toUri()`, or `build(false).encode()`, or `build(Map)` or `.toUriString()` directly. Latter 2 are a shortcut for `.build(false).encode().toUri()`. The reason to not use them in this case, is because if the original URL already contained URL encoded parts (including query string), `.build().encode()` will encode them again, resulting in a broken URL.
type: AnswerComment

http://stackoverflow.com/a/26123710
has comment: http://stackoverflow.com/comment/40985082
answers question: http://stackoverflow.com/q/26063268
score: 1
has comment: http://stackoverflow.com/comment/40947865
has body: If your JAXB classes just use the basic annotations, you can take a look at JacksonJAXBAnnotations, allows Jackson mapper to recognize JAXN annotations. Four lines of code (in the simplest marshalling case) would be all you would need. ObjectMapper mapper = new ObjectMapper(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); mapper.writeValue(System.out, yourJaxbObject); You can see the link above for all the supported annotations. The maven artifact you'll need is com.fasterxml.jackson.module jackson-module-jaxb-annotations 2.4.0 See the github for jackson-module-jaxb-annotations - Note this artifact has dependencies on jackson-core and jackson-databind. So if you're not using maven, then you will need to make sure to download these artifacts also Simple Exmaple: JAXB Class @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "hello", "world" }) @XmlRootElement(name = "root") public class Root { @XmlElement(required = true) protected String hello; @XmlElement(required = true) protected String world; // Getters and Setters } XML <?xml version="1.0" encoding="UTF-8"?> JAXB Jackson Test public class TestJaxbJackson { public static void main(String[] args) throws Exception { JAXBContext context = JAXBContext.newInstance(Root.class); Unmarshaller unmarshaller = context.createUnmarshaller(); InputStream is = TestJaxbJackson.class.getResourceAsStream("test.xml"); Root root = (Root)unmarshaller.unmarshal(is); System.out.println(root.getHello() + " " + root.getWorld()); ObjectMapper mapper = new ObjectMapper(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); mapper.writeValue(System.out, root); } } Result {"hello":"JAXB","world":"Jackson"} Update Also see this post. It looks like MOXy also offers this support.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40947573
has comment: http://stackoverflow.com/comment/40985183
has comment: http://stackoverflow.com/comment/40947665
has comment: http://stackoverflow.com/comment/40948345
has comment: http://stackoverflow.com/comment/40947060
type: Answer
has comment: http://stackoverflow.com/comment/40947687
has comment: http://stackoverflow.com/comment/40946897
downvote count: 0
has comment: http://stackoverflow.com/comment/40946409
accepted answer of: http://stackoverflow.com/q/26063268

http://stackoverflow.com/comment/40968213
score: 0
has text: They might probably be right clicking on the project and doing a Run As > Maven Install (or any other lifecycle which generates the required classes or resources for your test) before they go into the test case and run it as a JUNIT test. Might be able to help you if you could provide the pom configuration.
type: QuestionComment
comment on: http://stackoverflow.com/q/26136051
type: Comment

http://stackoverflow.com/q/26141629
tagged with: string
has comment: http://stackoverflow.com/comment/40976185
has comment: http://stackoverflow.com/comment/40976277
linked to: http://stackoverflow.com/q/1732348
has body: How can we replace all the string of a sentence that start from &lt;\ and end &gt; Is there any way available for this. for now i am replacing each word manually. example : - test = test.replace("&lt;/tr&gt;", ""); test = test.replace("&lt;/html&gt;", "");
linked to: http://stackoverflow.com/q/240546
has title: Replace String starts from <\
linked to: http://stackoverflow.com/q/21013550
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40976256
has comment: http://stackoverflow.com/comment/40976177
type: Question
has comment: http://stackoverflow.com/comment/40976162
tagged with: java
tagged with: replace
score: 0
has answer: http://stackoverflow.com/a/26141769
answer count: 1

http://stackoverflow.com/comment/41001294
comment on: http://stackoverflow.com/q/26143942
score: 0
has text: PDDocument doc = PDDocument.load("xyz.pdf"); PDPage page = (PDPage)doc.getDocumentCatalog().getAllPages().get( 1 ); Rectangle2D region = new Rectangle2D.Double(10, 10, 10, 10); String regionName = "region"; PDFTextStripperByArea stripper = new PDFTextStripperByArea(); stripper.addRegion(regionName, region); stripper.extractRegions(page); System.out.println("Region is "+ stripper.getTextForRegion(region")); Here I am trying to get data as per the coordinates so that footer gets eliminated
type: Comment
type: QuestionComment

lambda
tags question: http://stackoverflow.com/q/26178610
tags question: http://stackoverflow.com/q/26152692
tags question: http://stackoverflow.com/q/26161830
tags question: http://stackoverflow.com/q/26167294
tags question: http://stackoverflow.com/q/26091682
tags question: http://stackoverflow.com/q/26163645
tags question: http://stackoverflow.com/q/26147712
tags question: http://stackoverflow.com/q/26179001
tag name: lambda
tags question: http://stackoverflow.com/q/26106613
tags question: http://stackoverflow.com/q/26170264
type: Tag
tags question: http://stackoverflow.com/q/26097538
tags question: http://stackoverflow.com/q/26119099
tags question: http://stackoverflow.com/q/26118090
tags question: http://stackoverflow.com/q/26049187

android-listview
tags question: http://stackoverflow.com/q/26193443
tags question: http://stackoverflow.com/q/26172478
tags question: http://stackoverflow.com/q/26052301
tags question: http://stackoverflow.com/q/26190960
tags question: http://stackoverflow.com/q/26159329
tags question: http://stackoverflow.com/q/26179108
tags question: http://stackoverflow.com/q/26062486
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/26109383

primary-key
tags question: http://stackoverflow.com/q/26094841
tag name: primary-key
tags question: http://stackoverflow.com/q/26146112
tags question: http://stackoverflow.com/q/26174258
type: Tag

http://stackoverflow.com/comment/40945422
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26089322
type: AnswerComment
has text: Thanks! Can you possibly provide more detail on the JVM "safety net"? Over what time horizon is the "98%" calculated? Last 5 minutes, last hour? Is this a recent addition to the JVM?

http://stackoverflow.com/comment/40883171
type: QuestionComment
comment on: http://stackoverflow.com/q/26090063
score: 0
has text: @mendoncakr : don't use an array for that (read my comment on wrongAnswer's answer). Plus, make the variables static if you need to access it in other methods.
type: Comment

android-broadcast
tag name: android-broadcast
type: Tag
tags question: http://stackoverflow.com/q/26091231

http://stackoverflow.com/a/26193518
score: 0
accepted answer of: http://stackoverflow.com/q/26193427
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41074068
type: Answer
answers question: http://stackoverflow.com/q/26193427
has body: If you haven't overridden .toString() then, for a given instance, it will continue to return the same string throughout the instance's life. But it is quite possible that once this instance has been garbage collected, another instance of this class or even another class will be allocated to the same block of memory and will return the same string as this one did. But rather than using a String as the key, you would be better off changing actionFired to give you the object rather than a string representation. It's very fragile to do it like this, and if your implementation changes later, it might all break.

http://stackoverflow.com/a/26142594
answers question: http://stackoverflow.com/q/26142262
has comment: http://stackoverflow.com/comment/40981422
has comment: http://stackoverflow.com/comment/41009873
has comment: http://stackoverflow.com/comment/40983469
has comment: http://stackoverflow.com/comment/41007362
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40983802
has comment: http://stackoverflow.com/comment/40998833
has body: Instead of using the Google Play Services jar as dependency, add the Google Play Services library project in your application. Instructions for this can be found at http://developer.android.com/google/play-services/setup.html#Setup

http://stackoverflow.com/a/26342006
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41351512
has body: The disconnect method of the MqttClientListener is called whenever the connection drops. The "reconnecting" param tells you whether the client will try to reconnect. There is no method you can call to poll for current connection status. As for your questions about changing clients: I think xenqtt is the preferred MQTT library but I am one of the project authors so I may be biased. We try to respond to tickets promptly so feel free to open a ticket with any questions: http://sourceforge.net/p/xenqtt/tickets/
accepted answer of: http://stackoverflow.com/q/26188141
answers question: http://stackoverflow.com/q/26188141
type: AcceptedAnswer

http://stackoverflow.com/comment/40829276
comment on: http://stackoverflow.com/a/26061058
score: 0
type: AnswerComment
type: Comment
has text: Then add a `@Qualifier` to specify which bean you want.

http://stackoverflow.com/comment/40782798
comment on: http://stackoverflow.com/a/26035665
has text: So the assembly you mention is roughly equivalent to the Bytecode in java, which gets JIT-compiled at runtime and is platform-independent?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40849171
has text: This is known as reflection.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26071619
type: QuestionComment

http://stackoverflow.com/a/26100819
type: Answer
answers question: http://stackoverflow.com/q/26100753
has body: You can express a float literal as '1.'(excluding the quotes). This will mean exactly the same as 1.0. So, here 1.f means actually 1.0f.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40901974
upvote count: 1

http://stackoverflow.com/comment/67153513
has text: Looks like same. I start Glassfish 4.1.1 from Netbeans and it get 100% load of 1/2 cores on 2 phisical cores (hyperthreading)
type: Comment
comment on: http://stackoverflow.com/q/26107101
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40938003
type: Comment
type: QuestionComment
score: 0
has text: Can you do an example for me?
comment on: http://stackoverflow.com/q/26120930

http://stackoverflow.com/q/26144506
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/40981971
type: Question
linked to: http://stackoverflow.com/q/15426736
has answer: http://stackoverflow.com/a/26145143
has title: Foreign key usage in Java with Hibernate
accepted answer: http://stackoverflow.com/a/26144725
score: 0
possible better answer: http://stackoverflow.com/a/26145143
has body: I am trying to develop a web application and I was wondering if there is a way to utilize a foreign key without writing a lot of code. My Trainees.java @Entity public class Trainees { @Id @GeneratedValue private int traineesID; private int groupsID; @ManyToOne @JoinColumn(name = "status_trainee") private String status_TraineeID; private int customersID; private String name; private String surname; private String phoneDetails; private String email; public Trainees(){ } public Trainees(String name, String surname, String phoneDetails, String email, int id, int groupsID, String status_TraineeID, int customersID) { super(); this.name = name; this.surname = surname; this.email = email; this.phoneDetails = phoneDetails; this.groupsID = groupsID; this.status_TraineeID = status_TraineeID; this.customersID = customersID; } //getters and setters @Override public boolean equals(Object object) { if (object instanceof Trainees){ Trainees contact = (Trainees) object; return contact.traineesID == traineesID; } return false; } @Override public int hashCode() { return traineesID; } } Status_Trainee.java @Entity public class Status_Trainee { @Id @GeneratedValue private int status_traineeID; private String value; public Status_Trainee(){ } public Status_Trainee(String value, int id) { super(); this.value = value; } //getters and setters @Override public boolean equals(Object object) { if (object instanceof Status_Trainee){ Status_Trainee value = (Status_Trainee) object; return value.status_traineeID == status_traineeID; } return false; } @Override public int hashCode() { return status_traineeID; } } Error: Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on uaiContacts.model.Trainees.status_TraineeID references an unknown entity: String So my aim is that using the Trainees table and class, I could retrieve the value of Status_Trainee table using the foreign key. For example: if foreign keys ID is 2, then it would retrieve a string from status_trainee table where p…
answer count: 2
has comment: http://stackoverflow.com/comment/40981946
tagged with: sql
tagged with: angularjs
has comment: http://stackoverflow.com/comment/40982448
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26144725

http://stackoverflow.com/comment/40973803
score: 0
type: Comment
type: QuestionComment
has text: @Bohemian omg thanks. Forgot to rebuild the part of the project.
comment on: http://stackoverflow.com/q/26139522

http://stackoverflow.com/comment/40803895
has text: See [`String`: `split()`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split%28java.lang.String%29)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26047024
type: QuestionComment

http://stackoverflow.com/comment/41006155
has text: what you mean? what id?
comment on: http://stackoverflow.com/a/26139069
type: Comment
score: 0
type: AnswerComment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/26051082
tag name: maven-jaxb2-plugin

http://stackoverflow.com/comment/40976822
has text: Are you using Maven? If not, can you explain how your are building?
comment on: http://stackoverflow.com/q/26109412
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26149973
accepted answer of: http://stackoverflow.com/q/26146391
score: 8
has comment: http://stackoverflow.com/comment/40994073
has comment: http://stackoverflow.com/comment/111438421
has body: I got a solution for this: MaskFormatter formatter = new MaskFormatter("A-AAAA-AAAA-A"); formatter.setValueContainsLiteralCharacters(false); System.out.println(formatter.valueToString("1222233334")); The output would be 1-2222-3333-4 Check http://docs.oracle.com/javase/7/docs/api/javax/swing/text/MaskFormatter.html for more details
answers question: http://stackoverflow.com/q/26146391
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer

http://stackoverflow.com/q/26070041
has comment: http://stackoverflow.com/comment/40846728
downvote count: 1
has title: Synchronizing searches and modifications
type: Question
has answer: http://stackoverflow.com/a/26075089
tagged with: readwritelock
answer count: 1
has comment: http://stackoverflow.com/comment/40846205
favorite count: 0
tagged with: synchronization
type: UnansweredQuestion
tagged with: multithreading
score: 2
has body: What's a good way of allowing searches from multiple threads on a list (or other data structure), but preventing searches on the list and edits to the list on different threads from interleaving? I tried using synchronized blocks in the searching and editing methods, but that can cause unnecessary blocking when trying to run searches in multiple threads. EDIT: The ReadWriteLock is exactly what I was looking for! Thanks.
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/40995252
score: 5
comment on: http://stackoverflow.com/q/26151644
has text: It doesn't "preserve" the sign bit, it's just an artifact of the binary representation of -1.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40968849
comment on: http://stackoverflow.com/q/26137639
score: 2
type: Comment
type: QuestionComment
has text: How do you identify that two files are identical? By file name? If the answer is yes, file name should be the key.

http://stackoverflow.com/comment/40785250
score: 0
has text: Well, if I change from intellij to the browser the frame-deactivation should be called. If I'm using the shortcut i'm getting `Loaded classes are up to date. Nothing to reload`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26036889

http://stackoverflow.com/comment/41075613
has text: @Aabbccc You're welcome. I Erans answer is correct, then accept it by clicking the checkmark beneath the vote counter.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26194191
score: 0

http://stackoverflow.com/comment/40996615
has text: Hey man, I really appriciate your help. I did it in similair way to you here : http://pastebin.com/mXjeLCap but our professor told us to use the public static String quicksort(String y) method and I just can't think of any solution to do it.
comment on: http://stackoverflow.com/a/26152364
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40913626
type: QuestionComment
comment on: http://stackoverflow.com/q/26104557
score: 2
has text: In your actor's draw method, you are creating a new ImageButton and adding it. So after one second at 60fps, there are 60 buttons, and so on until you run out of memory. So behavior is going to be unexpected. One of your buttons might be fading out, but the other few hundred buttons are not, so you still see them. Only create your actors and atlases once when the class is instantiated.
type: Comment

http://stackoverflow.com/a/26135225
answers question: http://stackoverflow.com/q/26134879
downvote count: 0
has comment: http://stackoverflow.com/comment/40969864
score: 1
has comment: http://stackoverflow.com/comment/40968419
has comment: http://stackoverflow.com/comment/40969137
has body: The <mvc:interceptors /> are meant to be used with <mvc:annotation-driven /> it doesn't work for regular configured HandlerMapping beans. For those you need to configure their interceptors property. To solve your proble remove the <mvc:interceptors /> and add the configuration to the FlowHandlerMapping bean.
has comment: http://stackoverflow.com/comment/40969695
has comment: http://stackoverflow.com/comment/40970227
upvote count: 1
has comment: http://stackoverflow.com/comment/40969729
has comment: http://stackoverflow.com/comment/40969027
has comment: http://stackoverflow.com/comment/40969664
has comment: http://stackoverflow.com/comment/40966665
type: Answer

http://stackoverflow.com/q/26074351
answer count: 1
linked to: http://stackoverflow.com/q/686217
score: 0
tagged with: httpresponse
has comment: http://stackoverflow.com/comment/40854094
has answer: http://stackoverflow.com/a/26075200
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40853912
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: http-headers
has comment: http://stackoverflow.com/comment/40853874
tagged with: struts-1
has title: ArrayIndexOutOfBoundsException while writing JSON string to Printwriter in Struts
type: Question
has body: I am getting a List of rows from database and converting into JSONstring and writing it to PrintWritter to send output as JSON. I was able to write some number of rows until now it is giving me ArrayIndexOutOfBoundsException at the line pointed in the below code. Gson gson = new Gson(); String jsonString = gson.toJson(subAreaCriteriaList); response.setHeader("X-JSON", jsonString); PrintWriter writer = response.getWriter(); writer = response.getWriter(); writer.write(jsonString);//exception at this line writer.flush(); Here is my action method public Object doGetSubAreasifExist(BaseActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { CurrentRoute route = new CurrentRoute(); String areaID = request.getParameter("areaID"); LoginService bbcService = (LoginService) Context.getInstance() .getBean("LoginService"); DetachedCriteria subAreaCriteria = DetachedCriteria.forClass(CabArea.class); subAreaCriteria.add(Restrictions.ne(CabArea.PROP_ID, Long.parseLong(areaID))); List&lt;CabArea&gt; subAreaCriteriaList = bbcService.findAll(subAreaCriteria); Gson gson = new Gson(); String jsonString = gson.toJson(subAreaCriteriaList); response.setHeader("X-JSON", jsonString); PrintWriter writer = response.getWriter(); writer = response.getWriter(); writer.write(jsonString); writer.flush(); } catch (Exception e) { e.printStackTrace(); } return null; } here is my part of strut-config xml &lt;action path="/admin/cabsharing/getSubAreasifExist" type="com.ihexa.common.admin.cabsharing.action.CabsharingAction" name="actionForm"&gt; &lt;/action&gt; Here is my stacktrace java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:701) at org.apache.coyote.http11.InternalOutputBuffer.sendStatus(InternalOutputBuffer.java:438) at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1626) at org.apach…
accepted answer: http://stackoverflow.com/a/26075200
has comment: http://stackoverflow.com/comment/40854945

http://stackoverflow.com/comment/41050073
type: Comment
has text: In your question you are asking only for a match on the month (you wrote: "is current month or not."). As you already know, the code can be easily extended to check also for the year :) So, I you think this solutions works for you, please vote it up.
type: AnswerComment
comment on: http://stackoverflow.com/a/26180921
score: 0

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/26125033
tags question: http://stackoverflow.com/q/26172094
type: Tag

http://stackoverflow.com/q/26181125
has comment: http://stackoverflow.com/comment/41050760
has answer: http://stackoverflow.com/a/26181196
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41049914
type: Question
has comment: http://stackoverflow.com/comment/41050536
has title: How can I verify invocation of particular parent constructor?
tagged with: mocking
upvote count: 1
has body: I have a code of child class - public class A extends B { public A(User user, UserFilter filter) { super(user, filter); } /* the second possible option public A(User user, UserFilter filter) { super(user, filter, null); } */ } And the parent class - public class B { private User user; private UserFilter filter; private QRCode code; public B(User user, UserFilter filter) { this.user = user; this.filter = filter; } public B(User user, UserFilter filter, QRCode code) { this.user = user; this.filter = filter; this.code = code; } } I want to verify that only specific parent constructor being invoked. Not super(user, filter, null) but super(user, filter). It's important that I can add field, so check for null for code is inappropriate. I want to do that verification with PowerMockito.
answer count: 1
favorite count: 0
tagged with: powermock
has comment: http://stackoverflow.com/comment/41049949
has comment: http://stackoverflow.com/comment/41049911

http://stackoverflow.com/q/26091233
has answer: http://stackoverflow.com/a/26091274
has title: Is array size irrelevant in java?
answer count: 2
accepted answer: http://stackoverflow.com/a/26091251
tagged with: arrays
downvote count: 0
has body: As per the below statement, An array of subclass may be assigned to an array of its superclass. An array of implementing class may be assigned to an array of its interface type. Size is irrelevant. I wrote below sample code to check the behavior of size in array interface I{} class C implements I{} /* dummy.java*/ public class dummy{ public static void main(String[] args){ C[] c = new C[6]; I[] i = new I[2]; c[0] = new C(); c[1] = new C(); c[2] = new C(); c[3] = new C(); c[4] = new C(); c[5] = new C(); i = c; System.out.println(i[5].getClass()); } } When i say, new C[6];, an object [null,null,null,null,null,null] gets created of type class [LC and c points to this object. When i say, new I[2];, an object [null,null] gets created of type class [LI and i points to this object. My question: How interface array is working here, when i say i[5], despite an object [null, null] being created after defining new I[2]? What exactly is happening when i say i = c;? Is size of array of interface new I[2]; getting modified during assignment i = c;?
possible better answer: http://stackoverflow.com/a/26091274
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43596650
has answer: http://stackoverflow.com/a/26091251
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/26062115
has title: How do i create hibernate mappings for this situation?
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/26062329
has body: I have the following SQL query: SELECT CONNECTIONDATE AS UNLOAD, SUBSTR(ROUTECODE,1,(LENGTH(ROUTECODE)-2)) AS ROUTE, COUNT(SUBSTR(ROUTECODE,1,(LENGTH(ROUTECODE)-2))) AS FREQUENCY FROM RouteTableSynonym RC1 WHERE RC1.ROUTECONNECTIONTYPE = 'INBOUND' and RC1.CONNECTIONTIME &gt;= TO_TIMESTAMP('&lt;sdate&gt;', 'DD-MM-YYYY HH24:MI:SS') and RC1.CONNECTIONTIME &lt;= TO_TIMESTAMP('&lt;edate&gt;', 'DD-MM-YYYY HH24:MI:SS') and RC1.LOGISTICSPOINTID in (SELECT DISTINCT RCO1.LOGISTICSPOINTID FROM RouteOrderTableSynonym RCO1 WHERE RCO1.NAMC = '&lt;namc&gt;') GROUP BY CONNECTIONDATE, SUBSTR(ROUTECODE,1,(LENGTH(ROUTECODE)-2)) ORDER BY CONNECTIONDATE, ROUTE; All values designated by '&lt;var_name>' are replace with the values that being queried. I also have this entity class that will store the result of this query: import java.util.Date; public class DD_BlackoutRouteFrequencies { private Date rte_day; private String route; private int freq; private int delayedFreq; public Date getRte_day() { return rte_day; } public void setRte_day(Date rte_day) { this.rte_day = rte_day; } public String getRoute() { return route; } public void setRoute(String route) { this.route = route; } public int getFreq() { return freq; } public void setFreq(int freq) { this.freq = freq; } public int getDelayedFreq() { return delayedFreq; } public void setDelayedFreq(int delayedFreq) { this.delayedFreq = delayedFreq; } } I execute the query like this : try{ SQLQuery sqlquery = session.createSQLQuery(query); sqlquery.addEntity(DD_BlackoutRouteFrequencies.class); results = sqlquery.list(); logger.debug(results.size()); System.out.println("Frequnecy Results size: "+results.size()); }catch(Exception e){ logger.error("Exception ", e); throw new RuntimeException("SQL Exception getting Blackout Route Frequencies: "+ e.getMessage()); } The problem I am having is that I cannot figure out how to do the hibernate mapping for this entity to receive the results of this query which draws its results from two different tables…
score: 0
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/26062329

http://stackoverflow.com/q/26037098
possible better answer: http://stackoverflow.com/a/26037409
favorite count: 0
linked to: http://stackoverflow.com/q/13287515
type: Question
tagged with: dictionary
answer count: 6
has comment: http://stackoverflow.com/comment/40785136
has answer: http://stackoverflow.com/a/26100800
has comment: http://stackoverflow.com/comment/40785584
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26041113
has comment: http://stackoverflow.com/comment/40785165
accepted answer: http://stackoverflow.com/a/26100800
has comment: http://stackoverflow.com/comment/40785278
tagged with: performance
has comment: http://stackoverflow.com/comment/40897143
has comment: http://stackoverflow.com/comment/40898489
has answer: http://stackoverflow.com/a/26037298
has answer: http://stackoverflow.com/a/26037409
has answer: http://stackoverflow.com/a/26037572
has body: I have a map with huge amount of data being populated (around 300,000 records in approx) and iterating it as below , for (Map.Entry&lt;String, List&lt;ClassOBj&gt;&gt; entry : testMap .entrySet()) { // send email with map keys as email'id // email content is populated from the list // Perform a sql update to the column with the dyanamic value generated here with the email'id } As mentioned above , i am worried about the performance issues that will be caused of the above operation that is performed inside the for loop. Update: the scenario is . i am iterating a map which holds large amount of data, On iterating it i am getting the userid's and i have to make a computation of the user id .For example, consider userid+some constants and this should be updated in the database table. and also should be added to the email content along with list values from my map so i thought batch updates are not possible, am i correct with my understanding ? should i follow this approach ? or go with any alternate ideas
tagged with: for-loop
score: 2
has answer: http://stackoverflow.com/a/26037180
type: AnsweredQuestion
has title: ways to improve the performance of this scenario
downvote count: 0

http://stackoverflow.com/q/26138586
possible better answer: http://stackoverflow.com/a/26138660
has answer: http://stackoverflow.com/a/26138660
score: 0
accepted answer: http://stackoverflow.com/a/26138755
answer count: 3
has body: I have created a program in ProcessBuilder in java. Below is the program. I have created the program in Eclipse IDE. While executing the program is showing errors. //Demonstrate ProcessBuilder. public class ProcessBuilder { public static void main(String[] args) { ProcessBuilder proc=new ProcessBuilder("notepad.exe","testfile"); try { proc.start(); } catch(Exception e) { System.out.println("Error executing notepad."); } ProcessBuilder pb = new ProcessBuilder("java", "MyTest"); try { pb.start(); System.out.println("Process has been started."); } catch(IOException e) { e.printStackTrace(); } } The system is displaying the constructor ProcessBuilder is undefined. I have java 7 installed, jre 1.7 installed. Still I am unable to find the solution.
has title: ProcessBuilder not executing program correctly in java eclipse luna
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26138662
has answer: http://stackoverflow.com/a/26138755
type: Question

http://stackoverflow.com/comment/41037378
type: Comment
has text: Hi @EJP, if the application gets blocked on mmInStream.read and the (bytes==-1) part is not reached, How do I keep streaming more input into it, to reach that part and then break out of the loop with the read bytes, so I can finally use them to write the file on the Server?. Would you please write a sample script of the changes in my code?. Thank you very much.
type: AnswerComment
comment on: http://stackoverflow.com/a/26171535
score: 0

communication
tag name: communication
tags question: http://stackoverflow.com/q/26058234
type: Tag

http://stackoverflow.com/comment/40816411
has text: What is the war name and how you call it?
comment on: http://stackoverflow.com/q/26053908
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26034921
has comment: http://stackoverflow.com/comment/40782828
accepted answer of: http://stackoverflow.com/q/26034892
has comment: http://stackoverflow.com/comment/40781488
has comment: http://stackoverflow.com/comment/40781401
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26034892
has comment: http://stackoverflow.com/comment/40781377
upvote count: 3
has comment: http://stackoverflow.com/comment/40781500
has comment: http://stackoverflow.com/comment/40782172
downvote count: 1
has body: Lookbehinds need to be zero-width, thus quantifiers are not allowed. better remove the .* (?s)(?&lt;=Exception)&lt;The server started in RUNNING mode.&gt; Suppose you want to capture all the exceptions in the log use this : [\w]+Exception there is no need of using lookaheads or lookbehinds. update: If you are only concerned to know if the server started with exception or not I guess this will do it for you: (Exception[\s\S]*?The server started in RUNNING mode) you will get a match in the previous string but not in the second one.
has comment: http://stackoverflow.com/comment/40783595
type: Answer
score: 2

http://stackoverflow.com/q/26035677
tagged with: unit-testing
has body: Let's take a look at following class: class X { public void execute(Data[] data) { for (Data d : data) { MyExecutor e = new MyExecutor(d); e.execute(); } } } It's quite simple, but totally untestable if using Mockito. Solution is simple: introduce ExecutorFactory and DI it into X. But it means, that instead of four classes to implement new feature you are required to write 8, plus tests... in short, simple things become total hell. Question: How to rethink example above right to keep development/testing simple, but still durable? Update: MyExecutor has nothing to do with threads and ExecutorService. It's just some class, which consumes d, but doesn't change data in any way.
type: Question
has title: Simplicity/testability dilemma
has comment: http://stackoverflow.com/comment/40783322
has comment: http://stackoverflow.com/comment/40797225
has comment: http://stackoverflow.com/comment/40816578
upvote count: 1
has comment: http://stackoverflow.com/comment/40784253
duplicate of: http://stackoverflow.com/q/24884555
has comment: http://stackoverflow.com/comment/40784663
tagged with: junit
favorite count: 0
linked to: http://stackoverflow.com/q/24884555
tagged with: software-design
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40783095
answer count: 0
downvote count: 0
score: 1
tagged with: java

netbeans-platform
tags question: http://stackoverflow.com/q/26037366
tags question: http://stackoverflow.com/q/26139122
tags question: http://stackoverflow.com/q/26054610
tag name: netbeans-platform
tags question: http://stackoverflow.com/q/26036355
type: Tag
tags question: http://stackoverflow.com/q/26075103

http://stackoverflow.com/comment/41028350
type: AnswerComment
score: 0
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62372/discussion-between-clemencio-morales-lucas-and-user3050751).
comment on: http://stackoverflow.com/a/26157821

http://stackoverflow.com/a/26059196
score: 0
type: Answer
has body: You can't cast a character into a boolean value, because how should the program know that 'y' means true and 'n' means false? Use an if statement bool married = false; if(input.equalsIgnoreCase("y")) married = true; I bet a simple google search would have helped you with your homework.
answers question: http://stackoverflow.com/q/26059061

http://stackoverflow.com/q/26095905
has body: I'm doing a school project where we are supposed to tap into an existing database using web services. I'm trying to figure out what best practice is when calling a web service from back end. I've been working with Servlets before and I know them pretty well. This is my web service that front end uses and I need to know what the best practice is when calling an external web service within my application: @GET @Path("requestAccess") public void getAccessToken(@Context HttpServletRequest request, @Context HttpServletResponse response) { String code = request.getParameter("code"); String clientId = "4_4inr3rkl04ys44kowwgoo0w4g8gow0s84cw0o0cg48kogsosc0"; String clientSecret = "4cxgpduio8isgcc8oggsw8wkcokcksk8wc8cc088w4w40owg4s"; String redirectUrl = "http://localhost:8080/salesgoals/rest/oauth/requestAccess"; try { URL url = new URL("https://.../oauth/v2/token?client_id="+clientId+"&amp;client_secret="+clientSecret+"&amp;grant_type=authorization_code&amp;redirect_uri="+redirectUrl+"&amp;code="+code); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream())); String strTemp = ""; while(null != (strTemp = bufferedReader.readLine())){ System.out.println(strTemp); } } catch(Exception e){e.printStackTrace();} } This returns me an access token and the results from the external web service are JSON objects and the url object with inputstreamReader is something temp. I used to see if I was successful receiving access token. Now I need to use the access token to invoke external web services but I dont know what best practice is when it comes to calling it within the application. I'm used to HttpServletRequest/Response objects. As I said all the data is returned as json.
has title: best practice invoking webservices
answer count: 1
score: 0
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26097238
tagged with: web-services
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/40884664
type: QuestionComment
comment on: http://stackoverflow.com/q/26090986
has text: It takes in an int value and determines the odd numbers and powers of two that are less than the value entered. This is just the driver program.
score: 0
type: Comment

http://stackoverflow.com/comment/40805535
score: 3
comment on: http://stackoverflow.com/q/26047789
type: QuestionComment
has text: Err... `array[i] = array[i+1]` is the problem... try `array[i] = array[(i+1)%array.length]`. Make sure to use a temporary array too.
type: Comment

http://stackoverflow.com/comment/41037186
score: 0
type: Comment
type: QuestionComment
has text: Use your debugger, execute the code line by line, inspect the variables at each step.
comment on: http://stackoverflow.com/q/26174219

http://stackoverflow.com/comment/40868513
score: 0
comment on: http://stackoverflow.com/a/26081742
type: Comment
has text: I want my array list to be populated with dictionary items in the Dictionary Class, under main, when it is reading lines from the file. And just for Find Words (and other classes) to be able to reference this. Thank you so much. I appreciate this a lot.
type: AnswerComment

http://stackoverflow.com/q/26106664
has answer: http://stackoverflow.com/a/26106747
has answer: http://stackoverflow.com/a/26106944
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/26106763
has comment: http://stackoverflow.com/comment/40913087
accepted answer: http://stackoverflow.com/a/26106763
upvote count: 0
has title: How to get two outcomes after a Do statement has been terminated?
tagged with: arrays
has comment: http://stackoverflow.com/comment/40913099
tagged with: string
has answer: http://stackoverflow.com/a/26106759
possible better answer: http://stackoverflow.com/a/26106749
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26106749
has comment: http://stackoverflow.com/comment/40913122
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/40913026
has body: I need two outcomes after a Do Else While statement, right now the user can input data and it will be stored in a String, if they want to add anything else they type 'y', if 'n' it will end the program and tell them what they've inputed. If they input neither of those and input 'd' for example it stops the statement running and takes me through to the Else statement In the Else statement I want two outcomes, either "You have added the following" and "Error, you inputted something wrong" Here is the Do Else While statement: do { System.out.println("Current list is " + list); System.out.println("Add more? (y/n)"); if (input.next().startsWith("y")) { System.out.println("Enter : "); list.add(input.next()); } else { System.out.println("You have added the following:"); System.out.println("Error, you inputted something wrong"); break; } } while (true); What do I write to get two outcomes depending on what the user has done? (said 'n' or wrote something wrong).
downvote count: 1

http://stackoverflow.com/q/26124097
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40958034
tagged with: openshift
has comment: http://stackoverflow.com/comment/40944406
has body: I have Java EE application deployed to Openshift. It is created from example and modified. I deployed application and worked fine, then I changes 3 css files, pushed to Openshift, but from that time application is not running. I tried restart (sometimes tells me could not restart, sometimes restarted), but no result - application is displaying blank page or 503 error. What could be a problem? On my local system, app is working fine, using MySQL DB. And MySQL is running on Openshif, I can connect to it. URL: http://gympel.mojefotogalerie.com/ How can I download some log files from Openshift to look at? Or what could be the reason while before that change (only 3 css files changed) everything went well? C:\Users\Marek>rhc tail gympel ==&gt; app-root/logs/jbosseap.log &lt;== JBOSS_HOME: /var/lib/openshift/542a6df0e0b8cdee1a00016b/jbosseap JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java JAVA_OPTS: -server -XX:+TieredCompilation -Xms40m -Xmx256m -XX:MaxPermSize=10 2m -XX:+AggressiveOpts -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTim eRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dorg.apache.tomcat.util.LOW_MEMORY=tru e -DOPENSHIFT_APP_UUID=542a6df0e0b8cdee1a00016b -Dorg.jboss.resolver.warning=tru e -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djboss.node.name=gympel -marek71cz.rhcloud.com -Djgroups.bind_addr=127.8.71.129 -Dorg.apache.coyote.http 11.Http11Protocol.COMPRESSION=on ========================================================================= ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /var/lib/openshift/542a6df0e0b8cdee1a00016b/jbosseap JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java JAVA_OPTS: -server -XX:+TieredCompilation -Xms40m -Xmx256m -XX:MaxPermSize=10 2m -XX:+AggressiveOpts -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTim eRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dorg.apache.tomcat.util.LOW_MEMORY=tru e -DOPENSHIFT_APP_UUID=542a6df0e0b8cdee1a00016b -Dorg.jboss…
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has title: Openshift application cannot start
has answer: http://stackoverflow.com/a/26132622
answer count: 1
downvote count: 0
tagged with: jboss-eap-6
favorite count: 0

http://stackoverflow.com/comment/40854328
comment on: http://stackoverflow.com/q/26074717
type: Comment
type: QuestionComment
score: 0
has text: PS: I deleted my comment after the edit. I was asking if the OP has the `main` inside `for (;;) { ... }`. However, this edit changed a lot.

http://stackoverflow.com/q/26172015
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26172034
upvote count: 1
downvote count: 1
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/26172053
has title: Method declaration on employee1 invalid need return type
has answer: http://stackoverflow.com/a/26172053
accepted answer: http://stackoverflow.com/a/26172034
score: 0
answer count: 2
favorite count: 0
has body: I am getting an error on public static Employee1 saying it needs a return type required and that the method declaration is invalid. Ive tried changing it around but I don't know what I am doing wrong. I am sorry I am kind of new to java import java.util.Scanner; public class aleko_Employee1 extends Object { private String firstName; private String lastName; private char middleInitial; private boolean fulltime; private char gender; private int employeeNum; private static Scanner in = new Scanner(System.in); public class aleko_Employee1 { public static void main(String args[]) { aleko_Employee1 employee1 = new aleko_Employee1("Jeff", "Doe", 'M', 12345); aleko_Employee1 employee2 = new aleko_Employee1("Jeffery", "Doe", 'M', 12345); aleko_Employee1 employee3 = new aleko_Employee1("Amanda", "Smith", 'M', 98765); } public static Employee1(String fn, String ln, char g, int en) { firstName = fn; lastName = ln; gender = g; employeNum = en; } public void setfirstName(String fn) { firstName = fn; } public String getFirstName() { return firstName; } public void setLastName(String ln) { lastName=ln; } public String getLastName() { return lastName; } public void setGender(char g) { gender =g; } public char getGender() { return gender; } public void setEmployeeNumber(int en) { if ( en &gt; 99999 || en &lt; 10000) { employeeNum = en; } else { employeeNum = 0; } } public int getEmployeeNumber(); { return employeeNum; } public boolean equals( Object e2) { if (this.employeeNum == ((Employee1)e2).employeeNum) { return true; } else { return false; } } public String toString() { return lastName + ","+ "\n" + "ID:" + employeeNum + "\n"; } } }

http://stackoverflow.com/comment/40855558
type: QuestionComment
comment on: http://stackoverflow.com/q/26075355
score: 0
has text: Is each grades are different number for each student ?
type: Comment

http://stackoverflow.com/a/26092264
score: 0
has body: Here's what happened for posterity. I had the object as described above and set the object values as described as well. The problem is, I was also passing in a value for that object through intent extras. Here's where the code above blew up on me. When I passed that object from another activity; it reset the value of "label" to null as declared in the new object. The string in the object with a default value of null was my issue. My solution was to change String label = null; To String label = new String(); And I no longer got the null pointer exception. I will edit this answer with more detail if anyone has any more questions. Please comment if more detail is required.
type: Answer
answers question: http://stackoverflow.com/q/26080542
accepted answer of: http://stackoverflow.com/q/26080542
type: AcceptedAnswer

http://stackoverflow.com/a/26122154
type: Answer
has comment: http://stackoverflow.com/comment/40941002
has comment: http://stackoverflow.com/comment/40946112
answers question: http://stackoverflow.com/q/26122004
has comment: http://stackoverflow.com/comment/139834982
has comment: http://stackoverflow.com/comment/40946862
score: 0
has body: Use Calendar , for example : TimeZone timeZone= TimeZone.getTimeZone("Europe/London")); Calendar cal = Calendar.getInstance(timeZone); also , the good thing about dates is that they arent dependant of TimeZone , its just time in millis since epoch (some time a while back) . The way you are using it now is actually the right solution .
has comment: http://stackoverflow.com/comment/40942958

http://stackoverflow.com/comment/40891565
has text: Edit: Ninja'd by a faster typer. Dirk's answer is more legible too. Would upvote but not enough rep, sorry Dirk.
score: 0
comment on: http://stackoverflow.com/a/26094730
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41012482
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26161005
has text: I know this one exists, but the problem here is, that is isn´t as easy to make it dynamically as the update and insert functions, while it should be able to.

http://stackoverflow.com/a/26041746
has comment: http://stackoverflow.com/comment/40798426
has body: Delete you local .m2 repository and let it re-download all needed jars. Maybe, there were issues while downloading one of the dependencies.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26041383

tcp
type: Tag
tags question: http://stackoverflow.com/q/26105972
tags question: http://stackoverflow.com/q/26107240
tags question: http://stackoverflow.com/q/26150646
tags question: http://stackoverflow.com/q/26183348
tags question: http://stackoverflow.com/q/26114012
tags question: http://stackoverflow.com/q/26057034
tags question: http://stackoverflow.com/q/26191346
tags question: http://stackoverflow.com/q/26078104
tag name: tcp
tags question: http://stackoverflow.com/q/26046629

http://stackoverflow.com/comment/40967450
type: AnswerComment
comment on: http://stackoverflow.com/a/26124066
score: 0
type: Comment
has text: ``Error: Could not find or load main class qtpractice.JambiApp``

http://stackoverflow.com/q/26035706
has body: I am reading a particular excel template in Java using Apache POI. There are some unwanted fields at the bottom (like a small guide) which I need to skip. So I want to stop the iteration whenever POI finds that a row is completely blank and hence the fields at the bottom will be skipped automatically. I found many ways to handle a blank CELL but my requirement is for a complete row.
has title: How do I stop iteration in Java using Apache POI
score: 0
answer count: 1
tagged with: apache-poi
tagged with: excel
has comment: http://stackoverflow.com/comment/40793913
accepted answer: http://stackoverflow.com/a/26039058
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40814386
tagged with: java
has answer: http://stackoverflow.com/a/26039058
type: Question

http://stackoverflow.com/comment/40896780
type: AnswerComment
has text: The First Method would not impact instance of the class So that is the reason why it is thread safe @TheLostMind
type: Comment
comment on: http://stackoverflow.com/a/26097670
score: 0

http://stackoverflow.com/comment/40800357
type: QuestionComment
comment on: http://stackoverflow.com/q/26045124
has text: Doesn't [Statement.executeUpdate](http://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#executeUpdate-java.lang.String-) already return the number of affected rows by your update?
score: 2
type: Comment

http://stackoverflow.com/comment/40862990
has text: Apologies, I'm looking for the reverse - a tailMap in C# (My understanding is TreeMap => SortedDictionary in C#, but alas, SortedDictionary appears to have no tailMap
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26079218

http://stackoverflow.com/q/26170708
type: AnsweredQuestion
has body: So I don't think I'm bad at math, and I don't think translating simple math distance formulas into code is that difficult if I knew what I was doing. Which apparently I don't. Long story short, I'm supposed to calculate the distance between two 3D points and for some reason, my formula isn't working correctly. I don't know if I just wrote it wrong or if something is off, because I've written it multiple times and it still doesn't work right. This is my public class Distance, which has my distance formula public class Distance { Distance () {} double d; double x1, x2, y1, y2, z1, z2; public void setD (double d) { this.d = d; } double distance () { /* return Math.sqrt ( Math.pow (( x2 - x1 ), 2 ) + Math.pow (( y2 - y1 ), 2 ) + Math.pow (( z2 - z1 ), 2 )); */ return Math.sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) + ( z2 - z1 ) * ( z2 - z1 ) ); } } I've tried writing it two ways, both of which test to 0 (I'm using a nested for loop, with all variables looping up to 3, to test before I write for user input). If anyone could explain why I'm getting this problem, it would be much appreciated. Edit: I know people are telling me to initialize to a certain value. I'm pretty sure I initialized it in my test loop, which I realize I should have posted for clarity. class Distance_test { public static void main ( String [] args ) { Distance line = new Distance (); double d; for ( double x1 = 0; x1 &lt;= 2; x1++ ) { line.setD ( x1 ); d = line.distance(); for ( double x2 = 0; x2 &lt;= 2; x2++ ) { line.setD ( x2 ); for ( double y1 = 0; y1 &lt;= 2; y1++ ) { line.setD ( y1 ); for ( double y2 = 0; y2 &lt;= 2; y2++ ) { line.setD ( y2 ); for ( double z1 = 0; z1 &lt;= 2; z1++ ) { line.setD ( z1 ); for ( double z2 = 0; z2 &lt;= 2; z2++ ) { line.setD ( z2 ); System.out.printf ( "\n Distance of 3D line with points %.2f, %.2f, %.2f, %.2f, %.2f, %.2f is %.2f\n", x1, x2, y1, y2, z1, z2, line.distance() ); } } } } } } } } And yes, I do think it's a bit messy but I'm just trying …
tagged with: math
tagged with: java
type: Question
has title: Math.pow and Math.sqrt formula returning value of 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26170767
has answer: http://stackoverflow.com/a/26170767
has comment: http://stackoverflow.com/comment/41031003
has comment: http://stackoverflow.com/comment/41030751
score: 0
has answer: http://stackoverflow.com/a/26170771
accepted answer: http://stackoverflow.com/a/26170771

http://stackoverflow.com/a/26112220
score: 1
upvote count: 1
has body: You're passing the whole object inside the foreach instead of the ArrayList you actually want to iterate on. You're only putting one StudentResult into the model, but StudentResult.results is the arrayList. (That's assuming that you want to iterate on StudentResult.results) If not, try adding Arrays.asList(resultService.getStudentResult(regNo)) to your model instead, and your foreach should work, but only print one result. Also, the taglib is incorrect as user23123412 mentioned.
has comment: http://stackoverflow.com/comment/40922933
downvote count: 0
answers question: http://stackoverflow.com/q/26111679
type: Answer

http://stackoverflow.com/q/26136380
upvote count: 3
type: UnansweredQuestion
has body: I have a service in running, its integrated with MongoDB to add data to MongoDB and handle analytics queries. The raw data is very unstructured and while storing its manupulated a bit brought to single level and stored in MongoDB collections. The transformation are performed using Meta-Data, meta data some what like this : { "DeviceCategory":"DeviceCategoryName", "ObjectIdentifier":"CollectionName" //Collection where document needs to be inserted "Node": [ "node1", "node2" // embeded nodes in raw data ], "ExtraFields": [ //using this extra fields are added to raw data to handle queries { "TargetCollection": "TargetCollectionName", //collection to query for document "QueryParams": [ //parameter needed to query "Param1", "Param2" ], "Keys": [ { "KeyToMap": "KeyName", //field to extract from returned document "TargetKey": "NewKeyName" //key name to be added with value to KeyToMap }, ..... ] }, { "Collection": "TargetCollectionName", "QueryParams": [ "Param1" ], "Keys": [ { "KeyToMap": "KeyName", "TargetKey": "NewKeyName" }, ...... ] } ] } I have stored this Meta-Data in meta_data collection in MongoDB and query it for every insertion request. I want to cache this data at the start of the service. I am looking for a good caching solution in dropwizard. I have went through dropwizard document but its still not that clear to me how to use cache in dropwizard.I need something to help me start using the cache. The service is running and it dropwizard version is 0.6.2. Thanks!!!
has title: Use cache in Dropwizard?
score: 3
tagged with: java
tagged with: caching
type: Question
tagged with: mongodb
downvote count: 0
answer count: 1
favorite count: 0
tagged with: dropwizard
has answer: http://stackoverflow.com/a/27404175
tagged with: metadata

http://stackoverflow.com/q/26135083
possible better answer: http://stackoverflow.com/a/26135200
has body: I am new to hibernate framework. i made a sample project just to test hibernate. i set up the project. but when i run it i got this error org.hibernate.HibernateException: /hibernate.cfg.xml not found at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405) at org.hibernate.cfg.Configuration.configure(Configuration.java:1427) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:972) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69) at org.hibernate.cfg.Configuration.configure(Configuration.java:1414) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:966) The Hibernate.cfg.xml file that i put in the main package of the project. <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.DerbyDialect thread true 2 org.hibernate.cache.NoCacheProvider org.apache.derby.jdbc.ClientDriver jdbc:derby://localhost:1527/NetworkDB <!-- <mapping resource="Employee.hbm.xml"/>--> </hibernate-configuration> I am using netbeans 7.0
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate Configration file error
has answer: http://stackoverflow.com/a/26135144
has answer: http://stackoverflow.com/a/26135200
accepted answer: http://stackoverflow.com/a/26135144
score: 0
answer count: 2

http://stackoverflow.com/q/26038024
has body: Is it a good idea to write example data within a class which can be instantiated? In the following example, i am using some static var's which are used to get direct access to some Contacts via: Contact.contact101() ... I am using this example data definition within a test and don't want to write a kind of util class which contains all the example data. package com.example.webdriver.util.builder.model; import com.google.gson.annotations.SerializedName; import com.example.webdriver.util.builder.LocalStorageBuilder; import com.example.webdriver.util.builder.enumaration.UserStatus; public class Contact { @SerializedName("ID") private Long id; @SerializedName("puid") private Long principleUserId; @SerializedName("cuid") private Long contactUserId; @SerializedName("v") private int visible; @SerializedName("ustat") private String userStatus; @SerializedName("ats") private Long addedTimeStamp; private static Contact contact101; private static Contact contact102; private static Contact contact305; private static Contact contact302; private static Contact contact301; private static Contact contact382; public Contact() { this.id = LocalStorageBuilder.getContactIdCounter(); this.principleUserId = LocalStorageBuilder.principalUserId; this.contactUserId = 301L; this.visible = 1; this.userStatus = String.valueOf(UserStatus.ONLINE.getUserStatus()); this.addedTimeStamp = 1410168552386L; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getPrincipleUserId() { return principleUserId; } public void setPrincipleUserId(Long principleUserId) { this.principleUserId = principleUserId; } public int getVisible() { return visible; } public void setVisible(boolean visible) { if (visible) { this.visible = 1; } else { this.visible = 0; } } public String getUserStatus() { return userStatus; } public void setUserStatus(UserStatus userStatus) { this.userStatus = String.valueOf(userStatus.getUserStatus()); } public Long getAddedTimeStamp() { return addedTi…
type: Question
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40786777
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26038074
has comment: http://stackoverflow.com/comment/40786737
has answer: http://stackoverflow.com/a/26038116
tagged with: java
has title: Example data within a class - Good or bad practise?

http://stackoverflow.com/comment/40997970
type: QuestionComment
comment on: http://stackoverflow.com/q/26153104
has text: Oh sorry i am in java. I dont know if there are different forms of java. Thanks for answering so fast :D
score: 0
type: Comment

http://stackoverflow.com/comment/40922768
comment on: http://stackoverflow.com/a/26112055
score: 0
type: AnswerComment
type: Comment
has text: What if the string has numbers or punctuation? Then it won't work.

http://stackoverflow.com/q/26158705
answer count: 1
type: UnansweredQuestion
has title: JFrame not running properly inside a thread
has answer: http://stackoverflow.com/a/26158798
has comment: http://stackoverflow.com/comment/41028243
type: Question
tagged with: multithreading
tagged with: swing
has body: I am trying to run a simple game where there is a server and a client talking to each other to do updates, at the moment I am not doing much between the server and the client just sending some meaningless stuff. My problem is that my 'clientframe' which extends JFrame, is not displaying properly when I try to make a new clientframe inside the run method of my 'slave' (the client) which is a thread. My clientframe works fine when it is run with its own main method but for some reason is draws a black screen with a small white rectangle in the top corner when I try to make a new clientframe inside the run method of the slave class. I realise this is not enough code to run it, and I have spent hours trying to debug it but I am stuck, thank you! public final class Slave extends Thread { private final Socket socket; private NetworkHandler game; private DataOutputStream output; private DataInputStream input; private int uid; private int totalSent; private List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;() ; private Update lastSentUpdate; /** * Construct a slave connection from a socket. * * @param socket */ public Slave(Socket socket) { this.socket = socket; } public void run() { try { output = new DataOutputStream(socket.getOutputStream()); input = new DataInputStream(socket.getInputStream()); game = new NetworkHandler(NetworkHandler.Type.CLIENT); PlayableCharacter ch = game.getGameUtill().findCharacter(uid); ClientFrame frame = new ClientFrame(game, uid, true, ch); while(true){ uid = input.readInt(); // now read the other players IDs int noPlayers = input.readInt(); List&lt;Integer&gt; playerIds = new ArrayList&lt;Integer&gt;(); for(; noPlayers&gt;0; noPlayers--){ playerIds.add(input.readInt()); } numbers = playerIds; } socket.close(); // release socket ... v.important! } catch(IOException e) { System.err.println("I/O Error: " + e.getMessage()); e.printStackTrace(System.err); } } public List&lt;Integer&gt; getNumbers (){ return numbers; } public int getUID(){ …
score: 0
tagged with: java

http://stackoverflow.com/q/26076654
answer count: 3
has answer: http://stackoverflow.com/a/26076889
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40858362
type: UnansweredQuestion
has body: Give an input string such as "abbbcaababbbcaaabbca" I want to split such a string into an array of groups "bca" "ab" "a" and "b" So the above example would return "ab", "b", "bca", "ab", "ab", "b", "bca", "a", "ab", "bca". I have a 29 line piece of code of nested loops that accomplish this task (returns ArrayList). However, it would be nice to get this done with a one line regular expression. Can this task be accomplished using the following method? stringVar.split("regEX")
upvote count: 1
has answer: http://stackoverflow.com/a/26076765
tagged with: regex
has comment: http://stackoverflow.com/comment/40857951
score: 1
has answer: http://stackoverflow.com/a/26077074
tagged with: java
type: Question
has title: java string split regular expression retain delimiter
tagged with: arrays
has comment: http://stackoverflow.com/comment/40857975
has comment: http://stackoverflow.com/comment/40857955

http://stackoverflow.com/q/26049196
type: Question
has body: I want to send a TCPMessage from my Java TCP-Client to my Visual Basic server. The server uses the BinaryReader.ReadString() function. http://msdn.microsoft.com/en-US/library/system.io.binaryreader.readstring.aspx The ReadString function expects a 7bit-length prefix of the size of the string. Currently this is my code, but the server doesn't recognize the message. public void sendMessage(String message) { if (out != null &amp;&amp; !out.checkError()) { out.print(message.length()); out.println(message); out.flush(); } } And I can't change the whole server architecture to make it recognize the string e.g. From ReadLine. Hope that somebody can help, trying it now for hours.
tagged with: java
has comment: http://stackoverflow.com/comment/40808570
has comment: http://stackoverflow.com/comment/40809397
answer count: 1
has title: Sending String from Java to .NET BinaryReader.ReadString
linked to: http://stackoverflow.com/q/19710688
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40808980
has answer: http://stackoverflow.com/a/26049535
score: 0

http://stackoverflow.com/comment/40824777
has text: Your compareTo method is wrong. You should return the difference between the floors
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26058700

http://stackoverflow.com/a/35738172
answers question: http://stackoverflow.com/q/26137303
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26137303
has body: Finally cracked this up - For xml to json conversion - Parse the xml schema (JAXB) and create objects that can be stored in memory validate the xml with respect to the schema object created Create instance object of the xml string w.r.t the schema classes Use that instance to come up with the json string. This way the json string will have data types as the schema dictates. E.g. - a particular element defined repeating in the schema will appear as a json array even if its occurrence is 1 in the xml (it wont be converted to json object). element with value 123 will be interpreted as string if explicitly defined in the schema and not implicitly converted to integer. Contact me if anyone wants the code for it.
type: AcceptedAnswer
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26059744
score: 1
answers question: http://stackoverflow.com/q/26052263
downvote count: 0
has body: Ok, i figured where my problem was at. It wasnt at my client (Java) but at my server (Ruby). When i do the SQL query to figure out if theres a use registered with the data sent through the socket, when there was not registries found, i wasnt sending any response back to the client. See as i had this line: puts "Empty" Which was literally just printing the result in my server log. By changing the respond to actually be delivered to the client, i just did this: client.puts "Empty" Therefore, my java client had a response from the server both times (when the sql query returned something or not) and it doesn't hang up anymore, which i assume was caused by the client "listening" and expecting a replied from the server, but never really getting any at all (unless the sql query returned something other than nil). Hope this is useful for anyone in the future. Thanks to everyone who took some time to review/replied to my message.
type: Answer
upvote count: 1

http://stackoverflow.com/q/26184989
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26189463
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41059339
has comment: http://stackoverflow.com/comment/41063313
has comment: http://stackoverflow.com/comment/41061243
linked to: http://stackoverflow.com/q/9954759
has comment: http://stackoverflow.com/comment/41067627
has body: I am starting to port my games over to Android from iOS and I've run into a problem. In my standard workflow on iOS I would store my vertex info in an array of structs: typedef struct{ float x, y, z; } Vector3; Vector3 verts[]; That sort of thing. Then when it came time to send my vertex data to GL, I would just point to the verts array and it would treat it like an array of floats. glVertexAttribPointer(Vertex_POSITION, 3, GL_FLOAT, 0, 0, (void *)verts); How do I do this in Java? I tried making a Vector3 class and putting a few of them into an array, but it throws an error when I try to stuff that array into GL.
has comment: http://stackoverflow.com/comment/41057919
tagged with: opengl-es-2.0
has answer: http://stackoverflow.com/a/26189463
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41057520
tagged with: java
linked to: http://stackoverflow.com/q/15380491
type: Question
has comment: http://stackoverflow.com/comment/41062154
has title: Pass array of Java vertex objects to OpenGL entry points

http://stackoverflow.com/q/26072281
has title: How to add more value on java string array?
answer count: 4
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26072324
has body: I have a listview. private String[] listView2 = {"aa","aa","aa"}; int a = 0; Int values will decide to add the number of content So if a==2. listView2 = {"aa","aa"}; if a==5 listView2 = {"aa","aa","aa","aa","aa"};
type: Question
has answer: http://stackoverflow.com/a/26072351
has answer: http://stackoverflow.com/a/26072328
score: 0
has answer: http://stackoverflow.com/a/26072323

http://stackoverflow.com/q/26088153
has comment: http://stackoverflow.com/comment/40879719
answer count: 0
score: 0
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/40879142
type: Question
linked to: http://stackoverflow.com/q/218384
has body: I have been struggling a lot with a NullPointerException on a class method. The problem is that when I call variables that are initialized on the constructor, they return null. Remember that the KitGUI extends GUI. package src.foundation.core.game.kit; import org.bukkit.entity.Player; import src.foundation.core.GUI; import src.foundation.core.game.Game; import src.foundation.core.game.Kit; import src.foundation.core.util.ItemStackFactory; public class KitGUI extends GUI { private Game game; private Player player; public KitGUI(Game game, Player player) { super(player, "Select Kit", 27); this.game = game; this.player = player; } public void addItems() { for (Kit kit : this.game.getKits()) { // NullPointerException... addMenuItem(ItemStackFactory.createItem(kit.getDisplay())); } } public void checkItems() { for (Kit kit : game.getKits()) { if (getClick().getItemMeta().getDisplayName().contains(kit.getName())) { game.selectKit(getPlayer(), kit); break; } } } } And the GUI class: package src.foundation.core; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; public abstract class GUI extends Module { private String name; private int slots; private Inventory inventory; private Player player; private ItemStack choice; public GUI(Player player, String name, int slots) { super("GUI"); this.name = name; this.slots = slots; this.player = player; this.inventory = Bukkit.createInventory(null, this.slots, this.name); addItems(); this.player.openInventory(inventory); } public abstract void addItems(); public abstract void checkItems(); public void addMenuItem(ItemStack item) { this.inventory.addItem(item); } public Inventory getInventory() { return this.inventory; } public ItemStack getClick() { return this.choice; } publi…
has comment: http://stackoverflow.com/comment/40879195
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/40879439
has title: NullPointerException on constructor parameters
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40879649
has comment: http://stackoverflow.com/comment/40879373

http://stackoverflow.com/q/26132734
score: 1
tagged with: data-structures
favorite count: 0
tagged with: doubly-linked-list
has comment: http://stackoverflow.com/comment/40961685
tagged with: linked-list
has title: Is it possible to remove from an indexed data structure and avoid shifting at the same time?
upvote count: 2
type: UnansweredQuestion
has body: I have: 0 =&gt; a 1 =&gt; x 2 =&gt; A ... 1356 =&gt; w 1357 =&gt; o As of it is now, i can easily get pos 555 because it is indexed, in other words, no linear search is required. Now if I remove position 333, everything above it will have to be shifted because next time I call get(555) the element removed will be the old 556 which is now the new 555 after the shift. But shifting is expensive when your list is large. Is there a way to remove without shifting and still keep everything correctly indexed? The first thing that comes to mind is a doubled-linked-list, but it is not indexed. Do I need some weird combination of data structures here to save on shifting and still have indexes?
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40961449
has comment: http://stackoverflow.com/comment/40960481
has comment: http://stackoverflow.com/comment/40960564
type: Question
has answer: http://stackoverflow.com/a/26133345
tagged with: arrays
answer count: 1

http://stackoverflow.com/q/26071861
has title: Dropbox couldn't find resource trusted-certs.jks
has comment: http://stackoverflow.com/comment/40850885
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has body: I am trying to just normally use the dropbox java api in a bukkit plugin but for some reason it just won't work. Here is the code for the dropbox part: public DbxClient client; final String APP_KEY = "&lt;REDACTED&gt;"; final String APP_SECRET = "&lt;REDACTED&gt;"; DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET); DbxRequestConfig config = new DbxRequestConfig( "JavaTutorial/1.0", Locale.getDefault().toString()); DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo); String authorizeUrl = webAuth.start(); public void geturl(Player p){ p.sendMessage(authorizeUrl); } public void authorize(String code){ try{ DbxAuthFinish authFinish = webAuth.finish(code); String accessToken = authFinish.accessToken; client = new DbxClient(config, accessToken); } catch(DbxException e){} } public void upload(String fullpath){ try { File inputFile = new File(fullpath); FileInputStream inputStream = new FileInputStream(inputFile); DbxEntry.File uploadedFile = client.uploadFile(fullpath, DbxWriteMode.add(), inputFile.length(), inputStream); inputStream.close(); } catch(DbxException| IOException e){} Anyway, the geturl works fine, it returns an url that I click and copy the code that I get. I then proceed to running authorize with that code as an argument and I get this error: org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:483) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks] at net.minecraft.server.v1_7_R4.PlayerConnection.chat(PlayerConnection.java:882) [craftbukkit.jar:…
tagged with: dropbox
tagged with: ssl
has answer: http://stackoverflow.com/a/26371201
answer count: 1
has comment: http://stackoverflow.com/comment/40855891

http://stackoverflow.com/a/26055952
has body: That depends. Do you have the source code of this external application, i.e. can you recompile it? The easiest approach is obviously to fix the leak at its root. This might however be impractical. If the library, as you say, is implemented via native methods and some C code, I do not think that the problem has something to do with the Java garbage collector not properly working. Native methods and C code do not normally store their data on the JVM's heap and are therefore not garbage collected, i.e. it is the job of the library to clean up after itself. If the leak is indeed in the bit of Java code that the library exposes, than there is a way. Memory leaks in Java occure by forgetting about references, e.g. consider the following example: class Foo { private ExpensiveObject eo; Foo(ExpensiveObject eo) { this.eo = eo; } } The ExpensiveObject is alive (at least) as long as its referencing Foo instance. If you (or your library) do(es) not isolate instance life-cycles well enough, you get into trouble. If you do not have a chance to refactor, you can however use reflection to clean up the biggest mess from another place in your code: void release(Foo foo) { Field f = Foo.class.getDeclaredField("eo"); f.setAccessible(true); f.set(foo, null); } This should however be considered a last-resort as it is quite a hack. Alternatively, a better approach is normally to fork another instance of a JVM to do the dirty work. It seems like you are doing something similar already. By forking a JVM, you isolate the use of memory on a process level. Once the process dies, all memory is released by the OS. The problem with this approach is normally platform compatibility but as you already use a native library, this does not worsen your situation. You say that you currently use files to communicate between these different processes. Why do you need to store data in a file? Rather consider using sockets or memory-mapped files (NIO), if performance is important for this matter.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26055630
downvote count: 0
score: 1

http://stackoverflow.com/q/26136521
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40967072
has body: I have a Servlet which I call from an ajax function. What I want to do is to forward the same request (header, cookie, etc.) to a different url on localhost. I have to call a hidden php api (not public available by apache2) which I want to call with the original php session (cookie and headers). I am sure there is a simple way to do this but I have not found something easier than making a HttpURLConnection and fill in all the data by foot. Is this really the only option?
has comment: http://stackoverflow.com/comment/40967969
answer count: 0
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40968722
has title: Clone a http request and forward it to different server on localhost
score: 4
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40969012
has comment: http://stackoverflow.com/comment/40969116
downvote count: 0

http://stackoverflow.com/a/26147419
has body: Are you sure that you want to use EJB for that ? Mixing standard java concurrent mechanisms and JavaEE is rather discouraged... See: why-spawning-threads-in-java-ee-container-is-discouraged
has comment: http://stackoverflow.com/comment/41056024
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26146354
upvote count: 1
has comment: http://stackoverflow.com/comment/40989092
type: Answer

netbeans
tags question: http://stackoverflow.com/q/26116012
tags question: http://stackoverflow.com/q/26039370
tags question: http://stackoverflow.com/q/26097168
tags question: http://stackoverflow.com/q/26131835
tags question: http://stackoverflow.com/q/26052956
tags question: http://stackoverflow.com/q/26186653
tags question: http://stackoverflow.com/q/26150888
tags question: http://stackoverflow.com/q/26043208
tags question: http://stackoverflow.com/q/26075103
tags question: http://stackoverflow.com/q/26175870
tags question: http://stackoverflow.com/q/26180781
tags question: http://stackoverflow.com/q/26183629
tags question: http://stackoverflow.com/q/26125841
tags question: http://stackoverflow.com/q/26172704
tags question: http://stackoverflow.com/q/26192315
tags question: http://stackoverflow.com/q/26102260
tags question: http://stackoverflow.com/q/26058903
type: Tag
tags question: http://stackoverflow.com/q/26126425
tags question: http://stackoverflow.com/q/26055848
tags question: http://stackoverflow.com/q/26069755
tags question: http://stackoverflow.com/q/26086760
tags question: http://stackoverflow.com/q/26078106
tags question: http://stackoverflow.com/q/26065700
tags question: http://stackoverflow.com/q/26066649
tags question: http://stackoverflow.com/q/26057393
tags question: http://stackoverflow.com/q/26150617
tags question: http://stackoverflow.com/q/26055052
tags question: http://stackoverflow.com/q/26111207
tags question: http://stackoverflow.com/q/26132824
tags question: http://stackoverflow.com/q/26189852
tags question: http://stackoverflow.com/q/26147101
tags question: http://stackoverflow.com/q/26084437
tags question: http://stackoverflow.com/q/26046676
tags question: http://stackoverflow.com/q/26046446
tags question: http://stackoverflow.com/q/26131405
tags question: http://stackoverflow.com/q/26037366
tag name: netbeans
tags question: http://stackoverflow.com/q/26067125
tags question: http://stackoverflow.com/q/26053739
tags question: http://stackoverflow.com/q/26054656
tags question: http://stackoverflow.com/q/26178724
tags question: http://stackoverflow.com/q/26082713
tags question: http://stackoverflow.com/q/26085780
tags question: http://stackoverflow.com/q/26155590
tags question: http://stackoverflow.com/q/26096376

http://stackoverflow.com/comment/40792651
type: AnswerComment
comment on: http://stackoverflow.com/a/26040903
score: 0
type: Comment
has text: Yes i'm using java 6, any alternative ?

http://stackoverflow.com/q/26179608
possible better answer: http://stackoverflow.com/a/26179791
favorite count: 0
has answer: http://stackoverflow.com/a/26179791
upvote count: 1
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41047032
tagged with: java
has comment: http://stackoverflow.com/comment/41047343
tagged with: import
type: Question
tagged with: date
has answer: http://stackoverflow.com/a/26180341
has comment: http://stackoverflow.com/comment/41046794
answer count: 2
has title: Trouble importing java.util.Date
accepted answer: http://stackoverflow.com/a/26180341
downvote count: 0
has body: I am trying to assign a date to a variable but Date always comes up red with the 'cant find symbol' message in netbeans. package librarycore; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Loan implements java.io.Serializable { private final Date loanDate; Loan(Book aBook, Person aBorrower) { book = aBook; borrower = aBorrower; DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); loanDate = dateFormat(new Date()); returned = false; } If I try to just import the Date class with import java.util.Date then Date in the import shows up red with the can't find symbol message.
has comment: http://stackoverflow.com/comment/41046879

http://stackoverflow.com/comment/40829144
type: Comment
type: QuestionComment
has text: Are both table records being inserted? OTOH if I was persist an instance of a subclass then I'd expect the `@PrePersist` method of this subclass be called but not the superclass'. After all the subclass is a full entity that will be persisted into two tables but still a single object.
score: 3
comment on: http://stackoverflow.com/q/26060940

http://stackoverflow.com/comment/40854110
type: Comment
comment on: http://stackoverflow.com/a/26074570
has text: This sounds like a perfect chance to use CompletableFuture with an acceptEither CompletionStage.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40898388
comment on: http://stackoverflow.com/q/26098750
type: Comment
type: QuestionComment
has text: Can you post the exception, or a bigger part of stack trace please. Because there can be many ways to give this exception, your connection may be not opened, or serverComManager is null, or something else.
score: 1

http://stackoverflow.com/q/26115538
answer count: 1
has comment: http://stackoverflow.com/comment/40929908
has comment: http://stackoverflow.com/comment/40953285
has comment: http://stackoverflow.com/comment/40929332
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/138272135
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25289231
tagged with: spring
has title: Random Kerberos validation error with Spring
has body: I sometimes get in my application, say 1-10 times within 24h, the following error: org.springframework.security.authentication.BadCredentialsException: Kerberos validation not succesfull ... Caused by: java.security.PrivilegedActionException: GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:416) at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator.validateTicket(SunJaasKerberosTicketValidator.java:67) Any ideas to how this error comes to be? As I said, it appears very random and does not happen very often.
score: 1
tagged with: java
type: Question
tagged with: kerberos
has answer: http://stackoverflow.com/a/26128892
upvote count: 1

http://stackoverflow.com/a/26079386
score: 1
downvote count: 0
has body: How do I separate the three letters they type in? You can use String.charAt to find the character at a given index. For instance, String example = "string"; // example.charAt(2) would be r Then you could join the first two characters (to get the first side name) and do the same for the two remaining sides.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26079350

http://stackoverflow.com/comment/41861802
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by "I'm not sure the PR is valid"? Hibernate is running within a web app on Tomcat. I wrote a unit test that reproduces the issue - see the pull request for HHH-9424: https://github.com/hibernate/hibernate-orm/pull/820
comment on: http://stackoverflow.com/q/26110918

http://stackoverflow.com/q/26182861
type: Question
possible better answer: http://stackoverflow.com/a/26420712
tagged with: jersey
has answer: http://stackoverflow.com/a/26420712
accepted answer: http://stackoverflow.com/a/26441040
has title: Validate XML entities in dropwizard
answer count: 3
tagged with: dropwizard
has body: I have dropwizard 0.7.1 set up and the @valid annotation correctly works when using json and I get 422 errors in the HTTP responses. If I change the resource and add jaxb bindings to use XML, the validation never kicks in. Is it supported? I tried manually instantiating a hibernate validator and it correctly detects the error. Thank you
tagged with: validation
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27315152
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26441040

http://stackoverflow.com/q/26159336
favorite count: 0
tagged with: spring
has title: How to display list errors in thymeleaf?
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: spring-mvc
has body: Here is a sample skeleton of DTO object. public class MyDTO { List&lt;Student&gt; students=new ArrayList&lt;&gt;(); } public class Student { String name; Integer age; // setter and getter methods } Now, the user has a chance to enter a lot of students into the list and any student detail might contain an error. The possible errors are student age being greater than 25, and name containing special characters etc. For example, students[2].name has a special character and student[4].age > 25, then they are errors. Now, I would like to display the error below those fields and also highlight the corresponding fields. &lt;form th:field="${myDTO}"&gt; &lt;input type="text" th:field="*{students[0].name}" th:errorclass="fieldError"/&gt; &lt;span class="error" th:if="${#fields.hasErrors('students[0].name')}" th:errors="*{students[0].name}"&gt;&lt;/span&gt; &lt;input type="number" th:field="*{students[0].age}" min="15" max="25" th:errorclass="fieldError"/&gt; &lt;span class="error" th:if="${#fields.hasErrors('students[0].age')}" th:errors="*{students[0].age}"&gt;&lt;/span&gt; &lt;/form&gt; I am confused on what to put in th:field attribute? When I write as above, such type of error is the result Neither BindingResult nor plain target object for bean name 'students+'['+0+']'' available as request attribute. In my validators, I have such type of code.. int idx=0; for(Student st: students) { errors.pushNestedPath("students["+idx+"]"); ValidationUtils.invokeValidator(studentValidator, st, errors); errors.popNestedPath(); idx++; } and in the StudentValidator class.. @Override public void validate(Object obj, Errors errors) { Student s=(Student) obj; if(containsSpecialCharacters(s.name)) { errors.rejectValue("name","name.containsSpecialCharacters",null,null); } if(s.age&gt;25 || s.age&lt;15) { errors.rejectValue("age","age.invalid",null,null); } } Now, my problems are How do I show those errors, highlight the corresponding fields? What to put in the th:field tag? Next, the student r…
tagged with: java
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/55870031
downvote count: 0
answer count: 1

http://stackoverflow.com/a/69080611
downvote count: 0
has comment: http://stackoverflow.com/comment/122092584
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26051175
upvote count: 1
has body: I have a suspicion that this is some sort of timeout. I have a very long running job which probably only begins sending anything after some 20 min of churning. I open the OutputStream at the beginning of the job, and hold it, and I assume that its a timeout of inactivity. I wonder what keep-alive technique I could be using, or I have to defer opening the output stream until I actually have a buffer to write.

http://stackoverflow.com/q/26060080
tagged with: java
tagged with: mod-rewrite
type: Question
tagged with: ocpsoft-rewrite
upvote count: 2
has title: Runtime rewriting with ocpsoft rewrite - Java
has body: I'm developing a web application that provides some pages. I require to rewrite the URL of these pages and I would like to use this framework http://ocpsoft.org/rewrite. All works fine, but the problem is that I need invoke the configuration in a particular moment of startup so I can send a list of link to be rewrited. I know that is possible but I haven't some experience with this framework.. (If you know other frameworks that allow to do it please tell me). Thakns for all Bye.
favorite count: 0
type: UnansweredQuestion
tagged with: url-rewriting
score: 2
answer count: 0
downvote count: 0

http://stackoverflow.com/a/26120746
has body: First of all your problem is not fully cleared, define your database models here first, and from your query i have come to know that hql.append(" DOC.id, "); the last Coma will not be added here hql.append(" DOC.id "); Here hql.append(" FROM ").append(DocumentoAssinanteTO.class.getName()).append(" DA "); you don't need to get name of class by calling class.getname() method you just call here the bean or name of Model. and there is lot of problem in your inner joins.
answers question: http://stackoverflow.com/q/26120005
score: 0
has comment: http://stackoverflow.com/comment/40937544
type: Answer

http://stackoverflow.com/comment/40917584
score: 0
type: Comment
type: QuestionComment
has text: Thanks for pointing me in this direction! I will try it out.
comment on: http://stackoverflow.com/q/26109119

http://stackoverflow.com/q/26115207
linked to: http://stackoverflow.com/q/17877615
has answer: http://stackoverflow.com/a/26115781
has body: I am trying to understand the memory management scheme for JVM Consider two classes A, B Class A { public A() { //Do Something } } Class B() extends A{ public B(){ super(); // DO something again } } From main B b = new B(); As per my knowledge the Class loader will load A, B and will create 2 objects each. Is there any other object that would get created? Also the second part of my question is that , while accessing Java Visual VM , I see objects of Java NIO package has been created. Is there any way I can prevent JVM from creating objects which are not related to my project?
answer count: 1
tagged with: jvm
has title: Object Creation Logic in Java
has comment: http://stackoverflow.com/comment/40928530
linked to: http://stackoverflow.com/q/220133
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40927983

http://stackoverflow.com/q/26131151
favorite count: 0
accepted answer: http://stackoverflow.com/a/26132099
type: AnsweredQuestion
tagged with: annotations
has body: I have created a java annotation that marks some of my 'service' classes as services and then written an annotation processor that generates corresponding servicerequest and servicehandler classes. This is for a GWT maven project where service requests are sent down to the server to a central dispatcher to be handle by the various services. My maven project is composed of a parent project and 5 sub module projects. The project structure is something like this: MoodleMobile ( parent maven project ) gwtMoodleWS ( GWT layer ) moodleBuildSupport (contains annotation processor) moodleGeneratedServiceHandlers (desired location of generated classes) moodleWS ( server side layer ) moodleWSAPI ( location of code where annotation processor will run ) My question is this. What is the prescribed way to have an annotation processor read and process annotations from one project (moodleWSAPI) and produce java source files in another project (moodleGeneratedServiceHandlers)? I have seem many many examples of annotation processors produce java source files for the same project in which the annotation processor is running, but not for a different project. I have successfully built and tested my annotation processor but I can't figure how to get it to produce the files outside of the project that the processor is running in. At the moment its producing the java source files within moodleWSAPI (this is wrong). I want it to process the source files in moodleWSAPI and then output the new generated source files in moodleGeneratedServiceHandlers. Here is the code snippet that I have to create the actual java source file .. public void createSourceFileFromTemplate(Template template, ClassSignature classSignature, VelocityContext context, Element element) { PrintWriter pw = null; try { JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(classSignature.getFullName(), classSignature.getElement()); OutputStream fileStream = sourceFile.openOutputStream(); pw = new PrintWriter(f…
type: Question
tagged with: annotation-processing
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/26132099
upvote count: 4
has title: How to have a java annotation processor read and process annotations from projectA and generate java source files for projectB
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40826487
score: 0
type: Comment
type: QuestionComment
has text: It's like 5 secs of searching in google
comment on: http://stackoverflow.com/q/26059534

http://stackoverflow.com/q/26146873
upvote count: 2
has comment: http://stackoverflow.com/comment/40986231
type: UnansweredQuestion
has title: How to show simulation time using Java in Eclipse?
has comment: http://stackoverflow.com/comment/40986078
downvote count: 1
tagged with: performance
has answer: http://stackoverflow.com/a/26147001
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40986316
has body: I've been asked to add a clock that displays the simulation time in my application. How can it be done?
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40995677
tagged with: profiling
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40932777
type: Comment
comment on: http://stackoverflow.com/a/26117651
has text: I can only repeat what I said above. The `Certificate.verify()` method is already sufficient. You supply the public key of the entity that is supposed to have signed it. You don't need all this other code.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41043972
has text: Thanks guys - I thought I was doing something wrong but when ye mention it like this it makes perfect sense
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26178097
type: Comment

http://stackoverflow.com/comment/41052755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26175812
score: 0
has text: Please add to your question configuration file

http://stackoverflow.com/q/26120003
accepted answer: http://stackoverflow.com/a/49730179
answer count: 2
score: 5
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/4023185
has answer: http://stackoverflow.com/a/26129364
favorite count: 0
has title: How to Ignore checkstyle javadoc warning for a method with a specific annotation
has body: Checkstyle warns when I have a public method without javadoc, which is nice! When I override a public method I don't get the warning because the javadoc is already available in the parent class for the method. Now I have an other annotation for my method for example @MyEvent. Now I do get the warning but don't want it because the annotation says enough. Can I exclude warnings for methods with a specific annotation? There are some solutions that involve adding stuff to my code like @SuppressWarnings or comments like // CHECKSTYLE.OFF but this does not make my code nicer, i could instead just add the javadoc. So I'm looking for a configuration level solution.
tagged with: checkstyle
has answer: http://stackoverflow.com/a/49730179
possible better answer: http://stackoverflow.com/a/26129364
tagged with: annotations
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/40890367
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26094054
has text: @Darkie To be precise, you'll need a SQL **command**, not a **query**.
score: 0

http://stackoverflow.com/comment/44547665
has text: The JDBC specification (or: the API documentation) requires that - by default - time is considered in the current timezone of the JVM. If you want to use another timezone, then you can provide a `Calendar` in the right timezone. As this is what is done in the question, it looks like that is the actual bug.
type: AnswerComment
comment on: http://stackoverflow.com/a/28084905
score: 0
type: Comment

http://stackoverflow.com/comment/40965495
type: QuestionComment
has text: According to creating the HREFS as reference to other objects: that should be implemented by the REST-framework you are using. In a web-app you woudn't care about link-generation either...
score: 0
comment on: http://stackoverflow.com/q/26135541
type: Comment

http://stackoverflow.com/q/26166937
has title: NullPointerException with ArrayAdapter
has body: I am using Eclipse, I have an activity using the default "RelativeLayout" layout. I included a spinner into the layout, here is the current xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="mahana.timestat.InputMenu" &gt; &lt;Spinner android:id="@+id/activitiesSpinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" /&gt; &lt;/RelativeLayout&gt; In my .java, I find the spinner, create an arrayList, fill it manually, create an adapter and set it as the adapter for the spinner. Here is the code: //find the spinner: Spinner activitiesSpinner = (Spinner) findViewById(R.id.activitiesSpinner); //create an arrayList: ArrayList&lt;String&gt; activities = new ArrayList&lt;String&gt;(); //clear it and insert two strings: activities.clear(); activities.add("First"); activities.add("Second"); //create an adapter (I expect the error to be somewhere in here) ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, R.id.activitiesSpinner, activities); //and finally set the adapter for the spinner activitiesSpinner.setAdapter(adapter); When I use the adapter.getCount() method, it shows the right number (2). When I comment the last line, where I set the adapter, it runs fine and shows an empty spinner on my device. When I leave the last line in and run this, it crashes on a nullPointerException. Here is the trace: 10-02 19:50:05.645: E/AndroidRuntime(21432): FATAL EXCEPTION: main 10-02 19:50:05.645: E/AndroidRuntime(21432): Process: mahana.timestat…
tagged with: arraylist
score: 0
tagged with: nullpointerexception
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/26167119
type: AnsweredQuestion
tagged with: android-arrayadapter
tagged with: java
has answer: http://stackoverflow.com/a/26167119
type: Question

http://stackoverflow.com/comment/41065702
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26185497
type: Comment
has text: You, sir, are amazing. I had a completely wrong idea of how the architecture for FX worked, and this cleared it all up.

http://stackoverflow.com/comment/40809706
has text: Are you asking about using `@Configuration` specifically to register beans for injection, or are you asking more generally if there are equivalent alternatives?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26049975

http://stackoverflow.com/q/26035869
has title: Reusing subpattern in regular expression
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/40783023
tagged with: c#
has comment: http://stackoverflow.com/comment/40782989
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40783212
has body: I have string like "operand sign operand". And pattern (?&lt;operand&gt;.* ([+|-] ?&lt;operand&gt;.*)*). Operand is more complicated then ".*". Can I put link to the first operand pattern to another side of sign to match them both. I can copy/paste it, but it seems as bad practice. Sorry for my poor English :|
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26036112
tagged with: regex

http://stackoverflow.com/a/26121130
has body: The Seam Maven dependencies are not hosted by Maven Central. Add this in your pom.xml. <project... jboss-releases https://repository.jboss.org/nexus/content/repositories/releases/
has comment: http://stackoverflow.com/comment/40944598
score: 0
answers question: http://stackoverflow.com/q/26119169
has comment: http://stackoverflow.com/comment/40943049
has comment: http://stackoverflow.com/comment/40941371
has comment: http://stackoverflow.com/comment/40967217
has comment: http://stackoverflow.com/comment/40951201
has comment: http://stackoverflow.com/comment/40941990
type: Answer

http://stackoverflow.com/comment/40908328
type: QuestionComment
has text: what is the output when you issue the java command on the command line, also what vm are you using?
comment on: http://stackoverflow.com/q/26104199
score: 0
type: Comment

http://stackoverflow.com/comment/40973002
type: Comment
comment on: http://stackoverflow.com/a/26139835
has text: Actually this is not my problem. stu.get(i) is used multiple times how to avoid using temporary variable like I mentioned above..
type: AnswerComment
score: 0

http://stackoverflow.com/q/26124253
answer count: 1
has answer: http://stackoverflow.com/a/26125312
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40944511
has title: jTextField text automatically set to previous state after clicking ok in JOption pane
type: Question
tagged with: java
has body: initially text is set to every jtextfield on formActivatedEvent. when i clear the textfields and try login it usually gives an JOption pane error message. afer clicking ok in joptionpane previous text automatically set to every textfield.how to avoid this. my english is very bad.hope you understand.i've youtubed( https://www.youtube.com/watch?v=QoktSV7U1vI&amp;feature=youtu.be ) the this problem.please can anyone help me?
score: 0

http://stackoverflow.com/comment/40909587
has text: I rather think about javascript facebook connect ... It becomes soo complicated to customize when it's so easy in JS
comment on: http://stackoverflow.com/q/26103412
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40907301
score: 2
comment on: http://stackoverflow.com/q/26103613
type: Comment
has text: You need to `break` the individual cases
type: QuestionComment

http://stackoverflow.com/a/26112568
answers question: http://stackoverflow.com/q/26110136
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40929816
has body: This is my guest but it seems to be that URL Pattern parser is searching for the presence of "/api/1.0/client". All of your examples have that string present so performing a search string for API_PREFIX would return true for them. http://www.example.pl/%07api/1.0/client/abc http://www.example.pl/%0bapi/1.0/client/abc Your last example does not have the exact /api/1.0/client string but instead uses 0bi/1.0/client. Short Answer: You don't have to define an exact URL for the parser to make a selection. I believe the same is true for regular Java EE without spring. If you define /api/1.0/client/* in your web.xml file, any URL that has that string wil trigger the dedicated controller you've assigned to it. Even if the string is preceeded but garbage such as /SDSFDFSFSFSF/api/1.0/client

http://stackoverflow.com/comment/40998361
comment on: http://stackoverflow.com/a/26153263
type: AnswerComment
has text: no, it's because you used n instead of x for the loop check. :)
score: 0
type: Comment

http://stackoverflow.com/comment/41056758
comment on: http://stackoverflow.com/a/26184472
type: AnswerComment
type: Comment
has text: The typical pattern is `this.s = checkNotNull(s);` with a static import.
score: 13

http://stackoverflow.com/q/26054748
possible better answer: http://stackoverflow.com/a/35663638
tagged with: java
accepted answer: http://stackoverflow.com/a/27443108
has answer: http://stackoverflow.com/a/35663638
answer count: 2
tagged with: dropwizard
tagged with: jetty
has body: I need a way to share the session across different dropwizard web services. In Jetty there is a way to do it by using JDBCSessionIdManager and JDBCSessionManager (http://wiki.eclipse.org/Jetty/Tutorial/Session_Clustering). The problem is that dropwizard (0.7.1) does not expose a reference of the org.eclipse.jetty.server.Server that is needed so there is no obvious way to do change the SessionManager and the SessionIdManager. I've seen that the Server is created in io.dropwizard.cli.ServerCommand#run through a io.dropwizard.server.ServerFactory but the reference in io.dropwizard.cli.ServerCommand#run is local so I can't even use reflection to get the reference that I want. What should I do in dropwizard to change SessionManager and the SessionIdManager? Thanks, Alex
has answer: http://stackoverflow.com/a/27443108
type: AnsweredQuestion
score: 0
has title: Dropwizard Session Clustering
tagged with: session-management
type: Question

http://stackoverflow.com/comment/40949236
type: Comment
has text: Removed the references to the repos and their respective dependencies in my `pom.xml`, and that seems to have gotten rid of the blockage. It's too bad because I need some of those libs. =/
comment on: http://stackoverflow.com/a/26113909
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40916383
comment on: http://stackoverflow.com/q/26108427
score: 0
type: Comment
type: QuestionComment
has text: No object _belongs_ to another.

http://stackoverflow.com/q/26187381
favorite count: 0
linked to: http://stackoverflow.com/q/29955951
answer count: 0
has body: I am struggling to get a Jersey client that follows redirects, even though "I know I had this working earlier." (Haven't looked at the code in a while). I thought had a complex case where it was failing when the redirect was from HTTP to HTTPS. But I cannot get even this simple test below to run: package com.soliantconsulting.jira.test; import static org.junit.Assert.*; import com.sun.jersey.api.client.*; import org.junit.Test; public class JerseyClientTest { public void test() { Client c = Client.create(); c.setFollowRedirects( true ); WebResource r = c.resource("http://www.yahoo.com"); String response = r.get(String.class); System.out.println( response ); } } When run, this code throws: com.sun.jersey.api.client.UniformInterfaceException: GET http://www.yahoo.com returned a response status of 301 Moved Permanently I've tried a couple different flavors of setting the redirect-follow option, so I must be doing something fundamentally wrong, I think. Mac OS 10.9.4, JDK 1.7.0_65, Jersey 1.18.1, Eclipse Luna, Maven 3.2.3.
has comment: http://stackoverflow.com/comment/74446929
type: UnansweredQuestion
tagged with: http-redirect
tagged with: jersey-client
score: 3
linked to: http://stackoverflow.com/q/21778393
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has title: Jersey client not following redirects?

http://stackoverflow.com/comment/40791931
comment on: http://stackoverflow.com/q/26040636
type: Comment
has text: Its is one line for each string I'm saving
score: 0
type: QuestionComment

http://stackoverflow.com/q/26131280
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/40957860
tagged with: http
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40958148
score: 1
has comment: http://stackoverflow.com/comment/40958112
tagged with: java
has comment: http://stackoverflow.com/comment/40958015
tagged with: servlets
type: Question
downvote count: 0
has title: How Do I Request an HTML View from a Controller in Java and not through a Web Browser using Spring MVC?
has body: I am using Spring MVC. In Controller1 I return a ModelAndView of the current progress of an item that is being 'published'. I am using Velocity as my view resolver if that makes any difference. What is returned, is obviously, HTML. What I want is Controller2 and Controller3 to make a call to Controller1 and include the HTML view that Controller1 returns along with the HTML view that they will return. I only know how to call controllers through the web browser using a URL. How do I call and receive HTML in java code? If I can stick with just using the spring framework, that would be best. I was reading about Spring's RestController, but I am unsure if I can return a ModelAndView using a view resolver? Thanks.
has comment: http://stackoverflow.com/comment/40958047
has answer: http://stackoverflow.com/a/26131760
answer count: 1
has comment: http://stackoverflow.com/comment/40958128
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26076908
score: 0
answers question: http://stackoverflow.com/q/26076596
type: Answer
has body: condition (freeSodaBottle % 5 >= 5) will always be false

http://stackoverflow.com/q/26093228
has answer: http://stackoverflow.com/a/26094137
answer count: 3
has comment: http://stackoverflow.com/comment/40889417
has comment: http://stackoverflow.com/comment/40890948
favorite count: 0
tagged with: linked-list
has comment: http://stackoverflow.com/comment/40889520
downvote count: 0
tagged with: inner-classes
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40889567
has comment: http://stackoverflow.com/comment/40888877
has answer: http://stackoverflow.com/a/26093609
tagged with: pass-by-reference
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/40889325
score: 1
has comment: http://stackoverflow.com/comment/40889733
tagged with: java
has comment: http://stackoverflow.com/comment/40889360
has body: What are the ways in which we can achieve/mock pass by reference in Java? In order to check whether a linkedlist is a palindrome, i wrote the below code. It works/ But i would like to know if there are any other ways to achieve this without wring a wrapper class. class MyClass { ListNode mover = head; boolean b = true; } public boolean checkPalindrome(){ ListNode temp = head; int len = length()/2 + length()%2; MyClass myObj = new MyClass(); int i =(len%2 == 1) ? len:len-1; while(i&gt;1){ myObj.mover = myObj.mover.next; i--; } boolean e = checkPalindrome(temp, myObj, len); return e; } public boolean checkPalindrome(ListNode head, MyClass ref, int len) { if(head == null || len == 0) return true; len = len-1; checkPalindrome(head.next,ref, len); ref.mover = ref.mover.next; ref.b = ref.b &amp;&amp; (head.value==ref.mover.value); return ref.b; } In order have the current location of "ref" object i wrote the MyClass wrapper. Is there a better way than this?
has title: How to achieve pass-by-reference in recursive methods in Java
has comment: http://stackoverflow.com/comment/40889345
upvote count: 1
has answer: http://stackoverflow.com/a/26094510

http://stackoverflow.com/q/26045200
accepted answer: http://stackoverflow.com/a/26045285
has comment: http://stackoverflow.com/comment/40801017
linked to: http://stackoverflow.com/q/12865262
type: AnsweredQuestion
tagged with: commit
has body: I am running Java and Oracle SQL 11g. What happens if you establish a connection to a database, setting the connection to AutoCommit=False but you have neither a commit() nor a rollback() ? I have my code wrapped in a try/catch/finally and in the finally I have a rollback. However, I noticed that I am missing two records from a table. My assumption is that I was in my code in debug mode and clicked the stop button so it didnt reach the rollback command, nor does it have a commit anywhere in between.
tagged with: java
tagged with: oracle11g
type: Question
answer count: 1
has title: How does Oracle handle SQL when autocommit=false and there is no commit or rollback?
score: 0
tagged with: rollback
has answer: http://stackoverflow.com/a/26045285
tagged with: sql

http://stackoverflow.com/q/26105784
type: Question
has body: I need to know how to create a RoundRobinPool Router Actor in which each one of its routees has its own reference to another object . That reference that is held by every routee must be different for each routee. A way to do that would be something like this: ActorRef ref = system.actorOf(new RoundRobinPool(5).props(Props.create(Worker.class, new AnotherObject())), "router"); but the trouble with this approach is that every worker has the same reference to AnotherObject and I do not wish that side effect. It would be something like this, but with a Router Actor: List&lt;Routee&gt; routees = new ArrayList&lt;Routee&gt;(); for (int i = 0; i &lt; 5; i++) { ActorRef r = system.actorOf(Props.create(Worker.class, new AnotherObject())); routees.add(new ActorRefRoutee(r)); } Router router = new Router(new RoundRobinRoutingLogic(), routees); // That is a Router I need an ActorRef Has someone any idea how to do that? Cheers
answer count: 2
tagged with: akka
score: 0
has answer: http://stackoverflow.com/a/26106412
has title: create a router actor parameterizing the creation of each one of its routees in akka java
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26116031

http://stackoverflow.com/comment/41016513
type: QuestionComment
has text: Second-hand I guess. It's not in the pom.xml of my project, but it's inherited from some other project. In the Eclipse Maven Dependencies I have only 2.9.3, but if I look in the Maven repository on the disk I have many other versions (2.8.2, 2.9.5, etc.)
comment on: http://stackoverflow.com/q/26162855
score: 0
type: Comment

http://stackoverflow.com/comment/40938111
score: 0
has text: @Jehof Doesn't SRP stands for Single Responsibility **Principle** ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26120591

http://stackoverflow.com/a/26170624
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26169246
has body: Why not just do this? enum enum1 { TEST_1(enum2.TEST_ENUM_1, "name 1"), TEST_2(enum2.TEST_ENUM_2, "name 2"); }

http://stackoverflow.com/q/26174563
has answer: http://stackoverflow.com/a/26175003
score: 0
has comment: http://stackoverflow.com/comment/41038117
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: I'm working with huge project which has almost hundred plugins which in turn has it's own folder. The issue is that this project was created in eclipse and for each plugin's source folder a corresponding output folder specified. I'm wondering if it is possible to do the same thing in intellij or I'm forced to use eclipse? Just some screenshots to make thigs clearer:
has comment: http://stackoverflow.com/comment/41037764
has title: Intellij idea specify output folder for each source folder (like in eclipse)
tagged with: intellij-idea
answer count: 1

model
tags question: http://stackoverflow.com/q/26098683
tag name: model
type: Tag
tags question: http://stackoverflow.com/q/26182202

http://stackoverflow.com/comment/41008713
score: 0
type: AnswerComment
has text: @user3548900 Glad to know I was of help :) Happy coding.
type: Comment
comment on: http://stackoverflow.com/a/26158193

http://stackoverflow.com/comment/40897166
score: 0
has text: See [here](http://blog.bdoughan.com/2012/08/handle-middle-of-xml-document-with-jaxb.html).
comment on: http://stackoverflow.com/q/26097760
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26074380
possible better answer: http://stackoverflow.com/a/26075022
upvote count: 4
answer count: 2
has title: Thread Pool performance
downvote count: 0
score: 4
has body: I'm trying to understand the advantage of using thread pools, i wrote this code to see the time improvement of fixed thread pool. First, i set the number of threads in the pool to 1 and it took approximately 920 ms, then i changed the number of threads in the pool to 2(and 3,4,5,6,7...) and it took 1200 ms, shouldn't it be faster when the threads are running concurrently? When i changed it to cached thread pool it also took 1200 ms package threadpool; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Example3 { public static void main(String[] args) { new Example3(); } public Example3() { try { testFixedPool(1); //testFixedPool(2); } catch (InterruptedException e) { e.printStackTrace(); } } public void testFixedPool(int numberOfThreads) throws InterruptedException { ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads); long start = System.currentTimeMillis(); executor.execute(new TaskPrintInteger(0, 10000)); executor.execute(new TaskPrintInteger(1, 10000)); executor.execute(new TaskPrintInteger(2, 10000)); executor.execute(new TaskPrintInteger(3, 10000)); executor.execute(new TaskPrintInteger(4, 10000)); executor.execute(new TaskPrintInteger(5, 10000)); executor.execute(new TaskPrintInteger(6, 10000)); executor.execute(new TaskPrintInteger(7, 10000)); executor.execute(new TaskPrintInteger(8, 10000)); executor.execute(new TaskPrintInteger(9, 10000)); executor.shutdown(); while(!executor.isTerminated()){ } System.out.println(); System.out.println((System.currentTimeMillis()) - start); } private class TaskPrintInteger implements Runnable { private int number, times; public TaskPrintInteger(int number, int times) { this.number = number; this.times = times; } @Override public void run() { for (int i = 0; i &lt; times; i++) { System.out.println(number); } } } }
favorite count: 0
has answer: http://stackoverflow.com/a/26074490
tagged with: performance-testing
has comment: http://stackoverflow.com/comment/40853642
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26074490
type: Question
has answer: http://stackoverflow.com/a/26075022
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40853787
tagged with: threadpool
tagged with: java

http://stackoverflow.com/q/26166440
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41024318
tagged with: algorithm
has answer: http://stackoverflow.com/a/26167116
tagged with: java
has title: Resolve this java algorithm for Dice for Risk game
type: Question
tagged with: dice
has body: like in risk game I have to roll dices, but I don't want to use the Random.nextInt() method for each roll. For some reasons I have already the result of the attack, and I want to simply generate the values of the dices. In risk game the dices are ordered and compared singly: For example: if attack rolls 3 dices and defense rolls 2 dices and these are the results: [4, 3, 5] - [3, 5] The attack lost 1 tank and the defense lost 1 tanks because: [5, 4, 3] - [5, 3] 5 = 5 (the attack loses in case of a tie) 4 > 3 (the defense loses) 3 (the third dice is useless in this case) This is the input code: int diceForAttack = StringUtils.nextInt(3) + 1; int diceForDefense = StringUtils.nextInt(3) + 1; //prints: attack Vs. defense System.out.println(String.format("%d Vs. %d", diceForAttack, diceForDefense)); int maxLost = Math.min(diceForAttack, diceForDefense); int attackLoses = StringUtils.nextInt(maxLost + 1); int defenseLoses = maxLost - attackLoses; //prints: //Attack lost x //Defense lost y System.out.println(String.format("Attack lost %d\nDefense lost %d", attackLoses, defenseLoses)); //Now I want to generate two arrays //such that the dice respect the values attackLoses and defenseLoses int[] attack = new int[diceForAttack]; int[] defense= new int[diceForDefense]; ... ... ... The question is: Since I already know how many tanks will lose the attack and the defense. How can I generate two arrays such that the dice respect the values attackLoses and defenseLoses?
answer count: 1
has comment: http://stackoverflow.com/comment/41022902
has comment: http://stackoverflow.com/comment/41023405
accepted answer: http://stackoverflow.com/a/26167116
has comment: http://stackoverflow.com/comment/41023250
score: 0
tagged with: random
has comment: http://stackoverflow.com/comment/41022849
has comment: http://stackoverflow.com/comment/41023282
has comment: http://stackoverflow.com/comment/41023231

http://stackoverflow.com/comment/40874554
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26085673
has text: Thank you. This is the same "thread per connection" solution suggested and discussed earlier.

http://stackoverflow.com/q/26135990
answer count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
has title: How can i tell if getOutputStream or getwriter was called in a servlet filter
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/40966800
tagged with: filter
has body: Is there a way to tell if getOutputStream or getWriter was called? I'm implementing a servlet filter to modify response data using a HttpServletResponseWrapper to wrap and store original response data. After manipulating the data I need to write it back to the original response. I find that I get an error using ether getOutputStream or getWriter depending on the request. The filter itself is not used on my application so I can't control the code used to write the original response. I also can't make sure my filter is the first to be called in the chain so I can't implement a HttpServletResponseWrapper to keep track of whether getWriter or getOutputStream has been called. for now what I did was try { response.getOutputStream().write(newData); } catch (IllegalStateException e) { response.getWriter().write(new String(newData,charset)); } it works but i never feel comfortable using exception for "normal" code flow.
has comment: http://stackoverflow.com/comment/40968317
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40966558
has comment: http://stackoverflow.com/comment/40966069

http://stackoverflow.com/comment/40920557
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26110375
score: 0
has text: The other issue is simply a matter of putting a "description" entry (with string value) into the "account" object.

http://stackoverflow.com/a/26060938
answers question: http://stackoverflow.com/q/26060812
has body: You can simply put your common code in static method.
type: Answer
score: 0

http://stackoverflow.com/comment/40877224
comment on: http://stackoverflow.com/q/26087063
type: Comment
score: 0
has text: you should add some of your code, to show what all exactly have you tried?
type: QuestionComment

http://stackoverflow.com/comment/41018194
score: 2
has text: You say you use eclipse so can you not just go: Right-click on file -> Team -> Show Local History?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26163693

http://stackoverflow.com/q/26072162
type: Question
has comment: http://stackoverflow.com/comment/40911288
has body: I am developing a java app in which I need to get a date and number of days from the user and then add this numbers to the date and show the final date which in this case would be the deadline date , to the user. The problem here is that I'm using shamsi(jalali) calendar and in order to the calculation , first I have to convert the shamsi date to java standar calendar then add the day numbers and again convert it back to shamsi date. Date miladiDate = new Date(DateConvertor.shamsi2miladi(entity.getDoDate())); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Calendar c = Calendar.getInstance(); c.setTime(miladiDate); c.add(Calendar.DATE, baseEvaluate.getDeadLineDays()); String output = sdf.format(c.getTime()); System.out.println(output); entityDetail.setDeadLineDate(DateConvertor.miladi2date(c.getTime())); I wanted to know if there is a way in which I could do this without converting the shamsi date , and just add the day number to the shamsi date. P.S : I used joda time , it does not support the shamsi calendar.
tagged with: java
tagged with: date
answer count: 2
has comment: http://stackoverflow.com/comment/58245027
downvote count: 0
has answer: http://stackoverflow.com/a/36784872
favorite count: 0
has title: How to add number of days to a date in jalali(shamsi) calendar
linked to: http://stackoverflow.com/q/10378764
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: calendar
has answer: http://stackoverflow.com/a/36766489

authentication
tags question: http://stackoverflow.com/q/26092434
tags question: http://stackoverflow.com/q/26157397
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/26128826
tags question: http://stackoverflow.com/q/26187465
tags question: http://stackoverflow.com/q/26137805

http://stackoverflow.com/a/26239642
has body: Try replacing: &lt;fmt:parseNumber var="prevLineNumberKey" type="number" value="${lineNumber-1}" /&gt; With: &lt;c:set var="prevLineNumberKey"&gt;${lineNumber-1}&lt;/c:set&gt; And replace: &lt;fmt:parseNumber var="nextLineNumberKey" type="number" value="${lineNumber+1}" /&gt; &lt;c:out value="NEXT ${hashtableObj[nextLineNumberKey+1]}" escapeXml="false"/&gt;&lt;br/&gt; With: &lt;c:set var="nextLineNumberKey"&gt;${lineNumber+1}&lt;/c:set&gt; &lt;c:out value="NEXT ${hashtableObj[nextLineNumberKey]}" escapeXml="false"/&gt;&lt;br/&gt; Couple of questions though: 1) Is hashtableObj really a hashtable or is it a hashmap? 2) Is the value of the hashtableObj, really a number that is equal to the key? In other words you are expecting: PREV 50 ... that means you are expecting the value of the hashtable/map to be 50 AND the key is also 50?
answers question: http://stackoverflow.com/q/26170289
type: Answer
has comment: http://stackoverflow.com/comment/41168503
score: 0
has comment: http://stackoverflow.com/comment/41172503

http://stackoverflow.com/a/26109459
has body: The problem is that when you do integer divisions, you'll get integer values. Instead use double or float data types. I see slug and battingavg are already doubles, but you're assigning the result of an integer division to them. If you cast at least one of the values in your calculations to a double you should get the output you expect. Example: slug = totalbase / (double) atbats; battingavg = (single + doub + triple + homer) / (double) atbats;
accepted answer of: http://stackoverflow.com/q/26109437
answers question: http://stackoverflow.com/q/26109437
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/26086739
possible better answer: http://stackoverflow.com/a/26095493
has answer: http://stackoverflow.com/a/26095493
type: Question
has comment: http://stackoverflow.com/comment/40885819
tagged with: junit4
tagged with: mockito
has comment: http://stackoverflow.com/comment/40886345
has title: Mock internal method with JUnit and Mockito
has comment: http://stackoverflow.com/comment/40886235
score: 0
accepted answer: http://stackoverflow.com/a/26111526
answer count: 2
has comment: http://stackoverflow.com/comment/40876686
tagged with: junit
has comment: http://stackoverflow.com/comment/40886138
has comment: http://stackoverflow.com/comment/40886015
tagged with: powermock
has body: I have 2 methods, first method in jpa class to find id and another method to create a record (which checks whether the id already exists and creates a record if the record with id doesn't exists). public class EmployeeRegistry{ public Employee findEmployeeById(String empid){ List&lt;Employee&gt; results = new ArrayList&lt;Employee&gt;(); final Query query = entityManager.createNamedQuery("employeeRegistryImpl.findByEmployeeId"); query.setParameter("empid", empid); results = (List&lt;Employee&gt;) query.getResultList(); if (CollectionUtils.isEmpty(results)) { return null; } return results.get(0); } public Employee createEmployee(final Employee employee) throws PersistenceException{ if ((findEmployeeById(employee.getId()!=null)) { throw new EntityExistsException(); } return entitytManager.merge(employee); } } I wrote test cases with JUnit and Mockito frameworks for first method, findEmployeeById. e.g., @RunWith(MockitoJUnitRunner.class) public class EmployeeRegistryImplTest{ private String empid = "empid"; @Mock private static EntityManager entityManager; @Mock private static Query query; @InjectMocks private static EmployeeRegistry employeeRegistryImpl; @Test public void findEmployeeByIdReturnsNull() { final List&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); // given given(entityManager.createNamedQuery("employeeRegistryImpl.findByEmployeeId")).willReturn(query); given(query.setParameter("empid", empid)).willReturn(query); given(query.getResultList()).willReturn(employees); // when Employee employeeResult = null; employeeResult = employeeRegistryImpl.findEmployeeById(empid); // then assertNull(employeeResult); verify(entityManager, Mockito.times(1)).createNamedQuery ("employeeRegistryImpl.findEmployeeById"); } I tried to write the test case for createEmployee @Test public void createEmployeeReturnsNotNull() { final Employee employee= new Employee(); // when Employee employee= null; employeeResult = employeeRegistryImpl.createEmployee(employee); assertN…
has comment: http://stackoverflow.com/comment/40886034
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26111526
has comment: http://stackoverflow.com/comment/40886045
tagged with: java

http://stackoverflow.com/a/26129591
score: 0
has comment: http://stackoverflow.com/comment/40954954
has body: To answer your first question, u don't really need the HotelData class. The only thing this class does is holding the data nice and clean in one Object (for each specific hotel). If you implement it your way, you must cast all the values to Strings first(if they do not contain String values) before u can store your items in the hotelInfo list. This is because the hotelInfo list has the String type, in my implementation this is also not needed(the casts) because i have created a constructor with one String value and one int value. If u want your example to work implement it like this: not this: hotelInfo.add(result.getString("hotelNo")); but like this: hotelInfo.add("" + result.getInt("hotelNo")); //Notice the cast here!
type: Answer
answers question: http://stackoverflow.com/q/26127305
has comment: http://stackoverflow.com/comment/40955320
has comment: http://stackoverflow.com/comment/40955130

http://stackoverflow.com/comment/41008515
type: Comment
has text: oh, now I get you mean. I tot you were asking me to add in those code in draw(). By the way, how can i get the width of my ic-launcher? I remember there is a code similar to this one. ic_width = c.image1().getwidth()
comment on: http://stackoverflow.com/a/26158193
score: 0
type: AnswerComment

http://stackoverflow.com/q/26055455
tagged with: java
type: Question
has title: Automatically Iterate Over All Class Members of the Same Type?
score: 0
answer count: 1
has body: I have the following code: public void valueChanged( ChangeEvent ce, int index, Level previousState ) { Object source = ce.getSource(); LevelEditorPanel currentPanel = levelPanels.get ( index ); //currentPanel.columns is a JSpinner if ( source == currentPanel.columns ) { for ( int k = index + 1; k &lt; levelPanels.size(); k++ ) { LevelEditorPanel targetPanel = levelPanels.get( k ); if( ( (Integer) targetPanel.columns.getValue() ).intValue() == previousState.columns ) { targetPanel.columns.setValue( (Integer) currentPanel.columns.getValue() ); } } } } The actual code is about 35 lines; I simplified it a bit for this post. Essentially, it listens for a change, it IDs which component changed in instance A of LevelEditorPanel, and then updates the same component in instances B through Z of LevelEditorPanel to match instance A. (Not shown in the code above, it only sometimes updates B through Z, depending on booleans set by the user). The code isn't too unwieldy for one component. But I have about 50 JSpinners, 10 JComboBox, and 40 JCheckBox in "LevelEditorPanel" that all want to be controlled in the same general way. The only solution I can think of is to copy and paste this code for each of the other 49 JSpinners, generate similar code for the other three types of inputs, and then copy and paste the code for each of those as well, something like this: if ( source == currentPanel.columns ) { //Paste 35 lines } else if ( source == currentPanel.rows ) { //Paste 35 lines, change all references to 'columns' to 'rows' } else if ( source == currentPanel.speed ) { //etc which would be thousands of lines of really difficult to manage code. I'm looking for a better solution. In psuedocode, I'd like to do something like this: foreach ( JSpinner theSpecificSpinner defined in LevelEditorPanel ) { if ( source == currentPanel.theSpecificSpinner ) { target.theSpecificSpinner.setValue ( currentValue ); //etc } } To rephrase the question, I think I need two tools: The ability to iterate…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26055724
tagged with: reflection

http://stackoverflow.com/comment/40879235
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26088200
has text: An anonymous class is a class that extends another. That's what you have here, an anonymous subclass of `Thread`.
type: QuestionComment

http://stackoverflow.com/a/26128670
type: AcceptedAnswer
downvote count: 0
has body: As with many language features that are usually frowned upon, it is often tempting to cheat around using them by implementing a mechanism that somehow “fakes” them. But this doesn't make anything better. If you mean to test the type of an object, then instanceof is just the right thing to use. If you want to avoid it, you'll need to find a way that does not require you to find out the (dynamic) type of an object. One popular pattern to avoid run-time type inspection is using the visitor pattern which effectively has the overload resolution and dynamic dispatch machinery do the dirty work. If your real-world problem is as simple as the museum example you've posted, then this is clearly overkill. Anyway, here is how it could be done. For the sake of this example, assume we have Paintings and Drawings, both derived from ArtObject. We define an abstract visitor type that has a method for each ArtObject. Alternatively, you can only specialize for a few and have a fallback “visit anything” method. public abstract class ArtVisitor { public void visit(final Painting painting) { } public void visit(final Drawing drawing) { } // public void visit(final ArtObject anything) { // } } I have used an abstract class instead of an interface so I can have empty default implementations of the visit methods. In the ArtObject interface (or abstract class, for that matter) we need to add an abstract takeVisitor method. public abstract class ArtObject { private final String name; protected ArtObject(final String name) { this.name = name; } public abstract void takeVisitor(ArtVisitor visitor); @Override public final String toString() { return String.format("%s (%s)", this.name, this.getClass().getCanonicalName()); } } Unfortunately, we cannot implement ArtObject.takeVisitor since the this pointer would have static type ArtVisitor, which would require us to do type introspection which is just what we wanted to avoid. Instead, we must – and this is the ugliest thing about the visitor pattern…
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26127934
answers question: http://stackoverflow.com/q/26127934

http://stackoverflow.com/comment/40902752
score: 0
has text: I see people try to gain some repo from accepted answer rather than telling the questioner that this is not the place to ask such question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26101144

http://stackoverflow.com/comment/41637780
type: Comment
has text: @FiveO just tested for: `" benjamin ana "` and **IT DOES** keep order. The `XML.toJSONObject` builds a `JSONObject` by parsing the given XML string node after node, not applying any lexicographical order at all. You can check [here](https://github.com/douglascrockford/JSON-java/blob/master/XML.java)
comment on: http://stackoverflow.com/a/26382975
score: 0
type: AnswerComment

http://stackoverflow.com/q/26192225
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26192264
accepted answer: http://stackoverflow.com/a/26192264
downvote count: 0
answer count: 1
has body: i created a jformattedtextfield to accept only numbers: NumberFormat f2 = NumberFormat.getNumberInstance(); txtformattedprice = new javax.swing.JFormattedTextField(f2); Now i receive the value of the price from a table of my database and i want to put it in txtformattedprice: rsriga.next(); //the code above is ok txtformattedprice.setText(Double.toString((rsriga.getDouble("Price")))); In my db the column "Price" is decimal(6,2) (example of a value: 14.15), if i run the application i get in txtformattedprice the value: 14.15 but i want 14,15 because if the user does a click in txtformattedprice and then he does a click in an other textfield, the value from 14.15 becomes 1.415 (now it's not a decimal). How i can i have in the txtformattedprice 14,15?
favorite count: 0
tagged with: jformattedtextfield
has title: How to convert a decimal(6,2) value from database to a double value on a jformattedtextfield in this format **,**
tagged with: double

http://stackoverflow.com/a/26131445
has comment: http://stackoverflow.com/comment/40999249
upvote count: 3
has comment: http://stackoverflow.com/comment/40961475
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40965636
has body: I don't think you can do it using Hfs, but it's possible using GlobHfs. Try the following: Tap inTap = new GlobHfs( new TextLine(), "/path/to/data/", new GlobFilter("20140807*")); This creates a Globbing tap, using "/path/to/data/" directory as source and filtering the files inside using "20140807*" glob pattern passed to GlobFilter.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26118148
answers question: http://stackoverflow.com/q/26118148
score: 3

http://stackoverflow.com/comment/40880575
comment on: http://stackoverflow.com/q/26088763
has text: Remember that type erasure is never the answer to compilation errors such as your current one. At compile time there is no erasure---all type information is there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41017565
comment on: http://stackoverflow.com/a/26158460
score: 0
type: AnswerComment
type: Comment
has text: It is more from best practice than from a technical perspective. I suppose your pasted code here is a code meant for a business rather than for a framework: in this case (business), you should keep it simple and obvious to achieve greater maintainability. Note that in Scala, immutability is encouraged, and I think it is better to try to also achieve that as much as possible in Java: immutable objects are _normally_ thread safe.

http://stackoverflow.com/comment/41065336
type: Comment
has text: @camickr: thanks, and I 1+ your answer immediately as well. This guy is just throwing random junk at the wall and seeing what sticks, and that's not how you can successfully create a program. I was blunt, perhaps too blunt, but the errors are just so egregious that I couldn't help myself.
comment on: http://stackoverflow.com/a/26189212
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41132048
score: 0
type: Comment
has text: What do you mean - 'the rollback doesn't work'? Changes done by first method should not be committed to the database. Your table_x should not be changed. How are you generating failed transaction? Add proper e.printStackTrace() to your `public void test()` method in `TransactionTestBean`.
type: QuestionComment
comment on: http://stackoverflow.com/q/26151636

http://stackoverflow.com/q/26166663
score: -1
type: Question
linked to: http://stackoverflow.com/q/10455677
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26166708
favorite count: 0
has body: This is my first CS project ever. After creating my method, I ran the code to see if it works so far, everything works correctly but it does not actually do the math inside the method. Been working on this forever and can't find the bug. Any help would be great. Its due tomorrow lol. public static void main(String[] args) { int numberOfStudents = 0; int total = 0; int value = 0; int creditHours; double tuition; int classesMissed; System.out.println("Tuition Wasted Based on Student Absences and its effect on GPA."); Scanner keyboard = new Scanner(System.in); System.out.print("Enter the number of students to consider: "); value = keyboard.nextInt(); while (value &gt;= 5) { if (value &gt; 5) System.out.println("Number of students must be between 1 and 5"); System.out.print("Please re-enter a value number of students to consider: "); value = keyboard.nextInt(); } System.out.print("Enter the student ID for student 1: "); value = keyboard.nextInt(); System.out.print("For how many credit hours is the student registered: "); creditHours = keyboard.nextInt(); System.out.print("Enter the amount of the tuition for the semester: "); tuition = keyboard.nextDouble(); System.out.print("Enter the average number of classes the student misses in a week: "); classesMissed = keyboard.nextInt(); while (classesMissed &gt; creditHours) { if (classesMissed &gt; creditHours) System.out.print("That is not possible, please re-enter the number of classes missed in a week: "); classesMissed = keyboard.nextInt(); } DetermineWastedTuition(creditHours, tuition, classesMissed); } public static void DetermineWastedTuition(int creditHours, double tuition, int classesMissed){ double weeklyTuition; weeklyTuition = tuition / 10; double weeklyTuitionWasted; weeklyTuitionWasted = weeklyTuition *(classesMissed / creditHours); double semesterWasted; semesterWasted = weeklyTuitionWasted * 16; System.out.println("Tuition money wasted each week is " + weeklyTuitionWasted); System.out.println("Tuition money was…
has comment: http://stackoverflow.com/comment/41023419
type: UnansweredQuestion
has title: My methods aren't bringing the data along with it (beginner)
duplicate of: http://stackoverflow.com/q/10455677
downvote count: 1
has comment: http://stackoverflow.com/comment/41023295
tagged with: java

http://stackoverflow.com/a/26139339
answers question: http://stackoverflow.com/q/26139064
upvote count: 3
has body: Use a drawer listener instead and it will save you the stress of handling the different states mDrawerLayout.setDrawerListener(mListener); https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/40913140
comment on: http://stackoverflow.com/a/26104406
score: 0
type: AnswerComment
has text: That's true, but probably pretty irrelevant, as `Collections2.transform` does about nothing. It only creates a `TransformedCollection`, which is *lazy*. So you perfectly answered what the OP asked, but probably missed what they needs to know.
type: Comment

http://stackoverflow.com/q/26047280
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40804489
has body: I am using java 6 on a windows 7 box. I start with a java source file, and run wsgen.bat on it to generate the wsdl and artifacts. The package name in the generated source code/classes is in xxx.yyy.jaxws. As a sanity check, I then ran wsimport.bat on the wsdl file generated by wsgen.bat. Mysteriously, the package name in the generated source code/classes is in xxx.yyy. That is, instead of generating the exact same source/class files in the same packages, wsimport drops the .jaxws folder in the package name. Also, the source generated by wsgen does not keep the XXXService.java or .class file, whereas wsimport does. Has anyone else seen this? This seems like a bug to me. I'm using Jax-ws 2.2.5, 07/29/2011. This is a somewhat old version, so maybe this doesn't happen anymore or it has been fixed. I have to say I'm thoroughly confused about wsgen and wsimport. Everything I've read online says that wsgen generates the artifacts from a java file, and wsimport generates the artifacts from a wsdl file. Essentially, they do the exact same thing, just from different starting points. What I'm seeing in reality though, is completely different. wsgen generates class files with correct packages, although it doesn't generate the XXXService.class. wsimport generates class files with a single package, completely ignoring the package structure of the java files I created for my web service. wsimport can create a client jar file, something wsgen can't do. So it seems if I want to access my web service from a java client, I need to use wsimport to create the client jar file, which I then later need to manually add a MANIFEST.MF file (otherwise, the java compiler does not recognize the classes in the generated client jar file - There are numerous posts all over the web about this).
score: 0
has title: wsimport not generating the same files as wsgen
tagged with: wsdl
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40826939
tagged with: web-services

http://stackoverflow.com/comment/40973121
type: QuestionComment
type: Comment
has text: @RRR itemDBController.getAllItems(); is working!, displayed all the elements of the arrraylist using for each.
score: 0
comment on: http://stackoverflow.com/q/26139856

http://stackoverflow.com/a/26106148
has body: @acdcjunior's comment helped me figure out the issue. Instantiating service using the new keyword caused Spring to not inject the dependencies (in this case helper) correctly. I fixed this by autowiring in service in the test. My final working code looks like this: Class I'm testing @Component public class Service { @Autowired private iHelper helper; public void doSomething() { helper.helpMeOut(); } } My test for this class @RunWith(MockitoJUnitRunner.class) public class ServiceTest { @Mock private iHelper helper; @InjectMocks @Autowired private Service service; @Test public void testStuff() { doNothing().when(helper).helpMeOut(); service.doSomething(); } } Hope this helps someone else. Thanks for the suggestions!
answers question: http://stackoverflow.com/q/26069543
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/89102354
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26069543

http://stackoverflow.com/q/26084140
linked to: http://stackoverflow.com/q/7528862
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
has answer: http://stackoverflow.com/a/26084293
has comment: http://stackoverflow.com/comment/40871861
type: UnansweredQuestion
tagged with: classnotfoundexception
has title: java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider
has body: I'm trying to run my web app using Tomcat and totally confused because of this exception. Here is a stacktrace: Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ... 40 more The part of my data.xml: <tx:annotation-driven transaction-manager="transactionManager" /> org.hibernate.cfg.AnnotationConfiguration org.hibernate.dialect.MySQLDialect UTF-8 update Hibernate dependency is: org.hibernate hibernate-core 4.3.6.Final According to this question seems like has to work, but it doesn't. Will be appreciate for some useful tips.
type: Question
tagged with: sessionfactory
has comment: http://stackoverflow.com/comment/40871810

http://stackoverflow.com/q/26159828
has comment: http://stackoverflow.com/comment/41011002
has title: How do I open a Java program using C++
tagged with: java
has comment: http://stackoverflow.com/comment/41010153
type: Question
has answer: http://stackoverflow.com/a/26160019
answer count: 3
has comment: http://stackoverflow.com/comment/41061175
has comment: http://stackoverflow.com/comment/41010439
tagged with: c++
has answer: http://stackoverflow.com/a/26160084
has body: I am trying to make a Java program, but I want it to be opened by C++. I have been this using in C++ system("java -jar MMQ4.jar"); But it requires the users to add C:\Program Files\Java\jre7\bin\ to their PATH environmental variable So, is their another way to run a Java program using C++?
has comment: http://stackoverflow.com/comment/41010044
has answer: http://stackoverflow.com/a/26159925
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26072242
has answer: http://stackoverflow.com/a/26072327
has comment: http://stackoverflow.com/comment/40850200
favorite count: 0
accepted answer: http://stackoverflow.com/a/26072304
answer count: 4
has answer: http://stackoverflow.com/a/26072420
type: AnsweredQuestion
tagged with: list
has title: How to fill a Map<String, List<String>> from a text file ? -Difficulites dynamically naming each List
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26072755
upvote count: 1
possible better answer: http://stackoverflow.com/a/26072420
type: Question
has comment: http://stackoverflow.com/comment/40850118
tagged with: hashmap
has body: Here is the text file. K: represents a key and V: represents the values in the List I want to enter. ie : Strawberry , Apricot and Peach make up the List at Key Class A of the Map. K: Class A// V: Strawberry// V: Apricot// V: Peach// K: Class B// V: Chocolate// K: Class C// V: Creme de menthe// V: Irish coffee// The program here assigns the Keys correctly but adds every Value in the file to the List instead of just the ones I want. //FillHM.java import java.io.*; import java.util.Scanner; import java.util.*; public class FillHM { public static void main (String[] args) { Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;String, List&lt;String&gt;&gt;(); Scanner sc1 = null; try { sc1 = new Scanner(new File("/home/craig/Desktop/mytext.txt")); }catch (FileNotFoundException e) {e.printStackTrace();} List&lt;String&gt;values = new ArrayList&lt;&gt;(); String s = " "; String key = " "; while (sc1.hasNextLine()) { Scanner sc2 = new Scanner(sc1.nextLine()); sc2.useDelimiter("//"); while(sc2.hasNext()) { s = sc2.next(); if (s.startsWith("K:")) { key = s; } if (s.startsWith("V:")) { values.add(s); } map.put(key, values); } //end while } //end while System.out.println(map); } }
downvote count: 0
has answer: http://stackoverflow.com/a/26072304

http://stackoverflow.com/comment/40991011
type: QuestionComment
comment on: http://stackoverflow.com/q/26149244
score: 0
type: Comment
has text: @JBNizet you should read my comment with more care :)

http://stackoverflow.com/comment/40971394
has text: You could initilize the parameters with new double[Integer.MAX_VALUE].
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26138880

http://stackoverflow.com/q/26171820
answer count: 1
has answer: http://stackoverflow.com/a/26171861
has comment: http://stackoverflow.com/comment/41032816
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41033296
tagged with: java
has title: Passing a String ArrayList to a method returning a double value
has comment: http://stackoverflow.com/comment/41032843
has comment: http://stackoverflow.com/comment/41033754
has body: I'm working on an assignment question, which im stuck at: i extracted a text file grades.txt to an arraylist called studentgrade i want to then using the grades ive extracted to the arraylist to method convertgrade. the purpose of the convert grade is the read the line of the text file and then convert the string value to points; and then adding up all the grades the summed points. package Q2; import java.util.StringTokenizer; import java.util.ArrayList; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; import java.util.List; public class studentGPA { private static String studentGrades[]; public static void main(String[] args) throws IOException { double gpa, points = 0; //opening grades and extracting to array File file = new File ("Grades.txt"); Scanner inputFile = new Scanner(file); ArrayList&lt;String&gt; studentlist = new ArrayList&lt;String&gt;(); while (inputFile.hasNext()) { studentlist.add(inputFile.nextLine()); } /*print out student ID for (int index = 0; index&lt;studentlist.size(); index++) { StudentID = (studentlist.get(index)).split(" ",11); System.out.println("studentID:" + index + ": " + StudentID[0]); } System.out.println(); */ studentGrades = null; for (int index = 0; index&lt;studentlist.size(); index++) { String data[] = studentlist.get(index).split(" "); for (int index_grade = 0 ; index_grade &lt; 8;) { studentGrades[index_grade] = data[index_grade+3]; } System.out.println(convertGrade(studentGrades)); } //testing purposes /*for (int index = 0; index&lt;studentlist.size(); index++) { StudentGrade = (studentlist.get(index)).split(" ",11); System.out.println("studentID:" + index + ": " + StudentGrade[3] + StudentGrade[4] + StudentGrade[5] + StudentGrade[6] + StudentGrade[7] + StudentGrade[8] + StudentGrade[9] ); }*/ //answer should be 46 but im getting 14 } public static double convertGrade(String studentgrade[]) { double points = 0; for (int index = 3; index&lt;studentgrade.length; i…
type: Question
has comment: http://stackoverflow.com/comment/41033815
tagged with: arraylist
score: 0

http://stackoverflow.com/q/26162610
has body: I m doing a small spring project and I have an issue when I try toi show data iterating resultList, resultList is set and foreach loop over 4 times as items there are but giveme an exceptions, after going through I realize that items are retrive but if they were just Object instead of porper cast class Result for this reason It crash when I try to invoke getUrl() method (if I call toString works fine). that's the controller @RequestMapping(value = "/search", method = RequestMethod.GET) public ModelAndView home(ModelMap model,@RequestParam(required=false,value="") String name) { List&lt;Result&gt; result = googleSearchService.doSearch(name); modelAndView.addObject("resultList",result);//&lt;- after debub list is full of Result items return modelAndView; } that's the view &lt;c:forEach items="${resultList}" var="item"&gt; &lt;li&gt;&lt;c:out value="${item.getUrl()}"/&gt;&lt;/li&gt; &lt;/c:forEach&gt; Result class is a inner class: public class GoogleResults { private ResponseData responseData; public ResponseData getResponseData() { return responseData; } public void setResponseData(ResponseData responseData) { this.responseData = responseData; } public String toString() { return "ResponseData[" + responseData + "]"; } static class ResponseData { private List&lt;Result&gt; results; public List&lt;Result&gt; getResults() { return results; } public void setResults(List&lt;Result&gt; results) { this.results = results; } public String toString() { return "Results[" + results + "]"; } } static class Result { public String url; private String title; public String getUrl() { return url; } public String getTitle() { return title; } public void setUrl(String url) { this.url = url; } public void setTitle(String title) { this.title = title; } public String toString() { return "Result[url:" + url + ",title:" + title + "]"; } } } Trace: ava.lang.NullPointerException javax.el.BeanELResolver.invoke(BeanELResolver.java:159) org.apache.jasper.el.JasperELResolver.invoke(JasperELResolve…
has comment: http://stackoverflow.com/comment/41015811
has title: spring <c:foreach issue jstl java
has answer: http://stackoverflow.com/a/26162903
accepted answer: http://stackoverflow.com/a/26162903
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41015710
tagged with: javabeans
has comment: http://stackoverflow.com/comment/41015615
has comment: http://stackoverflow.com/comment/41015745
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41015636
tagged with: java
has comment: http://stackoverflow.com/comment/41015389
type: Question
tagged with: jstl

http://stackoverflow.com/comment/40919750
type: Comment
type: QuestionComment
has text: @brian sorry, what question do you mean?
comment on: http://stackoverflow.com/q/26082732
score: 0

http://stackoverflow.com/a/26089458
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40882377
has body: The max value for an int in java is 2,147,483,647 when you enter anything above it your app crashes. Try using a long which has a max value of 9,223,372,036,854,775,807. Also if you're saving a phone number I would recommend using a String unless you need to do math on the phone number (unlikely). Some phone numbers have characters like '+', '*', '#', etc.
type: Answer
has comment: http://stackoverflow.com/comment/40881744
answers question: http://stackoverflow.com/q/26089433
upvote count: 4
has comment: http://stackoverflow.com/comment/40881761
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26089433
score: 4
has comment: http://stackoverflow.com/comment/40881704

http://stackoverflow.com/comment/40873045
has text: Well, is there a file called `result`?
comment on: http://stackoverflow.com/q/26084761
score: 0
type: Comment
type: QuestionComment

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/26096830
type: Tag
tags question: http://stackoverflow.com/q/26191830

http://stackoverflow.com/comment/41032842
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26171586
score: 0
has text: I think I need to reanalyze the program. It was modified from a tutorial. In general terms, what should I be looking for? Divide the framerate by the time between ticks to get "real-time"?

http://stackoverflow.com/q/26072962
has answer: http://stackoverflow.com/a/26087704
tagged with: hadoop-partitioning
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40863005
has comment: http://stackoverflow.com/comment/40863110
accepted answer: http://stackoverflow.com/a/26087704
type: AnsweredQuestion
has body: I have just started learning hadoop,and running hadoop map-reduce program with custom partitioner and comparator.The problem i am facing is that the primary and secondary sort are not getting done on composite key, more-over the part of one composite-key is getting changed with other compsite-key part. for example i am creating the following keys inside mapper key1 -&gt; tagA,1 key2 -&gt; tagA,1 key3 -&gt; tagA,1 key4 -&gt; tagA,1 key5 -&gt; tagA,2 key6 -&gt; tagA,2 key7 -&gt; tagB,1 key8 -&gt; tagB,1 key9 -&gt; tagB,1 key10 -&gt; tagB,1 key11 -&gt; tagB,2 key12 -&gt; tagB,2 and partitioner and combiner are as follows //Partitioner public static class TaggedJoiningPartitioner implements Partitioner&lt;Text, Text&gt; { @Override public int getPartition(Text key, Text value, int numPartitions) { String line = key.toString(); String tokens[] = line.split(","); return (tokens[0].hashCode() &amp; Integer.MAX_VALUE)% numPartitions; } @Override public void configure(JobConf arg0) { // TODO Auto-generated method stub //NOT OVERRIDING THIS METHOD } } //Comparator public static class TaggedJoiningGroupingComparator extends WritableComparator { public TaggedJoiningGroupingComparator() { super(Text.class, true); } @Override public int compare(WritableComparable a, WritableComparable b) { String taggedKey1[] = ((Text)a).toString().split(","); String taggedKey2[] = ((Text)b).toString().split(","); return taggedKey1[0].compareTo(taggedKey2[0]); } } in reducer these key are grouped properly according to tags but not sorted properly. The order and content of keys in reducers is as follows: //REDUCER 1 key1 -&gt; tagA,1 key2 -&gt; tagA,1 key3 -&gt; tagA,1 key5 -&gt; tagA,1 //2 changed by 1 here key6 -&gt; tagA,1 //2 changed by 1 here key4 -&gt; tagA,1 //REDUCER 2 key7 -&gt; tagB,1 key11 -&gt; tagB,1 //2 changed by 1 here key12 -&gt; tagB,1 //2 changed by 1 here key8 -&gt; tagB,1 key9 -&gt; tagB,1 key10 -&gt; tagB,1 trying for long-time to resolve it but not succeded yet, Any help app…
has comment: http://stackoverflow.com/comment/40868690
tagged with: java
has comment: http://stackoverflow.com/comment/40860799
tagged with: mapreduce
has title: Composite key getting changed, Hadoop Map-Reduce?
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/40878406

http://stackoverflow.com/comment/40798274
score: 1
has text: Which leaves the second possibility: that this DRL defining the rule base isn't deployed properly. To show that it is, add a rule that fires no matter what, don't try to set the global, and see whether that rule fires.
comment on: http://stackoverflow.com/q/26041766
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40955293
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26128911
has text: I update my question with explanation , after putting your answer
type: Comment

http://stackoverflow.com/comment/40949664
type: QuestionComment
comment on: http://stackoverflow.com/q/26126863
has text: arrayLength is length of info_p, info_p is JSONArray.
score: 0
type: Comment

http://stackoverflow.com/q/26048684
has body: I'm trying to figure out the best way to sort an array which the maximun value is similar to its size. The array does not contain repeated elements. import java.util.Arrays; import java.util.Random; public class SortExamples { public static void main(String[] args) { SortExamples sortExample = new SortExamples(); int[] sizes = { 10000, 100000, 500000, 750000, 1000000, 1500000, 2000000, 5000000, 7500000, 10000000, 15000000 }; SortingMethod arraySort = new ArraySort(); SortingMethod quickSort = new QuickSort(); for (int i = 0; i &lt; sizes.length; i++) { System.out.println("Sorting array of length: " + sizes[i]); int[] array1 = sortExample.getArraySample(sizes[i]); int[] array2 = Arrays.copyOf(array1, array1.length); assert Arrays.equals(array1, array2); sortExample.sort(array1, arraySort); sortExample.sort(array2, quickSort); assert Arrays.equals(array1, array2); System.out.println(); } } public void sort(int[] array, SortingMethod sortingMethod) { assert !checkOrdered(array); long startTime = System.currentTimeMillis(); sortingMethod.sort(array); long endTime = System.currentTimeMillis(); System.out.println("Total time with " + sortingMethod.getClass().getSimpleName() + ": " + (endTime - startTime) + " millis."); assert checkOrdered(array); } public int[] getArraySample(int size) { int[] array = new int[size]; for (int i = 0; i &lt; size; i++) array[i] = i; shuffle(array); return array; } /** * Same as java.util.Collections.shuffle(List&lt;?&gt;, Random) * * @param array */ public void shuffle(int[] array) { Random random = new Random(); int count = array.length; for (int i = count; i &gt; 1; i--) swap(array, i - 1, random.nextInt(i)); } public boolean checkOrdered(int[] array) { for (int i = 1; i &lt; array.length; i++) if (array[i] &lt; array[i - 1]) return false; return true; } public static class ArraySort implements SortingMethod { public void sort(int[] array) { if (array.length &lt; 2) return; Integer[] auxiliarArray = new Integer[getMax(array) + 1]; for (int…
has comment: http://stackoverflow.com/comment/40807072
type: Question
upvote count: 0
score: -2
tagged with: sorting
has comment: http://stackoverflow.com/comment/40807044
has comment: http://stackoverflow.com/comment/40807007
answer count: 1
has comment: http://stackoverflow.com/comment/40807010
favorite count: 0
downvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26049407
accepted answer: http://stackoverflow.com/a/26049407
has title: Sorting an array which the maximum value is similar to its size

http://stackoverflow.com/q/26098927
has answer: http://stackoverflow.com/a/26099063
tagged with: executorservice
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40899562
has title: java: threads doesn't finish run() method completely?
has comment: http://stackoverflow.com/comment/40898704
tagged with: java
has body: I have a program which it explore file system, starting from a given root.The program recursively explores all directories from root point and performs a process on tiff files. indeed it merges each two tiff file. I used ExecutorService and ThreadPoolExecutor to handling merge function. ExecutorService exec = Executors.newFixedThreadPool(threadsNumber); inputDirectoryProcess( inputDir ); exec.shutdown(); try { exec.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS); } catch (InterruptedException e) { e.printStackTrace(); } Also for every merge function I use following: exec.submit(new MultipageTask( a, Integer.toString( intDetector(directoryFiles.get(i + 1).getName())/2 ), out) ); following is the MultipageTask class: public void run() { Thread thread = Thread.currentThread(); System.out.println("start by " + thread.getName() + " (" + thread.getId() + ")"); Integer[] resoulutions = null; try { BufferedImage image[] = new BufferedImage[tifImages.length]; for (int i = 0; i &lt; tifImages.length; i++) { resoulutions = getsize(tifImages[i].getPath()); SeekableStream ss = null; ss = new FileSeekableStream(tifImages[i]); ImageDecoder decoder = ImageCodec.createImageDecoder("tiff", ss, null); PlanarImage op = null; op = new NullOpImage(decoder.decodeAsRenderedImage(0), null, OpImage.OP_IO_BOUND, null); image[i] = op.getAsBufferedImage(); } TIFFField[] fields = new TIFFField[3]; // ResolutionUnit TIFFField fieldResUnit = new TIFFField(296, TIFFField.TIFF_SHORT, 1, (Object) new char[] { 2 }); fields[0] = fieldResUnit; // XResolution TIFFField fieldXRes = new TIFFField(282, TIFFField.TIFF_RATIONAL, 1, (Object) new long[][] { { resoulutions[0], 1 } }); fields[1] = fieldXRes; // YResolution TIFFField fieldYRes = new TIFFField(283, TIFFField.TIFF_RATIONAL, 1, (Object) new long[][] { { resoulutions[1], 1 } }); fields[2] = fieldYRes; TIFFEncodeParam params = new TIFFEncodeParam(); params.setCompression( TIFFEncodeParam.COMPRESSION_GROUP4 ); params.setExtraFields( fields ); OutputStre…
has comment: http://stackoverflow.com/comment/40898849
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40899292
answer count: 1
has comment: http://stackoverflow.com/comment/40899351
tagged with: threadpoolexecutor

http://stackoverflow.com/a/26067728
type: Answer
answers question: http://stackoverflow.com/q/26062542
accepted answer of: http://stackoverflow.com/q/26062542
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40871194
has body: This error message was output because the parser encountered the character sequence "var", which was recognized as a token kind that the parser was not in a state to expect at the time it was encountered. One of the acceptable token kinds is associated with the character sequence ":". In short the sequence of tokens was not one that was in the language described by the grammar. If you want to know more than that, you should ask a new question. E.g. Given this grammar ..., why is this input ..., causing my JavaCC generatted parser to issue this error message ... . But, before you go copying large grammars into stack exchange, you should (a) try to solve the problem yourself --for example using JavaCC's excellent debugging options-- and (b) boil the problem down to a minimal failing example.

http://stackoverflow.com/q/26104407
tagged with: android
answer count: 0
tagged with: java
type: Question
tagged with: admob
has title: DoubleClick for Publishers in Google Play Services cause NullPointerException in 4.2.2
score: 4
upvote count: 4
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/40914758
downvote count: 0
favorite count: 0
has body: From 18 sep, I experienced a lot of crash in my app using ads from Google Play Services only in 4.2.2. There is the report: java.lang.NullPointerException at android.webkit.WebSettingsClassic.getDefaultUserAgentForLocale(WebSettingsClassic.java:453) at android.webkit.WebViewClassic$Factory.getDefaultUserAgent(WebViewClassic.java:1503) at android.webkit.WebSettings.getDefaultUserAgent(WebSettings.java:1280) at com.google.android.gms.ads.internal.util.g.a(SourceFile:348) at com.google.android.gms.ads.internal.n.e.a(SourceFile:275) at com.google.android.gms.ads.internal.b.&lt;init&gt;(SourceFile:296) at com.google.android.gms.ads.internal.b.&lt;init&gt;(SourceFile:277) at com.google.android.gms.ads.AdManagerCreatorImpl.a(SourceFile:36) at com.google.android.gms.ads.internal.client.o.onTransact(SourceFile:66) at android.os.Binder.transact(Binder.java:310) at com.google.android.gms.internal.ar$a$a.a() at com.google.android.gms.internal.ah.b() at com.google.android.gms.internal.ah.a() at com.google.android.gms.internal.au.aM() at com.google.android.gms.internal.au.a() at com.google.android.gms.ads.doubleclick.PublisherAdView.loadAd() at ... As you can see the error prompt when try to load a new ad. Anyone that has this error know how to solve it? There is a Google Groups thread but Google doesn't say anything. The only temporal solution is avoid load ads in Android 4.2.2. TEMPORAL SOLUTION Kenfoo post a temporal solution based in handle the exception and deactivate the ads during a period of time (5 days): // Setup your default error handler static Thread.UncaughtExceptionHandler defaultExceptionHandler = null; Context context = your context final Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); defaultExceptionHandler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable ex) { for (int nest=0;nest&lt;10 &amp;&amp; ex!=null;nest++, ex=ex.getCause()) { StackTraceElement[] stel…
type: UnansweredQuestion

http://stackoverflow.com/a/26116671
has comment: http://stackoverflow.com/comment/40970067
score: 0
has comment: http://stackoverflow.com/comment/40968933
has comment: http://stackoverflow.com/comment/40969919
type: Answer
has comment: http://stackoverflow.com/comment/40968786
answers question: http://stackoverflow.com/q/26116588
has comment: http://stackoverflow.com/comment/40969052
has comment: http://stackoverflow.com/comment/40971599
has comment: http://stackoverflow.com/comment/40973405
has body: Actually I don't know what have you tried so far but Just Follow this code and verify yourself and get solved...!!! Connection con = null; try { Class.forName("com.ibm.as400.access.AS400JDBCDriver); } catch(ClassNotFoundException e) { System.out.println(e); System.exit(0); } try { con = DriverManager.getConnection("jdbc:as400://yourserver", "yourUserId", "yourPassword"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM YOURLIB.YOUR_PF_FILE"); while (rs.next()) { String field1 = rs.getString(1); String field2 = rs.getString("fieldname"); ..... } catch(Exception e) { ..... } I Hope this will help you
has comment: http://stackoverflow.com/comment/40968749
has comment: http://stackoverflow.com/comment/40969144
has comment: http://stackoverflow.com/comment/40971654
has comment: http://stackoverflow.com/comment/40969584
has comment: http://stackoverflow.com/comment/40968702
has comment: http://stackoverflow.com/comment/40968172
has comment: http://stackoverflow.com/comment/40968892
has comment: http://stackoverflow.com/comment/40968839
has comment: http://stackoverflow.com/comment/40969246

http://stackoverflow.com/q/26154524
answer count: 2
has answer: http://stackoverflow.com/a/26154733
has body: I'm trying to display first 40 records out of 17K I have stored in a map. I have the following code import java.util.*; Map&lt;String, Integer&gt; doubleCount= new HashMap&lt;String,Integer&gt;(); .... Map&lt;String,Integer&gt; newDouble40 = doubleCount.headMap(40); Java is giving me the following error: " cannot find symbol - method subMap... so I tried: Map&lt;String,Integer&gt; newDouble40 = doubleCount.subMap("",(Integer)40); and the exact error was: cannot find symbol - method subMap(java.lang.String,java.lang.int) http://docs.oracle.com/javase/7/docs/api/java/util/SortedMap.html how do I sort?
has title: Display first records in a sorted Map
tagged with: dictionary
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: sortedmap
downvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41000484
has answer: http://stackoverflow.com/a/26154604
type: Question

http://stackoverflow.com/comment/138825430
has text: The above code works fine for the test case : input = {2,7,1,4} and target =5.However it fails with the test case :{2,7,11,15} target= 9. giving result as {0,3} instead of {0,1}. Can anybody give some inputs for this failure. Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/78737775
score: 0
type: Comment

http://stackoverflow.com/comment/40999882
has text: or you could just use some other class with a static method such as fromSentence(String,Relation)?
type: Comment
comment on: http://stackoverflow.com/q/26154149
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41015499
comment on: http://stackoverflow.com/q/26073641
has text: Well, I tried to clean and rebuild, Not workin. I add to the main post the stack trace. Thank you. @CommonsWare
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26123430
accepted answer of: http://stackoverflow.com/q/26122965
type: Answer
has body: boolean add = true; for (Double doubleNum : myList) { if (add) { tempNo = myStringWayToAdd(tempNo , doubleNum+""); } add = !add; } Using this way, you won't have to use index.
score: 0
has comment: http://stackoverflow.com/comment/40942996
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26122965

http://stackoverflow.com/q/26058540
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40824864
tagged with: apache-httpclient-4.x
has body: I changed my implementation using a newer version of Apache HTTP Client (3.x before, now 4.x) My problem is, that the first HTTP request of a series of 4 different GET requests takes significantly longer than the following ones. This problem is reproducable, if a pause of 60 seconds is done between each request-series. below there are my results of a simple benchmark. server code stays the same and also the requests are always the same. I think the problem is something inside the client is destroyed after not used and re-created It would be help if somebody has any idea what I could configure to avoid this poor performance. Apache HTTP Client 3.x REQUEST A duration in ms &gt;&gt; 25 REQUEST B duration in ms &gt;&gt; 20 REQUEST C duration in ms &gt;&gt; 15 REQUEST D duration in ms &gt;&gt; 15 -----&gt;&gt;&gt; 60 sec pause REQUEST A duration in ms &gt;&gt; 20 REQUEST B duration in ms &gt;&gt; 15 REQUEST C duration in ms &gt;&gt; 15 REQUEST D duration in ms &gt;&gt; 15 Apache HTTP Client 4.2.6 REQUEST A duration in ms &gt;&gt; 4659 REQUEST B duration in ms &gt;&gt; 25 REQUEST C duration in ms &gt;&gt; 20 REQUEST D duration in ms &gt;&gt; 20 -----&gt;&gt;&gt; 60 sec pause REQUEST A duration in ms &gt;&gt; 4510 REQUEST B duration in ms &gt;&gt; 20 REQUEST C duration in ms &gt;&gt; 15 REQUEST D duration in ms &gt;&gt; 10 Thank you very much in advance Shane
has title: HTTPClient 4.x - first http request significantly slower
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/60606083
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26078476
tagged with: java
accepted answer: http://stackoverflow.com/a/26078476
has comment: http://stackoverflow.com/comment/40838833
type: Question
tagged with: benchmarking

http://stackoverflow.com/comment/41056899
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26184749
has text: Not for me. I know what it does. But the OP didn't ask for shared preferences. So if you're going to give a solution with it at least explain why. And also `SharedPreferences` is not `Java` as you're saying.
score: 1

http://stackoverflow.com/a/26069454
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40845567
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26069421
accepted answer of: http://stackoverflow.com/q/26069421
score: 5
has body: There is no real difference between these two pieces of code. The BigInteger will be created at runtime in both cases, because it's not a constant expression; the new operator will create the object at runtime. The only possible difference is that the first code example won't have a reference to the BigInteger that is created after myFunction completes, but the second code example will still have the bigInt reference variable.
has comment: http://stackoverflow.com/comment/40845646

http://stackoverflow.com/q/26194144
type: Question
has answer: http://stackoverflow.com/a/26194373
accepted answer: http://stackoverflow.com/a/26194213
score: 4
has comment: http://stackoverflow.com/comment/41074314
possible better answer: http://stackoverflow.com/a/26194373
upvote count: 4
answer count: 2
downvote count: 0
has body: I have looked at many questions regarding input/output from spawned process in Java but I still can't figure out what is wrong with my program. It's really short and simple but it doesn't work. I am using the exec() method of the Runtime object to create the new process (I know that ProcessBuilder is probably better, but this is for a simple assignment and I don't really have to worry about the stderr of the spawned process). I am running the "Processor" class myself from the IDE/command line. Memory.java is in the same directory. public class Memory { public static void main(String[] args) { System.out.println("Memory works!"); } } And the other program: import java.io.IOException; import java.io.InputStream; public class Processor { public static void main(String[] args) { Runtime rt = Runtime.getRuntime(); Process proc = null; try { proc = rt.exec("java Memory"); //execute Memory.java which is in same directory } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(2); //exit code 2 means that process creation failed. } //stream to get output from memory InputStream fromProcess = proc.getInputStream(); int x; try { while((x = fromProcess.read()) != -1) System.out.print((char)x); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } There is no output and the program never terminates. Now that could be because of the while loop in Memory for the Scanner, but then there should be some output at least right?
favorite count: 0
has comment: http://stackoverflow.com/comment/41073827
has title: Simple Java Process Input/Output failing
type: AnsweredQuestion
tagged with: runtime.exec
tagged with: java
tagged with: process
has answer: http://stackoverflow.com/a/26194213
has comment: http://stackoverflow.com/comment/41073938
tagged with: inputstream

http://stackoverflow.com/comment/40837863
score: 0
type: Comment
type: QuestionComment
has text: when you say `I have a json object`, do mean you have an instance of `JSONObject`, a String representing your object, something else entirely? (in the first case, `jsonobject.put("new name", jsonobject.remove("name"));` is as straighforward as it comes).
comment on: http://stackoverflow.com/q/26065020

http://stackoverflow.com/q/26157804
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26158104
downvote count: 0
favorite count: 0
has title: Dynamically create SessionFactory in Hibernate
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26158575
tagged with: sessionfactory
has body: In my application, there are multiple databases for each client.I want to access database as per the client logged in my application. There are two options for that: 1) Using multiple SessionFactory entry in hibernate-config.xml file. 2) Duplicate hibernate pojo file. But I want to create LocalSessionFactoryBean,SessionFactory,TransactionManager all these at runtime. So how can I do this? I don't want to do multiple entries of SessionFactory and DataSource in hibernate-config.xml File. I have tried below snippet. @Configuration @EnableTransactionManagement public class PersistenceHibernateConfig { private String driverClassName; private String url; String hibernateDialect; boolean hibernateShowSql; @Bean public LocalSessionFactoryBean alertsSessionFactoryBean() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(this.restDataSource()); sessionFactory.setPackagesToScan(new String[] { "com.ezdi.cac.bean.table" }); sessionFactory.setHibernateProperties(this.hibernateProperties()); return sessionFactory; } @Bean public DataSource restDataSource() { final DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(this.driverClassName); dataSource.setUrl(this.url); dataSource.setUsername("root"); dataSource.setPassword("root"); return dataSource; } @Bean public HibernateTransactionManager transactionManager() { final HibernateTransactionManager txManager = new HibernateTransactionManager(); txManager.setSessionFactory(this.alertsSessionFactoryBean().getObject()); return txManager; } @Bean public PersistenceExceptionTranslationPostProcessor exceptionTranslationPostProcessor() { return new PersistenceExceptionTranslationPostProcessor(); } @Bean public PersistenceExceptionTranslator exceptionTranslator() { return new HibernateExceptionTranslator(); } final Properties hibernateProperties() { return new Properties() { { this.put("persistence.dialect", PersistenceHibernateConfig.this…
tagged with: spring-mvc
score: 1
tagged with: java
tagged with: hibernate
tagged with: database
type: Question

http://stackoverflow.com/a/26122736
answers question: http://stackoverflow.com/q/26122564
has comment: http://stackoverflow.com/comment/40941856
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40941892
has body: In this case it is specifically done because sublists created from the list have to synchronize on the parent object public List&lt;E&gt; subList(int fromIndex, int toIndex) { synchronized(mutex) { return new SynchronizedList&lt;E&gt;(list.subList(fromIndex, toIndex), mutex); } } If you create your synchronized list by Collections.synchronizedList( list );, it will set the mutex to this (that is, the synchronized list object itself). But you can also call Collections.synchronizedList() with two parameters, the second of which will then be used as the mutex. And as in general it isn't a good idea to synchronize on publicly visible objects, I prefer to always use the 2 parameter version and hide the mutex object from clients of the code.
upvote count: 2

http://stackoverflow.com/q/26185066
favorite count: 0
has body: Please see below for the spring servlet file configuration. It used to work and now after upgrading dependencies to Spring core 4.0 and Spring sec oauth 2.0, it doesn't work. I mean, i'm not able to get the token. Please see below error messages and the problem : When I try to get the token using following URL, it gives 406 with error: url: /oauth2/oauth/token "Error": The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers. Am I missing any configuration that is new in Spring 4.0 and Spring security 3.2 or Spring security oauth 2.0.0 Here are the details : It's a REST based api, there's no client. I was testing this with Postman on chrome browser. Explicitly I didn't send anything in accept header. With older version of spring oauth2, it does work with application/json in accept header. With below mentioned dependency versions, I get this response and it works fine. But, it fails and gives 406 as soon as I upgrade to new dependency versions : { "access_token": "f9287b1d-243b-453d-9d3e-f5ed67e974f6", "token_type": "bearer", "refresh_token": "c6a45534-7c20-4dda-b6f1-9a231cb649ed", "expires_in": 299999, "scope": "read write" } I got that to working using following dependencies. : <springsec.version>3.1.0.RELEASE</springsec.version> <spring.version>3.1.0.RELEASE</spring.version> 1.18.1 1.0.0.RELEASE New dependencies I changed to when it started to fail: <springsec.version>3.2.5.RELEASE</springsec.version> <spring.version>4.1.1.RELEASE</spring.version> 1.18.1 2.0.3.RELEASE The initial one was implemented using InMemoryTokenStore. But, now we want to use JDBCTokenStore. I read, that Spring oauth2 2.0 has better features, So I started changing the dependencies and along with that I had to change some package references in my code as they're changed now in the 2.0. Here's the spring servlet context file: <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.spri…
has comment: http://stackoverflow.com/comment/41126331
has comment: http://stackoverflow.com/comment/41155812
has comment: http://stackoverflow.com/comment/41160834
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41126722
tagged with: spring
has comment: http://stackoverflow.com/comment/41122104
linked to: http://stackoverflow.com/q/7462202
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26258459
has comment: http://stackoverflow.com/comment/41122271
type: Question
has comment: http://stackoverflow.com/comment/41162563
has comment: http://stackoverflow.com/comment/41120682
has comment: http://stackoverflow.com/comment/41121165
has comment: http://stackoverflow.com/comment/41165380
has comment: http://stackoverflow.com/comment/41130591
has comment: http://stackoverflow.com/comment/41118217
tagged with: spring-security-oauth2
has comment: http://stackoverflow.com/comment/41121233
has comment: http://stackoverflow.com/comment/41139632
has comment: http://stackoverflow.com/comment/41067795
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41121410
has comment: http://stackoverflow.com/comment/41124777
has comment: http://stackoverflow.com/comment/41130688
has title: Spring 4.0 Oauth 2 not working
tagged with: spring-security

http://stackoverflow.com/q/26116017
type: Question
tagged with: substring
score: 0
tagged with: char
accepted answer: http://stackoverflow.com/a/26116132
has comment: http://stackoverflow.com/comment/40930391
has comment: http://stackoverflow.com/comment/40929428
tagged with: string
has answer: http://stackoverflow.com/a/65869327
possible better answer: http://stackoverflow.com/a/41430416
has answer: http://stackoverflow.com/a/62878614
has comment: http://stackoverflow.com/comment/40930492
has answer: http://stackoverflow.com/a/68729185
answer count: 5
has answer: http://stackoverflow.com/a/41430416
has title: Find if there are two specfic characters in a string
has comment: http://stackoverflow.com/comment/40931233
has comment: http://stackoverflow.com/comment/40929661
has body: I'm doing some java exercises and I can't figure why the answer isn't this one. for (int i=0;i&lt;str.length()-2;i++) { if ((str.charAt(i)=='b') &amp;&amp; (str.charAt(i+2)=='b')) { return true; } else return false; } return false; The question asks to return true if a given string(str) has "bob" in it, except the middle character does not need to be "o". The above code returns true for strings three characters in length which meet the condition, like "bob" or "bbb", but false for strings longer than that i.e "bobdfgkabcb". I've literally spent all day trying to solve this and another similar problem so I'd be gratefull to be told why its wrong. Thanks.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26116132
tagged with: java
has comment: http://stackoverflow.com/comment/40929433

http://stackoverflow.com/q/26183485
tagged with: protocols
possible better answer: http://stackoverflow.com/a/26426659
tagged with: windows
has title: Invoking Custom URI Scheme on browser start-up and closure
has answer: http://stackoverflow.com/a/26340827
accepted answer: http://stackoverflow.com/a/26340827
type: AnsweredQuestion
has body: I have created a couple of Custom URI Schemes namely start and stop for launching and stopping desktop applications (executable JAR files) from browsers. I want to execute the start script on browser start-up and stop script on browser close. 1) For running the start script on browser starting, I have planned to set the browsers default homepage to the start script. Please advice if there are any better way/alternative way to achieve this. 2) I am not sure how to handle the browser close scenario: I need to run the stop script on browser closure. Please suggest on how to achieve this.
downvote count: 0
tagged with: registry
type: Question
score: 1
tagged with: java
tagged with: browser
answer count: 2
has answer: http://stackoverflow.com/a/26426659
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/40818020
comment on: http://stackoverflow.com/q/26054876
has text: what is your ultimate motive just creating a valid url or parsing the url and getting attributes?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40884850
has text: If you want a general solution you need to provide some more example input.
comment on: http://stackoverflow.com/q/26091046
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26145601
has comment: http://stackoverflow.com/comment/40984905
has comment: http://stackoverflow.com/comment/40985314
has comment: http://stackoverflow.com/comment/40984597
has body: My project layout: . ├── bin │ ├── build │ │ └── hello.jar │ │── classes │ └── helloworld │ └── Main.class ├── build.xml ├── lib │ └── postgresql.jar └── src └── helloworld └── Main.java build.xml <project> <property name="class_dir" value="bin/classes"/> <property name="src_dir" value="src"/> <property name="build_dir" value="bin/build"/> <property name="jar_name" value="hello.jar"/> <property name="lib_dir" value="lib"/> <delete dir="${class_dir}"/> <delete dir="${build_dir}"/> <mkdir dir="${class_dir}"/> <javac includeantruntime="false" srcdir="${src_dir}" destdir="${class_dir}"/> <mkdir dir="${build_dir}"/> <attribute name="Main-Class" value="helloworld.Main"/> <pathelement location="${lib_dir}/postgresql.jar"/> The error when executing ant run: run: [java] java.lang.ClassNotFoundException: org.postgresql.Driver [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:372) [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:361) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:360) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [java] at java.lang.Class.forName0(Native Method) [java] at java.lang.Class.forName(Class.java:259) [java] at helloworld.Main.main(Unknown Source) [java] Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5430/hello_world [java] at java.sql.DriverManager.getConnection(DriverManager.java:689) [java] at java.sql.DriverManager.getConnection(DriverManager.java:247) [java] at helloworld.Main.main(Unknown Source) Is it even possible to specify a classpath like this when executing a jar file? (I had the classpath echoed and it looked fine.) EDIT: According to http://www.coderanch.com/t/108841/tools/Ant-Compile-time-runtime-classpath what I'm tryin…
upvote count: 1
has title: Ant: ClassNotFoundException when specifying external dependency
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/40984669
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40984730
has comment: http://stackoverflow.com/comment/40984498
has comment: http://stackoverflow.com/comment/40984940
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26179967
linked to: http://stackoverflow.com/q/16696688
tagged with: classpath
type: Question
tagged with: ant

http://stackoverflow.com/a/26183261
answers question: http://stackoverflow.com/q/26094017
score: 1
upvote count: 1
has body: Problem with the sqljdbc jar file , Used any 32 bit one , After replacing the jar , everything worked fine. Thanks
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26094017
type: Answer

http://stackoverflow.com/q/26170289
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26239642
has answer: http://stackoverflow.com/a/26231332
tagged with: jstl
possible better answer: http://stackoverflow.com/a/26239642
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
has body: I am trying to access a Hashtables value based on its key, which is a number as String in JSTL. But if I increment/decrement the keys value, it does not work anymore. I iterate the sorted list of keys in a for loop. I use this item to access Hashtable. &lt;c:forEach items="${helper:getSortedList(hashtableObj)}" var="lineNumber" varStatus="loop"&gt; &lt;c:if test="${param.lineNbr eq lineNumber}"&gt; &lt;c:if test="${lineNumber&gt;1}"&gt; &lt;fmt:parseNumber var="prevLineNumberKey" type="number" value="${lineNumber-1}" /&gt; &lt;c:out value="PREV ${hashtableObj[prevLineNumberKey]}" escapeXml="false"/&gt;&lt;br/&gt; &lt;/c:if&gt; &lt;c:out value="Current :${lineNumber}" /&gt;&lt;br/&gt; &lt;c:if test="${lineNumber&lt;fn:length(hashtableObj)-1}"&gt; &lt;fmt:parseNumber var="nextLineNumberKey" type="number" value="${lineNumber+1}" /&gt; &lt;c:out value="NEXT ${hashtableObj[nextLineNumberKey+1]}" escapeXml="false"/&gt;&lt;br/&gt; &lt;/c:if&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; The output is PREV Current :51 NEXT But what I expected is PREV 50 Current :51 NEXT 52 Any pointers are appreciated.
favorite count: 0
has comment: http://stackoverflow.com/comment/41168700
accepted answer: http://stackoverflow.com/a/26231332
type: Question
score: 3
has answer: http://stackoverflow.com/a/26245085
has title: Manipulating Hashtable key is not working
upvote count: 3

http://stackoverflow.com/comment/41045394
comment on: http://stackoverflow.com/a/26178226
score: 0
type: AnswerComment
has text: i have done with the changes and tried with new create statement/without new create statement..getting the same result.only the first while is getting executed
type: Comment

http://stackoverflow.com/comment/40942127
type: QuestionComment
comment on: http://stackoverflow.com/q/26122965
has text: @Compass yes I want to get the number at alternate index and add them
score: 0
type: Comment

http://stackoverflow.com/comment/41039250
has text: Did you check that your object is really detached in managed bean? Here is example how you can check http://stackoverflow.com/questions/19474399/how-to-identify-an-object-is-transient-or-detached-in-hibernate
comment on: http://stackoverflow.com/a/26066955
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26038366
type: Answer
has body: Endian-ness has nothin to do with putting the data in the next packet. That's just because it's a byte stream protocol. You have two separate problems to solve: one with ntohl() and friends, the other by continuing to read until you have all the data you're expecting.
has comment: http://stackoverflow.com/comment/40790289
has comment: http://stackoverflow.com/comment/40791458
score: 0
answers question: http://stackoverflow.com/q/26036156

http://stackoverflow.com/comment/40812770
has text: @babravahan It's UDP, not 'upd'. I think *you* need to check some issues yourself. You also need to be a lot more specific. "Check how C language interprets 33.1313576" is meaningless in the absence of C code, and without specifying the platform, or the UDP protocol you're using. As a matter of fact 0x13BF71A8 = 331313576 without any scaling.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26051698

http://stackoverflow.com/comment/41601173
type: Comment
comment on: http://stackoverflow.com/q/26062384
has text: @Robert I corrected it, please check
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40861273
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26077944
score: 0
has text: @Holger That will surely give more than OP's two threads.

http://stackoverflow.com/q/26191611
tagged with: java
has body: , I have just started learning java for android, I have set the TextVisibility of a textfield to GONE, I need the TextVisibilty to change to VISIBLE after 7 seconds from Button click, I had searched the internet and could not find anything useful or I could'nt understand. So, Please help me.
tagged with: eclipse
type: Question
answer count: 2
upvote count: 0
score: -1
has title: TextVisibility change after a period of time
has answer: http://stackoverflow.com/a/26191814
has answer: http://stackoverflow.com/a/26191653
linked to: http://stackoverflow.com/q/2395769
favorite count: 0
possible better answer: http://stackoverflow.com/a/26191653
tagged with: android
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26191814

http://stackoverflow.com/q/26086523
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26086658
has answer: http://stackoverflow.com/a/26086658
has comment: http://stackoverflow.com/comment/40876267
has comment: http://stackoverflow.com/comment/40876185
has comment: http://stackoverflow.com/comment/40876094
has comment: http://stackoverflow.com/comment/40876103
tagged with: java
upvote count: 1
has body: I have a circle of let's say 10 of radius with the center x=0 y=0. And I have a number n (e.g. 3). I want to get a point from that circle. Here is an explanation with an image: So if n=0, the method would return 0;-6 And if n=1, the method would return 3;-5 etc. But the method would receive parameters like the unit between each n etc.
has comment: http://stackoverflow.com/comment/40876180
has comment: http://stackoverflow.com/comment/40876079
score: -3
has title: Getting a point of circle from a number?
downvote count: 4
has answer: http://stackoverflow.com/a/26086642
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/26086642

http://stackoverflow.com/comment/41123533
has text: I actually got it to work, it was a matter of assigning the "from" & "to" respectively. Basically if I want a "jar" file's result to be emailed to me once it's running, I should assign the "from" & "to" to be my email . Well at least that's how I got it to work
comment on: http://stackoverflow.com/a/26092701
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/30319817
answers question: http://stackoverflow.com/q/26063130
type: Answer
score: 0
has body: Yes, your variable action will be null if you don't have an entry action within the form payload. You can notice that Restlet provides a method getFirstValue with a default value parameter: String action = form.getFirstValue("action", "defaultActionValue"); This could help you not to have NullPointerException. Otherwise, it seems that you try to implement several actions for a method POST. I think that this blog post could give you some additional hints: https://templth.wordpress.com/2015/03/20/handling-multiple-actions-for-a-post-method/. Hope it helps you, Thierry

http://stackoverflow.com/comment/40913230
type: Comment
type: QuestionComment
has text: But when i run on my computer, as localuser, it return for exemple "Fillipe", not "root".
comment on: http://stackoverflow.com/q/26106723
score: 0

http://stackoverflow.com/q/26068715
has comment: http://stackoverflow.com/comment/40843792
has title: prime numbers switch in a java program has unexpected output
upvote count: 1
accepted answer: http://stackoverflow.com/a/26068855
has body: I'm trying to create a program that reads a list of 10 integers and asks the user whether they'd like to know if the integers entered are even/odd, prime, or their sign. I don't see where the mistake is: import java.io.*; public class Menu1 { public static void main(String args[])throws IOException{ BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int array[]=new int[10]; int a=0, i=0; System.out.println("Welcome, please enter 10 integers:"); try{ for(i=0;i&lt;10;i++){ System.out.println("Enter integer "+(i+1)+":"); array[i]=Integer.parseInt(b.readLine()); } }catch(NumberFormatException e){ System.err.println("Not an integer! "+e.getMessage()); } System.out.println("What would you like to know?\n(1) Even/Odd\n(2) Primes\n(3) Sign"); try{ a=Integer.parseInt(b.readLine()); }catch(NumberFormatException e){ System.err.println("Not an integer! "+e.getMessage()); } switch (a){ case 1: for(i=0;i&lt;10;i++){ if(array[i]%2==0) System.out.println(array[i]+" is even"); else System.out.println(array[i]+" is odd"); } break; case 2: for(int j=0;j&lt;10;j++){ for(i=2;i&lt;array[j];i++){ if(array[j]%i==0) System.out.println(array[j]+" isn't prime"); else System.out.println(array[j]+" is prime"); } } break; case 3: for(i=0;i&lt;10;i++){ if(array[i]&gt;0) System.out.println(array[i]+" is positive"); else if(array[i]&lt;0) System.out.println(array[i]+" is negative"); else System.out.println(array[i]+" has no sign"); } break; default: System.out.println("Invalid Option"); } } } case 1 and case 3 work just fine, case 2 is where the strange output occurs; any help will be greatly appreciated
possible better answer: http://stackoverflow.com/a/26068747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40845292
has answer: http://stackoverflow.com/a/26068747
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26068775
tagged with: switch-statement
type: Question
tagged with: for-loop
downvote count: 0
has comment: http://stackoverflow.com/comment/40843866
favorite count: 0
has answer: http://stackoverflow.com/a/26068855
answer count: 3
has comment: http://stackoverflow.com/comment/40843799

http://stackoverflow.com/q/26095937
has answer: http://stackoverflow.com/a/26102557
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
has body: I was dealing with several spring issues (spring security was usually involved but also other technologies mentioned in tags for this question) with @Configuration ordering where something was initialized "too early" or "too late". To name an example: When customizing Tomcat: A ServletContext is required to configure default servlet handling The answer usually was to create separate @Configuration file for some of the beans and then it started to work. The nature of the errors (stacktraces) I was getting didn't usually ring bells which was probably my fault :) Can someone please point me out where I can find information about why creating separate @Configuration class helps and how the order of @Configuration classes is determined? Any tips on what to watch for in the stacktrace to identify this type of issues will be also much appreciated.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26102557
score: 1
has title: Spring security and @Configuration order
upvote count: 1
type: Question
tagged with: spring-mvc
tagged with: spring-boot
tagged with: java
linked to: http://stackoverflow.com/q/23008302

http://stackoverflow.com/a/26172350
has body: The line asking for the question should be println not print System.out.println("What country are you from and what is your name, also how old are you? "); The difference: Println() won't print on a new line, it will terminate the current line with a newline character or sequence. In other words, println() will print an end-of-line character, while print() will not. If you invoke println() after a print(), the argument to println() will append to the argument to print(). from (http://www.coderanch.com/t/394386/java/java/system-print-println)
accepted answer of: http://stackoverflow.com/q/26172226
type: Answer
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/26172226

http://stackoverflow.com/comment/41017158
type: Comment
type: QuestionComment
has text: @radiance yes your code work for me ..do you enter spaces with number like 2 .
comment on: http://stackoverflow.com/q/26163183
score: 0

http://stackoverflow.com/q/26150527
tagged with: spring
tagged with: properties
tagged with: java
score: 16
type: Question
has answer: http://stackoverflow.com/a/28000001
downvote count: 0
upvote count: 16
answer count: 3
has answer: http://stackoverflow.com/a/44138038
has title: How can I reload properties file in Spring 4 using annotations?
favorite count: 0
has answer: http://stackoverflow.com/a/39138850
type: UnansweredQuestion
has body: I have a simple application where i am using several properties-files to fetch content edited by other users (links to sites etc). The class where i load the properties look like this: @Configuration @PropertySource("classpath:salestipsWhitelist.properties") public class SalestipsWhitelist { @Autowired Environment env; public Environment getEnv() { return env; } public void setEnv(Environment env) { this.env = env; } @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } Some of the properties file: UPS_MPP_M_L=True UPS_MPP_M_M=True UPS_MPP_M_MP=True UPS_MPP_M_S=True This works fine, but if i make changes to the properties-file, i have to reload the app to visualise any changes made. Is it possible, if i move the location to disk instead of classpath, to reload this periodically or manually? I do not want this to be done automatically on change, as i want to have control over when this is done / updated.
tagged with: annotations

http://stackoverflow.com/q/26091682
tagged with: lambda
tagged with: java-8
linked to: http://stackoverflow.com/q/23430854
tagged with: java
upvote count: 1
duplicate of: http://stackoverflow.com/q/23430854
has comment: http://stackoverflow.com/comment/40886764
has body: So I'm writing a version of the Bresenham line algorithm. I wrote a class, and I tried converting it to java 8 style (this is my first time trying out java 8). I wanted the user of the class to either pass in a lambda that returns a boolean (whether to continue) or to pass in a lambda that returns void (to complete to the end of the algorithm). When I wrote two separate lambda interfaces though, I get the error The method Line(int, int, int, int, BresenhamPlotter.BresenhamPlotFunctionAlwaysContinue) is ambiguous for the type BresenhamPlotter This was my first attempt at the class, but I got that error in the first method. public class BresenhamPlotter { /** * The Interface BresenhamPlotFunction. */ public interface BresenhamPlotFunction { /** * Plot function, pass it into a plotting algorithm. * * @param x * the x position * @param y * the y position * @return True to continue, false to stop the algorithm early */ public boolean plotFunction(int x, int y); } public interface BresenhamPlotFunctionAlwaysContinue { /** * Plot function, pass it into a plotting algorithm. * * @param x * the x position * @param y * the y position */ public void plotFunction(int x, int y); } /** * Plots a line using the Bresenham line algorithm from (x0, y0) to (x1, y1) and plots each point using the plot function. * * @param x0 * the start x * @param y0 * the start y * @param x1 * the end x * @param y1 * the end y * @param plot * the plot function */ public static void Line(final int x0, final int y0, final int x1, final int y1, final BresenhamPlotFunctionAlwaysContinue plot) { Line(x0, y0, x1, y1, (x, y) -&gt; { plot.plotFunction(x, y); return true; }); } /** * Plots a line using the Bresenham line algorithm from (x0, y0) to (x1, y1) and plots each point using the plot function. * * @param x0 * the start x * @param y0 * the start y * @param x1 * the end x * @param y1 * the end y * @param plot * the plot function */ public static void Line(int x0, int y0, final int x1, final int y1, final…
has comment: http://stackoverflow.com/comment/40886004
type: UnansweredQuestion
answer count: 0
has title: Java 8 the method X is ambiguous for the type Y
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40885950
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40889635
has comment: http://stackoverflow.com/comment/40886801

http://stackoverflow.com/a/26097452
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: To find directories, you need to filter the list. listFiles() is a better method to use as it returns a list of File objects rather than String, this is ultimately more powerful and allows things like testing if the "file" is a directory which I believe you're trying to do. File home = new File(System.getProperty("user.home")); for (File file : home.listFiles()) { if (file.isDirectory()) { System.out.println(file); } } Alternatively you can use a FileFilter in listFiles(), this will return a primitive array of File, which you can change to a List with Arrays.asList List&lt;File&gt; directories = Arrays.asList(home.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } })); Regarding the issue of the "incorrect" output [Ljava.lang.String;@1540e19d, this is normal for printing out primitive arrays, unlike Collection types which typically have a nice toString() implemention. You can use the utility method java.util.Arrays.toString to "pretty print" each element. If you require a recursive listing I'd consider using the newer java.nio.Files.walk() functionality rather than writing your own recursive method. List&lt;Path&gt; paths = Files.walk(home.toPath()).filter(new Predicate&lt;Path&gt;() { @Override public boolean test(Path path) { return path.toFile().isDirectory(); } }).collect(Collectors.toList()); Or more concisely with Java 8 closures. List&lt;Path&gt; paths = Files.walk(home.toPath()).filter((path) -&gt; path.toFile().isDirectory()).collect(Collectors.toList());
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40897834
accepted answer of: http://stackoverflow.com/q/26097282
answers question: http://stackoverflow.com/q/26097282

http://stackoverflow.com/comment/41062808
comment on: http://stackoverflow.com/q/26187569
type: Comment
type: QuestionComment
has text: @ericbn er, obviously I meant "quite" rather than "queer"...
score: 0

http://stackoverflow.com/comment/40820155
comment on: http://stackoverflow.com/q/26055075
score: 0
type: Comment
type: QuestionComment
has text: @arsenal That won't be possible. You could maybe try to rewrite a.class from javadoc contracts and bytecode, but that's just madness.

http://stackoverflow.com/q/26125118
has comment: http://stackoverflow.com/comment/40950057
score: 0
has answer: http://stackoverflow.com/a/26134864
accepted answer: http://stackoverflow.com/a/26134864
answer count: 1
tagged with: jdbc
has body: I get that code: @Override public void bulkInsert(Collection&lt;SortingPlanData&gt; data, SortingPlan plan) { Session session = getEntityManager().unwrap(Session.class); SessionFactoryImplementor sessionFactoryImplementation = (SessionFactoryImplementor) session .getSessionFactory(); ConnectionProvider connectionProvider = sessionFactoryImplementation .getConnectionProvider(); String sql = "insert into SORTING_PLAN_DATA (ACHEMINEMENT, ANCIEN_GROUPE_SERVICE_LABELS, BAG_ID, BARCODE_ID, CHRONOSERVICE, CODE_ROUTING, D_DEPOT_NUMBER, D_SORT, DELIVERY_STATION, DESCRIPTION, DESTINATION_PAYS_ALPHA2_ISO, DESTINATION_PAYS_ALPHA3_ISO, DESTINATION_PAYS_NUM_ISO," + " DIST, GROUPE_SERVICE_LABELS, GROUPING_PRIORITY, LIVRAISON, O_SORT, ORIGINE_PAYS_ALPHA2_ISO, ROUTING_PLACES, S_SORT, SENDING_DATE, SERVICE_CODES, SITE_IATA, SORTING_PLAN_ID, TYPE_EXPORT, VILLE, ZIP_MAX, ZIP_MIN) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; Transaction tx = session.getTransaction(); final int batchSize = 500; int count = 0; try { tx.begin(); Connection con = connectionProvider.getConnection(); PreparedStatement ps = con.prepareStatement(sql); for (SortingPlanData spd : data) { ps.setString(1, spd.getAcheminement()); ps.setString(2, spd.getAncienGroupeServiceLabels()); ps.setString(3, spd.getBagId()); ps.setString(4, spd.getBarcodeId()); ps.setString(5, spd.getChronoservice()); ps.setString(6, spd.getCodeRouting()); ps.setString(7, spd.getDDepotNumber()); ps.setString(8, spd.getDSort()); ps.setString(9, spd.getDeliveryStation()); ps.setString(10, spd.getDescription()); ps.setString(11, spd.getDestinationPaysAlpha2Iso()); ps.setString(12, spd.getDestinationPaysAlpha3Iso()); ps.setInt(13, spd.getDestinationPaysNumIso()); ps.setString(14, spd.getDist()); ps.setString(15, spd.getGroupeServiceLabels()); ps.setString(16, spd.getGroupingPriority()); ps.setString(17, spd.getLivraison()); ps.setString(18, spd.getOSort()); ps.setString(19, spd.getOriginePaysAlph…
has title: Atomic transaction when using JDBC call after Hibernate processes
tagged with: spring
type: AnsweredQuestion
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/40909069
comment on: http://stackoverflow.com/a/26104486
type: AnswerComment
has text: @Rasmus it owuld be a waste of effort to try to answer your questions here because what you are asking is already in the tutorial :)
score: 0
type: Comment

http://stackoverflow.com/a/26123536
has comment: http://stackoverflow.com/comment/40944247
answers question: http://stackoverflow.com/q/26122728
has body: Need to match with regular expression with whitespace character one or more times i.e. "\s" String input = " 08/14 1351 XMGYV4 AOUSC LTC .000 .000 VDPJU01PMP 11AUG14:15:17:05.99 "; String[] split = input.split("\\s+"); System.out.println(Arrays.toString(split));
score: 0
type: Answer

http://stackoverflow.com/comment/81810772
type: Comment
comment on: http://stackoverflow.com/a/37966649
score: 4
type: AnswerComment
has text: thumbs up for mentioning time zone

http://stackoverflow.com/a/26066116
has body: the destination needs to contain the full path of the file that will eventually be there. so you say if you needed to copy /home/dauser/faq.txt to /home/faq.txt File file = new File(path); Path sourceZip = file.toPath(); StringBuilder sb = new StringBuilder(); sb.append(new File(System.getProperty("user.dir")).getParent()); sb.append("/"); sb.append(file.getName()); Path target = Paths.get(sb.toString()); try { Files.copy(sourceZip, target, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) //DirectoryNotEmptyException occurs here {}
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40839169
answers question: http://stackoverflow.com/q/26065933
accepted answer of: http://stackoverflow.com/q/26065933

http://stackoverflow.com/q/26131188
has body: I am new to android. I have created a new android project selecting tabs as a template Eclipse implements tabs and pager itself. Each tab view has a fragment. Then I implemented ListView in a fragment. Now when a list item is tapped, new view (fragment) should be open. To open a new fragment view on clicking list item, I need to give R.id.fragment_container to it. this id tells us on which container fragment view will be shown. My Question is where should I get R.id.container as there is no container is defined with this id in the Main Activity. I have tried many things came in google like to add a layout (Relative/Linear) as well but it crashes and also I have tried to give pager id as well but nothing happens. Think i have some understanding problem with fragments. Any explanation/help specific to my case would be highly appreciated. Thanks
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26133586
tagged with: android
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/26133466
type: Question
tagged with: android-layout
score: 0
answer count: 2
has title: where to get R.id.container from in Android?
upvote count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/26095064
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40894401
has comment: http://stackoverflow.com/comment/40894084
has body: You would need to save current position of media player and restart it later from that position using seekTo. Something like: int currentPos = 0; pause.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mediaPlayer.isPlaying()) { currentPos = mediaPlayer.getCurrentPosition(); mediaPlayer.pause(); //change image to play } else { mediaPlayer.seekTo(currentPos); mediaPlayer.start(); //again revert image to pause } } }); Hope it helps.
has comment: http://stackoverflow.com/comment/40894370
has comment: http://stackoverflow.com/comment/40894203
has comment: http://stackoverflow.com/comment/40894276
has comment: http://stackoverflow.com/comment/40892679
type: Answer
has comment: http://stackoverflow.com/comment/40892641
accepted answer of: http://stackoverflow.com/q/26094983
has comment: http://stackoverflow.com/comment/40892849
score: 2
has comment: http://stackoverflow.com/comment/40894004
has comment: http://stackoverflow.com/comment/40892462
answers question: http://stackoverflow.com/q/26094983
downvote count: 0
has comment: http://stackoverflow.com/comment/40893676
has comment: http://stackoverflow.com/comment/40892446
has comment: http://stackoverflow.com/comment/40894114
has comment: http://stackoverflow.com/comment/40894311

http://stackoverflow.com/q/26084759
upvote count: 0
has comment: http://stackoverflow.com/comment/40872993
answer count: 1
has comment: http://stackoverflow.com/comment/40872973
favorite count: 0
type: UnansweredQuestion
score: -1
has title: Can NOT Execute Java Command From External Java Folder
tagged with: java
has comment: http://stackoverflow.com/comment/40872932
tagged with: swing
has answer: http://stackoverflow.com/a/26089360
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40873038
has comment: http://stackoverflow.com/comment/40873672
has comment: http://stackoverflow.com/comment/40873085
tagged with: bash
has body: I have a folder which contains external JAVA so client does NOT have to install java on her/his computer my application will run on this my java folder. This application is swing app and it will be cross platform. Here is my code: // this is my external java folder and in folder it is "java.exe" Process process = run.exec("./java/jdk1.7.0_67/bin/java -jar " + "./app/app-1.1.jar " + commandSuffix); It says file not found exception i changed to "java.exe" but also it does NOT work i need to run this command in this JAVA code so it will be platform independent. When i changed to code like this: run.exec("java -jar " + "./app/app-1.1.jar " + commandSuffix); it works because system calls real java path but i need to run previous code from my java folder so client does NOT have to install java.

http://stackoverflow.com/q/26097641
has answer: http://stackoverflow.com/a/26103871
has title: Encrypt clear strings using weblogic.security.encrypt utility for different multiple weblogic instances
score: 0
answer count: 1
has body: I'm trying to encrypt some plain cleartext strings using weblogic.security.encrypt utility but not sure whether we can use the same encrypted password for a different domain or on a different Weblogic instance (present on a different server). The situation I have is that I'm generating the encrypted passwords by running the utility from Domain1/bin on WL instance on Server1. The encrypted passwords are used to replace the cleartext passwords in the project and then I build the project, so the encrypted passwords are included in the EAR file. And when that EAR file gets deployed/Run from under the same domain and on same WebLogic server, they get decrypted before usage. BUT what if I deploy this same EAR file to another domain or another WEblogic instance on a different server? Will the passwords get decrypted? Any help advise will be hugely appreciated!! Thanks
tagged with: security
accepted answer: http://stackoverflow.com/a/26103871
type: AnsweredQuestion
tagged with: encryption
type: Question
tagged with: weblogic
tagged with: java

http://stackoverflow.com/q/26040592
favorite count: 0
has title: Java 8 -- How do I calculate (milli)seconds from now using xsd:duration
tagged with: datetime
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
has body: I feel like this question has been asked in one way or another, but I'm still not confident of my result. I have an xsd:duration which will give me a desired expiration described in years, months, days, and seconds. I can collect the integer values of these parts with, for example, duration.getYears() or duration.getMonths(). Because my chosen db is Cassandra, I want to exploit the TTL option, which will automatically expire an inserted row after a specified number of seconds. The critical part is getting from xsd:duration to an integer/long value of seconds which respects the Gregorian calendar (where 1 month from now is not simply 30.41 days, but 31). At the moment, I'm using the following code: LocalDateTime then = LocalDateTime.now().plusYears(duration.getYears()).plusMonths(duration.getMonths()).plusDays(duration.getDays()).plusHours(duration.getHours()).plusMinutes(duration.getMinutes()).plusSeconds(duration.getSeconds()); long ttlMillis = then.toInstant(ZoneOffset.UTC).toEpochMilli() - Instant.now().toEpochMilli(); Is there a quicker/cleaner way to do this? I'm also not sure if I should worry about large durations... My particular use cases wouldn't call for anything larger that 2 years.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26041239
tagged with: java
accepted answer: http://stackoverflow.com/a/26041239
tagged with: java-time
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26055504
type: Question
tagged with: java
upvote count: 2
tagged with: jakarta-mail
answer count: 2
has comment: http://stackoverflow.com/comment/40819127
has comment: http://stackoverflow.com/comment/40818978
has body: I'm trying to send a simple mail using spring. Here is my mail sender bean definition in java configuration. @Bean public JavaMailSender javaMailService() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setSession(getMailSession()); return mailSender; } public Session getMailSession() { JndiTemplate template = new JndiTemplate(); Session session = null; try { session = (Session) template.lookup("java:jboss/mail/Default"); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return session; } I'm running is jboss wildfly and the beans are created without any issue. Here is my code to send the email. @Autowired private JavaMailSender mailSender; @Override public void sendMail(String mailTo, String subject, String content) throws MessagingException{ MimeMessage message = mailSender.createMimeMessage(); message.setSubject(subject); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mailTo,false)); mailSender.send(message); } the JavaMailSender is injected correctly. when I debug the execution happens till mailsender.send() method. and it starts to hang. It seems all the configurations in the jboss is correct. I also tried specifying the mail server parameters in the bean it self. but still it's not working. What am I doing wrong here?
has answer: http://stackoverflow.com/a/32880533
favorite count: 0
has comment: http://stackoverflow.com/comment/40822842
has title: Email sending hangs in Spring with Java Mail
has comment: http://stackoverflow.com/comment/40819270
score: 2
has comment: http://stackoverflow.com/comment/40819610
downvote count: 0
has comment: http://stackoverflow.com/comment/40819048
has comment: http://stackoverflow.com/comment/40819489
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15597616
tagged with: spring
has comment: http://stackoverflow.com/comment/40823018
has answer: http://stackoverflow.com/a/26058026

http://stackoverflow.com/q/26146057
has comment: http://stackoverflow.com/comment/40986464
tagged with: swing
has body: I'm creating a "Presentation" on a jFrame as part of a project and need some help. I have it starting as a 200, 200 size frame with a button in the middle that says "Let's Start" then when you click on it, the size of the frame changes. When I click on the button you have to drag the window to make it the already defined size seen as the window stays the original 200 by 200 it doesn't open the window to 1335 by 675. Here's my code. package randomGUIs; import java.awt.Color; import java.awt.Dimension; public class Presentation extends javax.swing.JFrame { public Presentation() { initComponents(); startPanel.setBackground(Color.blue); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { startPanel = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("Let's Start"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout startPanelLayout = new javax.swing.GroupLayout(startPanel); startPanel.setLayout(startPanelLayout); startPanelLayout.setHorizontalGroup( startPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(startPanelLayout.createSequentialGroup() .addGap(50, 50, 50) .addComponent(jButton1) .addContainerGap(49, Short.MAX_VALUE)) ); startPanelLayout.setVerticalGroup( startPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(startPanelLayout.createSequentialGroup() .addGap(78, 78, 78) .addComponent(jButton1) .addContainerGap(77, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup(…
type: Question
has comment: http://stackoverflow.com/comment/40984858
has answer: http://stackoverflow.com/a/47591083
score: 0
has comment: http://stackoverflow.com/comment/40984758
linked to: http://stackoverflow.com/q/8966535
answer count: 2
has comment: http://stackoverflow.com/comment/40986581
has comment: http://stackoverflow.com/comment/40984954
has comment: http://stackoverflow.com/comment/40984794
has answer: http://stackoverflow.com/a/26148081
has comment: http://stackoverflow.com/comment/40986887
has comment: http://stackoverflow.com/comment/40986658
has title: Changing the size of a jFrame on button click
has comment: http://stackoverflow.com/comment/40986733
has comment: http://stackoverflow.com/comment/40984866
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40988369
has comment: http://stackoverflow.com/comment/40984718
tagged with: jbutton
has comment: http://stackoverflow.com/comment/40986270
tagged with: java

http://stackoverflow.com/q/26039910
answer count: 1
has body: I have a problem : moving a tab of a tabpane from the index 0 to 1 isn't working anymore. I updated recently the new version of java (8u20). Since then, the "moving tab" feature of my program doesn't work anymore. Here's my code : final TabPane tabPane = new TabPane(); final Tab tabOne = new Tab("hello"); Label label1 = new Label("hello"); tabOne.setContent(label1); tabOne.getContent().setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { tabPane.getTabs().remove(tabOne); tabPane.getTabs().add(1, tabOne); tabPane.getSelectionModel().select(1); } }); Tab tabTwo = new Tab("byebye"); tabPane.getTabs().add(tabOne); tabPane.getTabs().add(tabTwo); As you can see, the code is quite simple : I have two tabs, and I just move the first tab from index 0 to index 1 when a click occurs on its content. This code works with jre8, but doesn't with jre1.8.0_20 (the tabs disappear ...). Does someone have an idea of why is this happening ? Thanks for any help
score: 0
has title: Moving tabs doesn't work anymore since jre1.8.0_20 version update
has answer: http://stackoverflow.com/a/26041515
tagged with: tabs
type: AnsweredQuestion
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26041515
type: Question

http://stackoverflow.com/comment/40803793
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26046545
type: Comment
has text: I need to persist the PendinIntent so that I can use it to cancel an alarm that I've set with alarm manager even after the app was destroyed

http://stackoverflow.com/comment/40946079
score: 0
comment on: http://stackoverflow.com/a/26124893
type: Comment
has text: Thanks, but I think it isn't what I'm looking for. I don't have a client state, I want that each call doesn't overwrite variables from another call
type: AnswerComment

http://stackoverflow.com/a/26092006
answers question: http://stackoverflow.com/q/26091654
score: 0
type: Answer
has body: Alright I designed a solution from the comments I created a Lanes class that I could use to access the array of Lanes then I did a little math and came up with this solution package me.heirteir.Amazed.gameObjects.framework; import com.badlogic.gdx.utils.Array; public class Lanes { public static final int LANE_COUNT = 5; public static Array&lt;Lane&gt; lanes = new Array&lt;Lane&gt;(); public static void setupLanes(float width, float height) { for (int x = 0; x &lt; 5; x++) { lanes.add(new Lane(width / LANE_COUNT, height, width / LANE_COUNT * x + 1, height)); } } } Then here is my actual lane class package me.heirteir.Amazed.gameObjects.framework; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; public class Lane { private Vector2 pos; private Rectangle rect; public Lane(float width, float height, float x, float y) { rect = new Rectangle(); rect.width = width; rect.height = height; rect.x = x; rect.y = y; pos = new Vector2(x, y); } public Vector2 getPos(){ return pos; } public Rectangle getRect() { return rect; } } then this is where I render just to make sure the lanes were created correctly public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); game.batch.setProjectionMatrix(camera.combined); game.batch.begin(); for (Lane lane : Lanes.lanes) { game.batch.draw(game.texture, lane.getPos().x, 0, lane.getRect().width, lane.getRect().getHeight()); } game.batch.end(); } This was the final result https://i.sstatic.net/UyX1h.jpg
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26091654

buildpack
tag name: buildpack
tags question: http://stackoverflow.com/q/26116320
type: Tag

http://stackoverflow.com/comment/40961915
score: 4
type: QuestionComment
type: Comment
has text: Why do your `set` methods not set anything?
comment on: http://stackoverflow.com/q/26133706

http://stackoverflow.com/q/26167688
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26168135
answer count: 1
score: 0
has title: JAXB not mapping an attribute into a "custom" class
has body: I'm generating java classes from an xml schema, and for one complex type I want jaxb to use an existing class, for which I have an external bindings customisation file. The custom class is unmarshalled into correctly except for the single attribute of the type, which is never populated in the java class. Below is a demo of the problem with type/class Thing. The Thing as defined in the schema is: <xsd:complexType name="Thing"> <xsd:sequence> <xsd:element name="nameEl" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="nameAttr" type="xsd:string" use="required"/> </xsd:complexType> and the snippet that reads the matching xml file is: JAXBContext jc = JAXBContext.newInstance("jaxbtest"); Unmarshaller u = jc.createUnmarshaller(); // Make it validate against the instance schema SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(new File("./sample.xsd")); u.setSchema(schema); Config config = (Config)u.unmarshal(new File("./sample.xml")); for (Thing thing : config.getThing()) { System.out.println("nameAttr=[" + thing.getNameAttr() +"]"); System.out.println("nameEl=[" + thing.getNameEl() +"]"); } Reading in this xml: goodbye using the Thing class generated by JAXB (not using the customisations xjb) the output is as expected: nameAttr=[hello] nameEl=[goodbye] Using the custom Thing class which just has getters & setters for nameAttr & nameEl, the output is nameAttr=[null] nameEl=[goodbye] The custom class is simply: public class Thing { private String nameEl; private String nameAttr; public String getNameEl() { return nameEl; } public void setNameEl(String value) { this.nameEl = value; } public String getNameAttr() { return nameAttr; } public void setNameAttr(String value) { this.nameAttr = value; } } Can anyone explain why the behaviour is different for the "nameEL" element and the "nameAttr" attribute" ? Comparing the custom Thing with the JAXB generated Thing the only difference is the annotations, which I …
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26168135

http://stackoverflow.com/q/26092784
favorite count: 0
has title: Reading System.in for Intellij using Console
has body: I need to open up the console and type in inputs for my an assignment using Intellij. Eclipse has a way of doing this using the Scanner class and reading System.in but running the same code in IntelliJ does not work as I can't type anything into the console. Is there any way to do this? My code is as follows: public class BasicAssertions { @Test public void testAssertions(){ System.out.println("Enter: "); Scanner reader = new Scanner(System.in); int first = reader.nextInt(); int second = reader.nextInt(); String s = reader.next(); String s2 = reader.next(); assertTrue(first&lt;=second); assertFalse(first+second &gt;100); assertNotEquals(s,s2); assertNotNull(s2); } }
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26092843
tagged with: java
upvote count: 15
has comment: http://stackoverflow.com/comment/94932044
tagged with: intellij-idea
type: UnansweredQuestion
score: 13
has answer: http://stackoverflow.com/a/26093529
type: Question
linked to: http://stackoverflow.com/q/38482844

http://stackoverflow.com/comment/40863433
comment on: http://stackoverflow.com/q/26079454
has text: yea but sincein my constructor i'll be doing tab = new Couple[size]; so in my code 2 i'll create a new array....?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26151966
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/70062223
has title: Android audio output to wired headphones and bluetooth at the same time?
tagged with: audio
answer count: 0
tagged with: java
type: Question
upvote count: 4
downvote count: 0
score: 4
tagged with: bluetooth
has body: Before I even attempt to write this android app, I need to know if its possible to do the following with the standard Android SDK library or any known 3rd party library. Output audio from multiple simultaneuosly playing files to both the wired headphone jack AND bluetooth A2DP at the same time. Each file/output combination will have its own volume control in the app as well. So if the volume on file 1 is turned down on the headphones but not the bluetooth volume, it still can be heard on a bluetooth speaker but not in the headphones. Same would apply on file 2,3,4 etc

http://stackoverflow.com/comment/41043879
type: Comment
has text: The problem is that my computer doesn't seem to run the virtual devices at all through Eclipse, no matter which devices and settings on VDs. With Genymotion, in few minutes, but with Eclipse, I managed to wait two freaking hours and just the glimmering Android screen. I don't know is it because of AMD processor or not. But yeah, I better try that device method, luckily I have few of those (too accustomed for running everything on computer :B ).
type: AnswerComment
comment on: http://stackoverflow.com/a/26154418
score: 0

http://stackoverflow.com/a/26076249
has body: this in java It is used to refer to the data members of the object in the envoked method or constructor in case there is a name conflict between fields and local variables public class Test { String s; int i; public Test(String s, int i){ this.s = s; this.i = i; } } It is used to invoke one constructor from another constructor of the same class or you can say constructor chaining. public class ConstructorChainingEg{ String s; int i; public ConstructorChainingEg(String s, int i){ this.s = s; this.i = i; System.out.println(s+" "+i); } public ConstructorChainingEg(){ this("abc",3); // from here call goes to parameterized constructor } public static void main(String[] args) { ConstructorChainingEg m = new ConstructorChainingEg(); // call goes to default constructor } } It also facilitates method chaining class Swapper{ int a,b; public Swapper(int a,int b){ this.a=a; this.b=b; } public Swapper swap() { int c=this.a; this.a=this.b; this.b=c; return this; } public static void main(String aa[]){ new Swapper(4,5).swap(); //method chaining } }
has comment: http://stackoverflow.com/comment/40862149
has comment: http://stackoverflow.com/comment/40857618
downvote count: 0
answers question: http://stackoverflow.com/q/26076154
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41341222
score: 0
type: Comment
has text: thanks Riyad, if i use a Jpanel , it also cause OOME error , but after it helps for 150 + imges..
comment on: http://stackoverflow.com/a/26048795
type: AnswerComment

http://stackoverflow.com/comment/40995258
has text: Good answer, esp. the use of unmodifiableSet.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26151663
type: Comment

http://stackoverflow.com/comment/40873269
has text: @JoachimRohde Thanks for the tip up. Netbeans had generated the URL but its actually not working. I change the URL to http://download.eclipse.org/rt/eclipselink/maven.repo and now it seems to work. All the Dependancies have been found.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26084437

http://stackoverflow.com/comment/58565566
has text: match any character except dot.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26210479
score: 0

http://stackoverflow.com/q/26133579
type: Question
score: -2
tagged with: java
downvote count: 2
answer count: 1
has title: Java no abstract and does not override error
linked to: http://stackoverflow.com/q/18813580
has comment: http://stackoverflow.com/comment/40961733
favorite count: 0
has body: I keep getting an not abstract and does not override error. I can't find the mistake either. Where did I go wrong? I checked if the curly braces were on the right place and they seem to be. This is the exact error message "addNumbers is not abstract and does not override abstract method actionPerformed(ActionEvent) in ActionListener Missing javadoc. " import javax.swing.*; import java.awt.*; import java.awt.event.*; public class addNumbers extends JFrame implements ActionListener { FlowLayout flow = new FlowLayout(); JLabel num1 = new JLabel("First Number: "); JTextField number1 = new JTextField(10); JLabel num2 = new JLabel("Second Number: "); JTextField number2 = new JTextField(10); JButton sumbutton = new JButton("Sum Numbers"); JButton exitbutton = new JButton("Exit"); JButton reset = new JButton("Reset"); JLabel result = new JLabel("The result is: "); JLabel add = new JLabel(""); public addNumbers(){ Container con = getContentPane(); con.setLayout(flow); con.add(num1); con.add(number1); con.add(num2); con.add(number2); con.add(sumbutton); con.add(exitbutton); con.add(reset); con.add(result); sumbutton.addActionListener(this); exitbutton.addActionListener(this); reset.addActionListener(this); }//end addNumbers containers public static void main(String[] args){ addNumbers nframe = new addNumbers(); nframe.setSize(300,300); nframe.setVisible(true); nframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); nframe.setTitle("Calculations"); }//end main public void getAction(ActionEvent e){ Object source = e.getSource(); if(source == sumbutton){ String num1 = number1.getText(); String num2 = number2.getText(); double n1 = Double.parseDouble(num1); double n2 = Double.parseDouble(num2); double total = n1+n2; String result = "" + total; //convert back to spring to output add.setText(result);; } else if(source == reset){ number1.setText(""); number2.setText(""); add.setText(""); } else{ System.exit(0); } }//end of getAction }//end addNumbers
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26133596
has comment: http://stackoverflow.com/comment/40961737

http://stackoverflow.com/q/26187776
has title: Dividing double by 0 returns infinty
answer count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/26187829
possible better answer: http://stackoverflow.com/a/26187811
has body: The code basically gives me infinty and the sting undefined. I only need undefined. I understand why its giving infinity but dont understand how to get rid of it. I cant use an exception as the error should only print undefined and nothing else. double divide; double a; double b = 0; if(args.length &gt; 3){ System.out.println("Argument count mismatch"); } else if(args.length == 1){ System.out.println("Argument count mismatch"); } else{ a = Integer.parseInt(args[1]); b = Integer.parseInt(args[2]); divide = a / b; System.out.println(divide); if (b == 0) { System.out.println("Undefined"); } }
tagged with: java
has comment: http://stackoverflow.com/comment/41062729
has answer: http://stackoverflow.com/a/26187811
tagged with: eclipse
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41062714
favorite count: 0
type: Question
score: -2
has answer: http://stackoverflow.com/a/26187829
has comment: http://stackoverflow.com/comment/41062731

http://stackoverflow.com/q/26143031
type: Question
tagged with: datasource
score: 0
has title: Issue relating SmartGwt DataSources by using the includeFrom attribute
answer count: 1
accepted answer: http://stackoverflow.com/a/26145177
tagged with: smartgwt
has answer: http://stackoverflow.com/a/26145177
has body: I'm trying to relate 2 smartgwt datasources by using the attributes "foreignKey" and "includeFrom". &lt;field name="payment_id" foreignKey="payment.id" /&gt; &lt;field name="payment_type" includeFrom="payment.type" /&gt; Often a bill is not payed so it has no payment_id value. My problem is that when I use that DS to fetch bills only the payed bills are fetched because by default smartgwt will do a Inner Join. In order to solve that problem I researched a bit and I found that It's possible to change the join used by setting the joinType attribute. &lt;field name="payment_id" foreignKey="payment.id" joinType="outer" /&gt; &lt;field name="payment_type" includeFrom="payment.type" /&gt; But, I get the same results... What I'm doing wrong? Someone has an idea?
type: AnsweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/40960103
comment on: http://stackoverflow.com/q/26132541
score: 0
type: Comment
type: QuestionComment
has text: Depends on your platform. If it supports the [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code), then there's a chance.

http://stackoverflow.com/q/26133008
linked to: http://stackoverflow.com/q/3848250
type: Question
has answer: http://stackoverflow.com/a/26133046
has answer: http://stackoverflow.com/a/26133036
score: 3
has answer: http://stackoverflow.com/a/26133090
has answer: http://stackoverflow.com/a/26133041
has answer: http://stackoverflow.com/a/26133061
has body: I was doing java assignment and I ran into this code. int x=3, y=5; System.out.println(x + y + " = " + y + x); and the output is "8=53". Why does the first x+y gets evaluated and the last y and x expression gets printed? Left me wondering. Thanx in advance guys.
has comment: http://stackoverflow.com/comment/41002917
downvote count: 0
has comment: http://stackoverflow.com/comment/41003076
tagged with: println
favorite count: 0
answer count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2955640
upvote count: 3
tagged with: java
has title: Java mysterious output from additions: some evaluated, some printed

http://stackoverflow.com/comment/40996096
has text: Thanks for you answer, I just looked into Callable and I understand how it works. Going to write my first program with it, thanks.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26146206

http://stackoverflow.com/a/26246205
accepted answer of: http://stackoverflow.com/q/26106807
score: 0
type: AcceptedAnswer
has body: After observation, I notice that after cmd took "exit", it will not return to the prompt and I will have to press enter to get things going. I decided to put a new line after the exit and it worked. I swapped out the exit with the following lines of code. @echo off set NLM=^ set NL=^^^%NLM%%NLM%^%NLM%%NLM% exit %NL% It's from this post, Explain how dos-batch newline variable hack works
answers question: http://stackoverflow.com/q/26106807
type: Answer

http://stackoverflow.com/q/26189173
has answer: http://stackoverflow.com/a/30712440
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26190011
possible better answer: http://stackoverflow.com/a/30712440
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I think the first question I should ask is - Is it possible to validate json payload with XSD? The example given by CXF are all using XSD, anyway. I follow the instruction from CXF - http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-Schemavalidation (1) At first it complains "cvc-elt.1: Cannot find the declaration of element 'OSDCreateAppointmentRequest'" (2) To fix that, the suggestion is to add a name space to json object, since there is no "namespace" concept for Json but XSD has that (3) So I add name space to the Json object as follows &lt;property name="inTransformElements"&gt; &lt;map&gt; &lt;entry key="OSDCreateAppointmentRequest" value="{http://www.w3.org/2001/XMLSchema}OSDCreateAppointmentRequest"/&gt; &lt;/map&gt; &lt;/property&gt; Now it complains cvc-elt.1: Cannot find the declaration of element 'ps1:OSDCreateAppointmentRequest' Well "ps1" looks like a namespace prefix, no idea where it comes from. Any suggestions? Your experience on this will be highly appreciated!
has title: CXF - Json schema validation
has answer: http://stackoverflow.com/a/26190011
tagged with: web-services
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json

replaceall
tags question: http://stackoverflow.com/q/26103731
type: Tag
tags question: http://stackoverflow.com/q/26077641
tags question: http://stackoverflow.com/q/26118190
tag name: replaceall

http://stackoverflow.com/comment/40884953
score: 0
type: Comment
type: QuestionComment
has text: there is a lot of empty spaces like 100 or something like that. it messes up my entire program.
comment on: http://stackoverflow.com/q/26091150

http://stackoverflow.com/comment/41031741
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26171106
has text: There are well known APIs for doing this in Java (ser concurrent package)

http://stackoverflow.com/a/26061015
score: 0
answers question: http://stackoverflow.com/q/26060812
has body: Check "Composition over inheritance" paradigm. In you case you can create third class SpecialLayout that will have method doSpecialLayout(). Then include instances of this class into your LayoutGroup1 and Layout2 call doSpecialLayout() where you need it. Additionally, if you want method doSpecialLayout() to be public (part of public API), you have to create separate interface that will have this method. LayoutGroup1 and Layout2 can then implement that interface and delegate calls of doSpecialLayout() to internal instance of SpecialLayout.
type: Answer

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/26192355

http://stackoverflow.com/a/26101726
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26099019
accepted answer of: http://stackoverflow.com/q/26099019
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: There is no guarantee which will get the message first and if your application is dependent on ordering of this sort then I'd say it is fundamentally flawed.

ejbca
type: Tag
tags question: http://stackoverflow.com/q/26094247
tag name: ejbca
tags question: http://stackoverflow.com/q/26116689

http://stackoverflow.com/a/26139255
has body: Is there a requirement to work in minutes / hours etc? If not this can be abstracted to a much simpler format. Instead something like this while(orbitCount &lt; 8) { calcPictures(50) calcPictures(75) calcPictures(25) orbitCount++ } This should significantly decrease the number of nested loops you have. The logic will need to be implement for the calcPictures method, where you can pass in the percentage and calculate the number of successful pictures.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26139076

http://stackoverflow.com/comment/41036367
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26173751
type: Comment
has text: @ScaryWombat this is the rule. if I use others code, I always put source.

http://stackoverflow.com/a/26144205
has body: if(! error.equals(null)) Should be if(error!=null) If you also want to check that the error String is not empty than the condition should be: if(error!=null &amp;&amp; !error.isEmpty()) Note: also make sure that wb itself is not null if( wb!=null ) {// your logic } else {// Logic when it's null }
has comment: http://stackoverflow.com/comment/40981533
has comment: http://stackoverflow.com/comment/40981361
has comment: http://stackoverflow.com/comment/40984069
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40981470
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40984549
accepted answer of: http://stackoverflow.com/q/26144141
upvote count: 1
answers question: http://stackoverflow.com/q/26144141
has comment: http://stackoverflow.com/comment/40981181

http://stackoverflow.com/q/26178680
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41045324
tagged with: java
has answer: http://stackoverflow.com/a/26184426
has title: libGDX ViewPort Android devices
accepted answer: http://stackoverflow.com/a/26184426
tagged with: eclipse
type: Question
tagged with: libgdx
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41048373
has body: How can i use the fitviewport or viewport? i need to fit the screen to many android devices as posible. I dont have idea how to use that, thank you for your help, if you can paste some code for me i aprecciate that... public void show(){ batch = main.getBatch(); texture = new Texture(Gdx.files.internal("spacebg.png")); Texture texturaBola = new Texture(Gdx.files.internal("bola.png")); ball = new Ball(Gdx.graphics.getWidth() / 2 - texturaBola.getWidth() / 2, Gdx.graphics.getHeight() / 2 - texturaBola.getHeight() / 2); Texture texturaPala= new Texture(Gdx.files.internal("pala.png")); Lpaddle = new LeftPaddle(80, Gdx.graphics.getHeight()/2 -texturaPala.getHeight() /2); Rpaddle = new RightPaddle(Gdx.graphics.getWidth() -100, Gdx.graphics.getHeight()/2 - texturaPala.getHeight() /2, ball); font = new BitmapFont(); font.setColor(Color.WHITE); font.setScale(1f); puntuacion = 0; } public void render(float delta){ Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); updatePuntuacion(); Lpaddle.update(); Rpaddle.update(); ball.update(Lpaddle, Rpaddle); batch.begin(); batch.draw(texture, 0, 0,texture.getWidth(), texture.getHeight()); ball.draw(batch); Lpaddle.draw(batch); Rpaddle.draw(batch); font.draw(batch, "Points: " + Integer.toString(puntuacion), Gdx.graphics.getWidth() / 4 ,Gdx.graphics.getHeight() - 5); font.draw(batch, "High score: " + Integer.toString(puntuacionMaxima),Gdx.graphics.getWidth() - Gdx.graphics.getWidth() / 4 ,Gdx.graphics.getHeight() - 5); batch.end(); } private void updatePuntuacion(){ if(ball.getBordes().overlaps(Lpaddle.getBordes())) { puntuacion = puntuacion + 1; if(puntuacion &gt; puntuacionMaxima) puntuacionMaxima = puntuacion; } if(ball.getBordes().x &lt;= 0) sonidoex.play(); if(ball.getBordes().x &lt;= 0) puntuacion =0; if(ball.getBordes().x &lt;=0) Gdx.input.vibrate(1000); if(ball.getBordes().x &lt;=0) Screens.juego.setScreen(Screens.MAINSCREEN); ball.comprobarPosicionBola(); } public void hide(){ font.dispose(); texture.dis…

http://stackoverflow.com/a/26137430
has comment: http://stackoverflow.com/comment/40968940
has body: Have you tried using module descriptor? https://docs.jboss.org/author/display/MODULES/Module+descriptors
type: Answer
answers question: http://stackoverflow.com/q/26137219
score: 0

http://stackoverflow.com/comment/40972066
has text: Here you are creating circle shaped body of radius 10 ... reduce it to .2f and render your sprite accordingly. Pixel to meter stuff is the line you should search... Please also see this. might help you -> http://stackoverflow.com/questions/14208797/box2d-libgdx-a-bit-confused-about-the-pixels-to-meters-stuff
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26138628
type: Comment

http://stackoverflow.com/q/26092888
answer count: 1
has title: com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable in thread stack trace and hibernate connection does not get established
tagged with: c3p0
score: 0
has answer: http://stackoverflow.com/a/26093851
type: UnansweredQuestion
has body: I encountered the issue when I upgraded my hibernate lib from hibernate 3 to hibernate core 4.3.6 and added c3p0-0.9.2.1.jar along with it. My hibernate connection doesn't get established. In the thread stack trace getting following: "pool-9-thread-11" prio=6 tid=0x00000000147dd000 nid=0xd20 in Object.wait() [0x0000000018dee000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x0000000701ac0608&gt; (a com.mchange.v2.resourcepool.BasicResourcePool) at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1414) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606) - locked &lt;0x0000000701ac0608&gt; (a com.mchange.v2.resourcepool.BasicResourcePool) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:755) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:682) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) at org.hibernate.c3p0.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:89) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435) at java.util.concurrent.Executors$RunnableAdapter…
tagged with: multithreading
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/26095601
has answer: http://stackoverflow.com/a/26095930
tagged with: rename
score: 0
answer count: 1
has title: How to rename/refactor a whole libgdx/java project in eclipse
has body: Ive made a game with the libgdx framework in eclipse and I want to copy this project in the same workspace so I can make changes to this whilst viewing the original code. I have tried refactoring before but it all messed up somehow and I ended up having to start a new project and copying over every class ( took a while ) Is there a way to rename the projects in a better way or how do you rename them properly as I obviously did something wrong.
type: UnansweredQuestion
tagged with: refactoring
tagged with: java
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/40965027
has text: i'll try it now but am i delete the commands in /etc/profile or not ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26135466
type: Comment

http://stackoverflow.com/a/26186122
upvote count: 7
score: 5
accepted answer of: http://stackoverflow.com/q/26184336
has comment: http://stackoverflow.com/comment/67583133
has body: EOFException is thrown when the socket connection is no longer valid. It usually happens because the server has closed the connection. /** * Read till byteBuffer limit reached or received would-block. */ public boolean read(ByteBuffer byteBuffer) throws IOException { while (byteBuffer.hasRemaining()) { int len = socketChannel.read(byteBuffer); if (len == 0) { // Got would-block. return false; } if (len &lt; 0) { // Server has shutdown socket. throw new EOFException(); } } return true; }
has comment: http://stackoverflow.com/comment/103638213
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26184336
downvote count: 2
type: Answer

http://stackoverflow.com/comment/40962267
comment on: http://stackoverflow.com/a/26133544
type: Comment
has text: @KickButtowski - you're gonna do the same thing for b, and then do your calculations based on defined hrs and minutes (or only minutes).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40866243
comment on: http://stackoverflow.com/q/26080951
type: Comment
score: 0
type: QuestionComment
has text: http://eazyprogramming.blogspot.gr/2013/03/restrict-edittext-input-content-using.html

http://stackoverflow.com/comment/40942140
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26084797
type: QuestionComment
has text: I had this all features, and just simple called repository method from scheduled method (with enabled "nativeQuery" option, but it doesn't matter). And I had same result (problems with transaction). I searched solution and found it through manual transaction management, especially for scheduled operations. Scope-based transactions (which I actually use in the application a lot) didn't work into scheduled operations.

http://stackoverflow.com/comment/40954362
has text: looks like the kind of thing you won't want your automatic installer to deal with. Do you really need to support all linuxes distros?
score: 1
comment on: http://stackoverflow.com/q/26129264
type: Comment
type: QuestionComment

gradle
tags question: http://stackoverflow.com/q/26151123
tags question: http://stackoverflow.com/q/26077783
tags question: http://stackoverflow.com/q/26088608
tags question: http://stackoverflow.com/q/26129100
tags question: http://stackoverflow.com/q/26055342
tags question: http://stackoverflow.com/q/26175492
tags question: http://stackoverflow.com/q/26057248
tags question: http://stackoverflow.com/q/26147205
tags question: http://stackoverflow.com/q/26109235
type: Tag
tags question: http://stackoverflow.com/q/26147042
tags question: http://stackoverflow.com/q/26050097
tags question: http://stackoverflow.com/q/26086358
tags question: http://stackoverflow.com/q/26177232
tags question: http://stackoverflow.com/q/26175812
tags question: http://stackoverflow.com/q/26113769
tag name: gradle
tags question: http://stackoverflow.com/q/26105854
tags question: http://stackoverflow.com/q/26161892
tags question: http://stackoverflow.com/q/26101050
tags question: http://stackoverflow.com/q/26069956
tags question: http://stackoverflow.com/q/26168319
tags question: http://stackoverflow.com/q/26057393
tags question: http://stackoverflow.com/q/26088130
tags question: http://stackoverflow.com/q/26062057
tags question: http://stackoverflow.com/q/26185964
tags question: http://stackoverflow.com/q/26130148
tags question: http://stackoverflow.com/q/26175543
tags question: http://stackoverflow.com/q/26132065

http://stackoverflow.com/comment/40925623
has text: dont set min and max dates in on date set.. you have to write this code in onCreate Dialog itself..
score: 0
comment on: http://stackoverflow.com/q/26113167
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/64101019
comment on: http://stackoverflow.com/q/26192256
score: 0
type: Comment
type: QuestionComment
has text: @JBNizet, why not add an answer?

http://stackoverflow.com/q/26058301
type: UnansweredQuestion
type: Question
tagged with: recursion
tagged with: tree-traversal
tagged with: inorder
tagged with: java
has title: Java Tree traversal
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26059221
has body: I am working on an API in which, I generate a query based on conditions tree received in request. Following is the tree format: It should get translated in the SQL query like this: WHERE (a&gt;b OR c&lt;d) AND (e&gt;f OR g&lt;h) Or, like this WHERE ((a&gt;b) OR (c&lt;d)) AND ((e&gt;f) OR (g&lt;h)) Using pre-order traversal, I am able to generate the query. However, I am not able to append the brackets. Following is my inOrder traversal code: public void inorder(Filter n, StringBuilder builder) { if (n != null) { inorder(n.getLeft(), builder); print(n, builder); inorder(n.getRight(), builder); } } private void print(Filter node, StringBuilder builder) { if (null == node.getField() || null == node.getValue()) { builder.append(node.getLogicOperator()); } else { builder.append((node.getField() + " " + node.getComparisonOperator() + " " + node .getValue())); } builder.append("\n"); } Can anyone please guide me where to insert the brackets? Thanks in advance. ****Update**** Now, I want to generate mongo query from the same structure. I am able to generate the string but unable to append the brackets: I want something like this: $and : [ { $or : [ { a: b}, { c: d } ] }, { $or : [ { e: f}, { g: { $lt : h} } ] } ] Can anyone please help?

http://stackoverflow.com/comment/40814462
has text: Stop catching and hiding exceptions. At least print their stack trace, to know what and where the problem is.
type: QuestionComment
comment on: http://stackoverflow.com/q/26052929
type: Comment
score: 3

http://stackoverflow.com/q/26145662
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26149894
has body: I'm trying to play with websockets, so I created WS server like that: @ServerEndpoint(value = "/chat") public class WsChatServlet{ private static final Logger LOGGER = Logger.getLogger(WsChatServlet.class.getName()); @OnOpen public void onOpen(Session session) { LOGGER.log(Level.INFO, "New connection with client: {0}", session.getId()); } @OnMessage public String onMessage(String message, Session session) { LOGGER.log(Level.INFO, "New message from Client [{0}]: {1}", new Object[] {session.getId(), message}); return "Server received [" + message + "]"; } @OnClose public void onClose(Session session) { LOGGER.log(Level.INFO, "Close connection for client: {0}", session.getId()); } @OnError public void onError(Throwable exception, Session session) { LOGGER.log(Level.INFO, "Error for client: {0}", session.getId()); } } and deployed it in Tomcat 7 running on Java 7. Then I created that client: @ClientEndpoint public class Main { private static final String uri = "ws://myserver.net/chat"; public static void main(String[] args) throws DeploymentException, IOException, URISyntaxException, InterruptedException { WebSocketContainer wsContainer = ContainerProvider.getWebSocketContainer(); Session session = wsContainer.connectToServer(Main.class, new URI(uri)); session.getBasicRemote().sendText("Here is a message!"); Thread.sleep(1000); session.close(); } @OnMessage public void processMessage(String message){ System.out.println(message); } } This client runs as a comand-line app. When I run it, I get exception: Exception in thread "main" javax.websocket.DeploymentException: The HTTP response from the server [HTTP/1.1 302 Found] did not permit the HTTP upgrade to WebSocket So it looks like server doesn't responds propertly to my client. I noticed that if I access ws://myserver.net/chat, than it responds with 302, but for ws://myserver.net/chat/ (notice /) it responds with 200 OK. More interesting is this Tomcat logs: [01/Oct/2014:15:52:35 +0000] "GET /chat/ HTTP/1.0" 200 57 [01/O…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26162969
type: Question
answer count: 2
tagged with: websocket
downvote count: 0
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26162969
has title: Websockets in Jelastic: DeploymentException: The HTTP response from the server did not permit the HTTP upgrade to WebSocket
tagged with: jelastic
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/26149894

http://stackoverflow.com/a/26169910
type: Answer
score: 1
has body: There is one more component of a color: alpha channel. It is stored in 24-31 bits of a number. If it is set to 0, the image is transparent. So you need to set 24-31 bits of newColor to 1 to make it opaque.
answers question: http://stackoverflow.com/q/26169771
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40921755
score: 0
type: Comment
type: AnswerComment
has text: i tried this but when i prints to the screen it just keeps display numbers. I want the new number to erase the old number. I don't want the whole count displayed while the download is going. Just one number, erase that number, then next number.
comment on: http://stackoverflow.com/a/26111375

http://stackoverflow.com/comment/41073679
comment on: http://stackoverflow.com/q/26193924
type: Comment
score: 1
has text: The letter mass minus 100 divided by 50?
type: QuestionComment

http://stackoverflow.com/a/26174561
type: Answer
has body: As pointed out by @JBNizet in comments... I had the table opened in ubuntu terminal as well while trying to do operations on it via hibernate.This was preventing the operation to be done on table.I have close it and its working fine now. To access the table, i am using database.tableName method from other schema to access it now hence avoiding the deadlock!
has comment: http://stackoverflow.com/comment/49549604
score: 0
has comment: http://stackoverflow.com/comment/49549718
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26174241
has comment: http://stackoverflow.com/comment/49549253
has comment: http://stackoverflow.com/comment/49549673
accepted answer of: http://stackoverflow.com/q/26174241

http://stackoverflow.com/q/26128550
has answer: http://stackoverflow.com/a/26128706
accepted answer: http://stackoverflow.com/a/26128639
has comment: http://stackoverflow.com/comment/40952693
score: 0
has comment: http://stackoverflow.com/comment/40952820
has title: method which print distinct triples
type: AnsweredQuestion
has body: Hello I am a Java noob and I have trouble understanding this code. Here is the code: //print distinct triples (i, j, k) such that a[i] + a[j] + a[k] = 0 public static void printAll(int[] a) { int N = a.length; Arrays.sort(a); for (int i = 0; i &lt; N; i++) { for (int j = i+1; j &lt; N; j++) { int k = Arrays.binarySearch(a, -(a[i] + a[j])); if (k &gt; j) StdOut.println(a[i] + " " + a[j] + " " + a[k]); } } } I don't quiet understand this line int k = Arrays.binarySearch(a, -(a[i] + a[j])); Could anyone help me with this? Thank you very much.
type: Question
has answer: http://stackoverflow.com/a/26128639
tagged with: algorithm
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/40952885
possible better answer: http://stackoverflow.com/a/26128706

morphia
tags question: http://stackoverflow.com/q/26123606
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/26185252

http://stackoverflow.com/a/28935139
upvote count: 26
has comment: http://stackoverflow.com/comment/135288279
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26041117
has comment: http://stackoverflow.com/comment/70698860
score: 26
has body: I ran in to the same problem. This is a known problem with glibc >= 2.10 The cure is to set this env variable export MALLOC_ARENA_MAX=4 IBM article about setting MALLOC_ARENA_MAX https://www.ibm.com/developerworks/community/blogs/kevgrig/entry/linux_glibc_2_10_rhel_6_malloc_may_show_excessive_virtual_memory_usage?lang=en Google for MALLOC_ARENA_MAX or search for it on SO to find a lot of references. You might want to tune also other malloc options to optimize for low fragmentation of allocated memory: # tune glibc memory allocation, optimize for low fragmentation # limit the number of arenas export MALLOC_ARENA_MAX=2 # disable dynamic mmap threshold, see M_MMAP_THRESHOLD in "man mallopt" export MALLOC_MMAP_THRESHOLD_=131072 export MALLOC_TRIM_THRESHOLD_=131072 export MALLOC_TOP_PAD_=131072 export MALLOC_MMAP_MAX_=65536
has comment: http://stackoverflow.com/comment/46150408
has comment: http://stackoverflow.com/comment/135288377
has comment: http://stackoverflow.com/comment/102253392

udp
tags question: http://stackoverflow.com/q/26070112
tags question: http://stackoverflow.com/q/26118167
tags question: http://stackoverflow.com/q/26150503
tags question: http://stackoverflow.com/q/26109123
tags question: http://stackoverflow.com/q/26185826
tags question: http://stackoverflow.com/q/26085225
tags question: http://stackoverflow.com/q/26091150
tag name: udp
type: Tag
tags question: http://stackoverflow.com/q/26054200

http://stackoverflow.com/q/26123899
tagged with: connection
possible better answer: http://stackoverflow.com/a/26132152
accepted answer: http://stackoverflow.com/a/26149145
has title: SaveObject Job Fails on RPG Program Call From Java
type: AnsweredQuestion
tagged with: java
has body: I am trying to call an RPG program from Java. I can get the program to run correctly using the DriverManager as follows: Connection conn = DriverManager.getConnection("jdbc:as400://" + "sys" + "", "username", "pass"); Statement stmt = conn.createStatement(); Boolean sqlBool = stmt.execute("call DB2.PROGRAM"); However...this is not the way that I want to do it. I want to use the JNDI to connect to the 400 and run the program call, as that is the way I do it to run SELECT, UPDATES, DELETES, etc... Here is the pseudocode that I have so far, and I am having the RPG fail on the SaveObject. Context context = new InitialContext(); DataSource ds = (DataSource) context.lookup(JNDI_NAME); Connection conn = datasource.getConnection(); Statement stmt = conn.createStatement(); Boolean sqlBool = stmt.execute("call DB2.PROGRAM"); Is this a problem with the JNDI connection or a problem with the RPG? Update: It appears that when the SaveObject job goes to work, it says that the table is locked. I am doing inserts and deletes against this table before running the RPG call...any ideas? What would cause a table to still be locked even if I am closing all connections to the database after processing.
tagged with: rpg
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26149145
tagged with: jndi
tagged with: db2
has answer: http://stackoverflow.com/a/26132152
score: 0

eclipse-rcp
tags question: http://stackoverflow.com/q/26120040
tags question: http://stackoverflow.com/q/26053241
type: Tag
tags question: http://stackoverflow.com/q/26044120
tags question: http://stackoverflow.com/q/26038049
tags question: http://stackoverflow.com/q/26085683
tags question: http://stackoverflow.com/q/26097895
tags question: http://stackoverflow.com/q/26093330
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/26176044

http://stackoverflow.com/a/26114520
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41075263
accepted answer of: http://stackoverflow.com/q/26114227
score: 1
answers question: http://stackoverflow.com/q/26114227
has body: At initialization, all elements in the array are set to a default value of null (Object/String), 0 (int/byte/float/double/short/long) or false (boolean). Provided no values are assigned at initialization, the elements should already hold this value so as long as the user input assigned does not change this it should already be set to 0 depending on primitive/object type.
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/26037506
tagged with: time-complexity
downvote count: 0
linked to: http://stackoverflow.com/q/9656789
favorite count: 0
has answer: http://stackoverflow.com/a/26038508
upvote count: 2
has comment: http://stackoverflow.com/comment/40785916
possible better answer: http://stackoverflow.com/a/26037613
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26038601
has answer: http://stackoverflow.com/a/26037613
has title: java based algorithm to find if there are any 2 numbers in the array whose sum is equal to x
tagged with: java
has body: I recently came across an interesting Java Algorithm statement Given an array int[] arr{} and a number x, find if there are any 2 numbers in the array whose sum is equal to x. Hint: Solve it in 3 ways with the following complexities O(n^2), O(n log n) and O(n) O(n^2) approach is a simple brute force logic. O(n log n) possibly involves merge sorting and using a binary search - though I am able to exactly figure out how to fit in binary search here. I am totally clueless about O(n) algorithm. Simple Brute force logic: for(i = 0; i &lt; arr.length; i++){ for(j=0; j&lt;arr.length; j++){ if(arr[i] + arr[j] == x){ return x; } } } Any pointers?
type: Question
tagged with: algorithm
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26038601
has comment: http://stackoverflow.com/comment/40785843
answer count: 3

http://stackoverflow.com/comment/40872183
has text: Not Working. 10x though.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26084408
score: 0

http://stackoverflow.com/comment/50785919
type: Comment
has text: mCamera.setPreviewCallback(null); i am facing null pointer exception in above line
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26223614

http://stackoverflow.com/a/26100144
has comment: http://stackoverflow.com/comment/40997905
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40997886
has body: About the / character: Tomcat just ignores the extra / characters. Only the part after the context path is routed to your application. It's up to each web server to decide how they treat it, so Google does it differently and that cannot be compared. About hosting on your own domain: This is usually done with a separate server in front, and not Tomcat directly. For example, with nginx: Nginx configuration to pass site directly to tomcat webapp with context About the incorrect URL in the form action: Since you're using plain HTML, is not translated to the real location which is /ProjectCtxt/search - which is the case even if the @RequestMapping refers to /search . Using standard JSTL Core, the "c:url" tag will automatically add the context path. Another option is to use the Spring Form tags which post to the beans and automatically generate the proper paths.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26080364

http://stackoverflow.com/comment/41015689
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26162763
score: 0
has text: To add to Marko's comment, `b` would not even be the correct variable if it was in scope. You don't store your `BufferedReader` in the list, you store `myLine`, the line you read with `b`

http://stackoverflow.com/comment/41053144
score: 0
type: AnswerComment
type: Comment
has text: so I get the position and then change the visibility or add a switch or if-else statement based on what to display.
comment on: http://stackoverflow.com/a/26182612

http://stackoverflow.com/q/26157695
has comment: http://stackoverflow.com/comment/41007115
answer count: 2
tagged with: bash
downvote count: 0
has comment: http://stackoverflow.com/comment/41007050
has comment: http://stackoverflow.com/comment/41006644
has answer: http://stackoverflow.com/a/26164960
has answer: http://stackoverflow.com/a/26163338
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: getopts
type: Question
has body: I have a script with 5 mandatory parameters (5 paths) and 3 options (-d for debug, -l for log4j override, -s for another override). I'm managing it with getopts. The following script is simplified : LOG4J_FILE=$DEFAULT_LOG4J_FILE S_FILE=$DEFAULT_S_FILE ECLIPSE_PROPS= while getopts "l:s:d" flag; do case "$flag" in l) LOG4J_FILE="$OPTARG";; s) S_FILE="$OPTARG";; d) ECLIPSE_PROPS="-Xdebug ...";; :) usage;; ?) usage;; esac done shift $((OPTIND-1)) OPTIND=1 ... echo_and_eval $JAVA $ECLIPSE_PROPS -Dlog4.configuration=$LOG4J_FILE -Ds.file=$S_FILE -cp $CLASSPATH $MAIN_CLASS $ARGS If I just put the 5 parameters, it works. If I add one or two optional with parameters (l or s), it works. If I add the -d option, I have no args in the Java main method. Any clue ? This is driving me crazy.
has title: Losing java main args when using getopts in launch script

http://stackoverflow.com/comment/41074734
comment on: http://stackoverflow.com/a/26189233
score: 0
type: AnswerComment
has text: Restarting a service should not require changing the code at all. That just requires resetting the service code...
type: Comment

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/26180405
tags question: http://stackoverflow.com/q/26166088
tags question: http://stackoverflow.com/q/26121105
tags question: http://stackoverflow.com/q/26164601
type: Tag
tags question: http://stackoverflow.com/q/26053991
tags question: http://stackoverflow.com/q/26189346
tags question: http://stackoverflow.com/q/26071473
tags question: http://stackoverflow.com/q/26049791
tags question: http://stackoverflow.com/q/26058823
tags question: http://stackoverflow.com/q/26159149
tags question: http://stackoverflow.com/q/26054289

http://stackoverflow.com/a/26035601
answers question: http://stackoverflow.com/q/26035456
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You can use an xml configuration file to create a bean of the class Foo. Then @Autowired works the same as annotating the beans directions. Sample xml file: &lt;beans&gt; &lt;bean id="foo" class="Foo"/&gt; &lt;/beans&gt; If you now include this into your file with the autoscan then this bean is used as if it were annotated with @Component.

http://stackoverflow.com/comment/40920172
comment on: http://stackoverflow.com/q/26110694
has text: why not use already available apache for proxy/reverse-proxy?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26124919
upvote count: 1
downvote count: 0
type: UnansweredQuestion
has body: I'm working with Resteasy 2.2.1.GA, I have to call some services. If I call a service with body method and if request message contains a &amp; the service responds with an error. I tried to set x-www-form-urlencoded content type, but the solution doesn't works. If I call the service with another client, for example with Postman (Chrome plugin), the service responds successfully. How I can set x-www-form-urlencoded like postman plugin? Below my code: &gt; ClientRequest request = new ClientRequest(url); &gt; request.accept(MediaType.APPLICATION_JSON_TYPE); &gt; request.accept(MediaType.APPLICATION_FORM_URLENCODED_TYPE); &gt; request.body(MediaType.APPLICATION_FORM_URLENCODED_TYPE ,jsonRequest); &gt; response = request.post(String.class); &gt; String jsonResponse = response.getEntity();
tagged with: rest
has answer: http://stackoverflow.com/a/26126209
score: 1
favorite count: 0
tagged with: resteasy
type: Question
has title: Resteasy to set form url encoded x-www-form-urlencoded
answer count: 1
tagged with: url-encoding
tagged with: java

http://stackoverflow.com/a/26092252
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40887246
type: Answer
has comment: http://stackoverflow.com/comment/40887089
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26092221
answers question: http://stackoverflow.com/q/26092221
has body: You are creating a new object of space and printing its description which is null rewrite your toStringLong() method to In class Space public String toStringLong(){ if (_portal!= null) { // comment this Portal p= new Portal(); _portal.toStringLong(); String Longcombined=_name + ": " + _description+" with a "+_portal.toStringLong(); return Longcombined; } else { String Long=_name + ": " + _description; return Long; } } Class Portal -&gt; public String toStringLong() { String combined=toString() + " to " + _destination.getDescription() ; return combined; } Hope this will solve your problem.

http://stackoverflow.com/q/26168232
has answer: http://stackoverflow.com/a/26195651
tagged with: java
tagged with: bold
has body: Is there any way to carry over the bold text from my array into my third textview? I've already carried it over from the XML to my first and second textviews by performing a button click for each. I'm trying to have my third textview replace the bold words in the sentences with the bold animals. My third textview will be constantly displaying the new combinations every second so that each time a button is clicked to change either the animal OR the sentence, the textview will show the new combo. This is my strings.xml "The big This ate the worm" "The Is is strong" "Every Just can run" "I saw a A " "The Test was sleeping" " Cow " " Sheep " " Dog " " Pig " " Chicken " this is my main.java package com.MyFirstApp.App1; import java.util.Random; import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import android.text.Html; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import android.widget.Button; public class Original extends Activity implements OnClickListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn_sentence = (Button) findViewById(R.id.btn_sentence ); Button btn_animal = (Button) findViewById(R.id.btn_animal ); final Random ran = new Random(); final Resources res = getResources(); final TextView text1 = (TextView) findViewById(R.id.sentencetext); final TextView text2 = (TextView) findViewById(R.id.animaltext); final TextView text3 = (TextView) findViewById(R.id.newsentencetext); btn_sentence .setOnClickListener(new OnClickListener() { public void onClick(View v) { String[] NewText = null; NewText = res.getStringArray(R.array.Sentences); String strRandom = NewText[ran.nextInt(NewText.length)]; text1.setText(Html.fromHtml(strRandom)); } }); btn_animal .setOnClickListener(new OnClickListener() { public void onClick(View v) { String[] NewText2 = null; NewText2 = res.getStringArray(R.a…
type: Question
tagged with: replace
score: 0
answer count: 1
has title: Replace bold text from textview?
tagged with: string
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26061469
has title: How to make java message dialog bigger?
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26061597
linked to: http://stackoverflow.com/q/14429242
tagged with: jtable
score: 0
linked to: http://stackoverflow.com/q/7229226
tagged with: jscrollpane
answer count: 1
tagged with: messagedialog
accepted answer: http://stackoverflow.com/a/26061597
has body: Im currently using the following code tableModel.setDataVector(data, columnNames); jTable2 = new JTable(tableModel); JOptionPane.showMessageDialog(null, new JScrollPane(jTable2)); and when I execute it, the resulting size looks like below How can I make message dialog bigger, so that we can see the column headings? I want to remove those '...' Thanks!
linked to: http://stackoverflow.com/q/1783793

http://stackoverflow.com/comment/41040306
comment on: http://stackoverflow.com/q/26175547
has text: Why does it have to be a HashSet? Use ordinary ArrayList, create a ArrayAdapter and bind it to a ListView
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40848847
has text: You pretty much said it yourself: you'd use `Object` for you two-dimensional array, and you'd have to put a `String` and an `Integer` inside of the array at specific spots.
type: AnswerComment
comment on: http://stackoverflow.com/a/26071116
score: 0
type: Comment

http://stackoverflow.com/comment/40894559
has text: Hi Joris, How can Spring be used, can you please help? I am new to Spring and my application uses Spring framework.
type: Comment
comment on: http://stackoverflow.com/a/26096236
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40951767
comment on: http://stackoverflow.com/a/26127697
type: Comment
has text: I'd like the program to check if the three indexes the user entered are number, if they are, then the isSet method runs to check if the cards(at indexes selected) are true or false. Based on that, the program will prompt the user for three numbers again. But I'm having difficulty understanding the logic behind doing this.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26060289
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26059923
downvote count: 0
type: Answer
upvote count: 13
score: 13
accepted answer of: http://stackoverflow.com/q/26059923
has body: ORM frameworks are not good for upgrades because they don't have contextual information about the differences in the schema. So in case you rename column bar to baz, all Hibernate will see is: ALTER TABLE foo DROP COLUMN bar; ALTER TABLE foo ADD COLUMN baz VARCHAR(255) NOT NULL; But in reality you might want to do this: ALTER TABLE foo ADD COLUMN baz VARCHAR(255); UPDATE foo SET baz = bar; ALTER TABLE foo ALTER COLUMN baz SET NOT NULL; ALTER TABLE foo DROP COLUMN bar; Unless you start explicitly describing your schema changes, no framework will generate correct DDL updates. And I am not aware of any Hibernate feature for this, hence you need Flyway or Liquibase.

http://stackoverflow.com/q/26139745
tagged with: mysql-connector
has answer: http://stackoverflow.com/a/42477291
type: Question
has answer: http://stackoverflow.com/a/26139890
has title: org.hibernate.exception.SQLGrammarException: hibernate will not join column
linked to: http://stackoverflow.com/q/438146
answer count: 3
tagged with: jpa
downvote count: 0
tagged with: jboss7.x
favorite count: 0
has answer: http://stackoverflow.com/a/26140074
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has body: I have a problem with hibernate... I have tried all things to solve this past two days and I have no more ideas... I have a Mysql 5.0 database and made classes from entities. Two of them: @Entity @Table(name="products") @NamedQuery(name="Product.findAll", query="SELECT p FROM Product p") public class Product implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long idProduct; @OneToOne() // @JoinTable(name="Tblmodeli") // @JoinColumn(name="idModel") These two lines are important @NotFound(action = NotFoundAction.EXCEPTION) private Model idmodel; public Long getidProduct() { return this.idProduct; } public void setidProduct(Long idProduct) { this.idProduct= idProduct; } public Model getIdmodel() { return this.idmodel; } public void setIdmodel(Model idmodel) { this.idmodel = idmodel; } } The second table: @Entity @Table(name="model") @NamedQuery(name="model.findAll", query="SELECT t FROM model t") public class Model implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name="idModel") private Long idModel; private String name; public Long getIdModel() { return this.idModel; } public void setIdModel(Long idModel) { this.idModel = idModel; } public String getName() { return this.name; } public void setName(String name) { this.name= name; } } persistance.xml <?xml version="1.0"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="SomeName" transaction-type="RESOURCE_LOCAL"> org.hibernate.ejb.HibernatePersistence java:/mydb/ model.Products model.Model <property name="hibernate.format_sql" value="true"/> <property name="use_sql_comments" value="true"/> <property name="hibernate.show_sql" value="true"/> <property name="javax.persistence.jdbc.driver" value="com…
upvote count: 1

http://stackoverflow.com/a/60429982
upvote count: 2
answers question: http://stackoverflow.com/q/26105061
score: 2
downvote count: 0
has body: For Kotling here is what I used lately: // src/main/com.blabla/ShellApplication.kt /** * Main entry point for the shell application. */ @SpringBootApplication public class ShellApplication : CommandLineRunner { companion object { @JvmStatic fun main(args: Array&lt;String&gt;) { val application = SpringApplication(ShellApplication::class.java) application.webApplicationType = WebApplicationType.NONE application.run(*args); } } override fun run(vararg args: String?) {} } // src/main/com.blabla/command/CustomCommand.kt @ShellComponent public class CustomCommand { private val logger = KotlinLogging.logger {} @ShellMethod("Import, create and update data from CSV") public fun importCsv(@ShellOption() file: String) { logger.info("Hi") } } And everything boot normally ending up with a shell with my custom command available.
type: Answer

http://stackoverflow.com/comment/41027254
comment on: http://stackoverflow.com/q/26168846
score: 2
type: QuestionComment
type: Comment
has text: Either you've quoted out of context or he doesn't know what he's talking about. (I'd put the odds at 50:50.)

http://stackoverflow.com/comment/40935926
has text: possible duplicate of [java.lang.ClassNotFoundException: TopologyMain](http://stackoverflow.com/questions/17724937/java-lang-classnotfoundexception-topologymain)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26118102
score: 0

http://stackoverflow.com/q/26121219
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26121491
score: 1
tagged with: java
tagged with: listview
type: Question
has body: I have the problem that i would like to create an custom design for my list view but I don't know how to do. I use a sql database which is in my list view. haha sorry I dont't know how to say this...because im german..so by the way sorry for my englsih. here is my code: private void populateListViewFromDB() { Cursor cursor = myDb.getAllRows(); startManagingCursor(cursor); String[] fromFieldNames = new String[] {DBAdapter.KEY_NAME, DBAdapter.KEY_STUDENTNUM, DBAdapter.KEY_FAVCOLOUR, DBAdapter.KEY_STUDENTNUM}; int[] toViewIDs = new int[] {R.id.item_name, R.id.item_icon, R.id.item_favcolour, R.id.item_studentnum}; SimpleCursorAdapter myCursorAdapter = new SimpleCursorAdapter( this, R.layout.item_layout, cursor, fromFieldNames, toViewIDs ); // Set the adapter for the list view ListView myList = (ListView) findViewById(R.id.listViewFromDB); myList.setAdapter(myCursorAdapter); } Thank you for helping!:)
has comment: http://stackoverflow.com/comment/40938870
has comment: http://stackoverflow.com/comment/40938987
has comment: http://stackoverflow.com/comment/40938649
has comment: http://stackoverflow.com/comment/40938607
has comment: http://stackoverflow.com/comment/40938695
upvote count: 1
tagged with: sql
tagged with: android
has comment: http://stackoverflow.com/comment/40938654
answer count: 1
has comment: http://stackoverflow.com/comment/40938728
has title: How can I change the font of my ListView items?
favorite count: 0
tagged with: fonts
accepted answer: http://stackoverflow.com/a/26121491
has comment: http://stackoverflow.com/comment/40938820

http://stackoverflow.com/q/26038056
has body: This is my json: { "date": "14", "day": "1", "hours": "16", "minutes": "16", "month": "6", "seconds": "30", "time": "1405325790674", "timeInMicros": "1405325790674917", "timezoneOffset": "-480", "year": "114" } This is my code Gson gson = new GsonBuilder().create(); gson.fromJson(json, Date.class); The error is com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 at com.google.gson.Gson.fromJson(Gson.java:815) at com.google.gson.Gson.fromJson(Gson.java:768) at com.google.gson.Gson.fromJson(Gson.java:717) at com.google.gson.Gson.fromJson(Gson.java:689) at com.baidu.code.commit.TestConvertJson.test(TestConvertJson.java:26) 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:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.ru…
favorite count: 0
accepted answer: http://stackoverflow.com/a/26038259
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
tagged with: date
downvote count: 1
type: Question
has title: How to use gson to deserialize following json to date
upvote count: 0
has answer: http://stackoverflow.com/a/26038259
score: -1
has comment: http://stackoverflow.com/comment/40787102
answer count: 1

http://stackoverflow.com/comment/40957115
type: QuestionComment
comment on: http://stackoverflow.com/q/26130752
score: 1
has text: Why not just `String test = new String( str, "UTF-8" );`? What are you trying to show here?
type: Comment

http://stackoverflow.com/comment/40844693
type: QuestionComment
has text: Seems open to opinion. Implement with maximum simplicity and consistency. And no one can say ye nae
comment on: http://stackoverflow.com/q/26069175
score: 0
type: Comment

http://stackoverflow.com/a/26063956
upvote count: 3
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26046676
accepted answer of: http://stackoverflow.com/q/26046676
type: Answer
score: 3
has body: I have managed to find a working solution for my situation. 1) Downloaded and added the org-netbeans-modules-java-j2seproject-copylibstask.jar to my Ant/lib directory: C:/apache-ant-1.9.4/lib/ 2) (in command line) Navigated to the folder containing my "build.xml" file, so it would be "abcfolder" C:\eclipse_workspace\myproject\abcfolder\build.xml 3) Ran the following commmand ant -Dlibs.CopyLibs.classpath=C:/apache-ant-1.9.4/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar I got a successful build.

http://stackoverflow.com/comment/40930716
type: Comment
comment on: http://stackoverflow.com/a/26077970
score: 0
has text: Not necessarily. Something may change in the env. Can you take a look in usertodolist and post the EL code or even fetch __usertodolist.java and look at line 175
type: AnswerComment

affinetransform
tags question: http://stackoverflow.com/q/26068553
tags question: http://stackoverflow.com/q/26140925
type: Tag
tag name: affinetransform

http://stackoverflow.com/comment/40982289
type: QuestionComment
has text: Then it is probably the dependency that is wrong. that version is odd - it looks like you're using a dependency from JBoss 4.2.2 for JBoss 5.1. JBoss always has a generic jboss-as-client dependency that is for connecting to a JBoss server from a client, try using that. http://mvnrepository.com/artifact/org.jboss.jbossas/jboss-as-client/5.1.0.GA
comment on: http://stackoverflow.com/q/26143840
score: 0
type: Comment

http://stackoverflow.com/comment/40903528
comment on: http://stackoverflow.com/a/26100874
has text: Tx Deinum, did not have the code at hand so wasn't sure of the interface name; edited my answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26065020
possible better answer: http://stackoverflow.com/a/26065111
tagged with: android
has title: how to change json object name (key)?
has answer: http://stackoverflow.com/a/26065111
has comment: http://stackoverflow.com/comment/40838164
has comment: http://stackoverflow.com/comment/40837863
has answer: http://stackoverflow.com/a/26065628
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26065628
upvote count: 4
answer count: 2
downvote count: 0
has body: Just a quick question: If I have a json object which contains "key/value"s like this: "name":"value" and I want to change the name parts to something else, what should I do? I don't want to remove and make it again.
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40838313

http://stackoverflow.com/comment/40847371
score: 0
has text: @MikeM.I couldn't believe it was as simple as that until I started to write an answer and...oh wait... :D
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26070584

http://stackoverflow.com/comment/41088878
comment on: http://stackoverflow.com/a/26201646
type: Comment
score: 1
has text: 7174 is my bug. I have found another change Google made - you used to only be able to use the statically defined colors they have in the factory (HUE_RED). If you supplied a undefined float it would simply use the nearest defined color. Now you can use any float to get dynamic shades. I would bet this is where they introduced the problem.
type: AnswerComment

http://stackoverflow.com/a/26112083
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26112001
has comment: http://stackoverflow.com/comment/40922609
has comment: http://stackoverflow.com/comment/40922560
type: Answer
has body: According to Java documentation String contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values. Simplest way to count number of vowels is to loop through and check each character of a String object. String s = "Whatever you want it to be.".toLowercase(); int vowelCount = 0; for (int i = 0, i &lt; s.length(); ++i) { switch(s.charAt(i)) { case 'a': vowelCount++; break; case 'e': vowelCount++; break; case 'i': vowelCount++; break; case 'o': vowelCount++; break; case 'u': vowelCount++; break; default: // do nothing } }
answers question: http://stackoverflow.com/q/26112001
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/26133706
type: Question
possible better answer: http://stackoverflow.com/a/26133766
has comment: http://stackoverflow.com/comment/40961915
has answer: http://stackoverflow.com/a/26133766
tagged with: java
has answer: http://stackoverflow.com/a/26133754
upvote count: 0
has answer: http://stackoverflow.com/a/26133715
has title: Need help - Java if/else statement with an int and String
favorite count: 0
has body: Here's my code in full. I realise it is not finished, but I am having problems with the ISBN parameters part. When I compile, it says "incompatible types" highlighting 'return "Incorrect ISBN";' class Book{ private String title; private int ISBN; private String authorLastName; private String authorFirstName; private int yearPublished; public Book(){ } public Book(String newTitle, int newISBN, String newAuthorLastName, String newAuthorFirstName, int newYearPublished){ title = newTitle; ISBN = newISBN; authorLastName = newAuthorLastName; authorFirstName = newAuthorFirstName; yearPublished = newYearPublished; } public String setTitle(String newTitle){ if(title.length()&gt; 3){ return title; }else{ return "Title too short."; } } public int setISBN(int newISBN){ if((newISBN&gt;=10000) &amp;&amp;(newISBN&lt;=20000)){ return ISBN; }else{ return "Incorrect ISBN"; } } } If you guys could I would be very grateful!
accepted answer: http://stackoverflow.com/a/26133754
has comment: http://stackoverflow.com/comment/40961902
score: -2
answer count: 4
type: AnsweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26133712

http://stackoverflow.com/comment/40987154
type: QuestionComment
comment on: http://stackoverflow.com/q/26147311
has text: Why? wouldn't that make your uberjar JVM specific? why not discover at runtime or use an alternate embeddable javac (like eclipse-jdt)?
score: 0
type: Comment

http://stackoverflow.com/comment/40943634
has text: How would I have to create one?
type: Comment
comment on: http://stackoverflow.com/q/26122523
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40898849
score: 0
comment on: http://stackoverflow.com/q/26098927
type: Comment
type: QuestionComment
has text: You aren't using daemon threads are you (generally that wouldn't be the case)? You can ensure all the tasks in an `ExecutorService` have finished by calling `shutdown`.

http://stackoverflow.com/a/26105276
answers question: http://stackoverflow.com/q/26068865
score: 0
has body: This functionality has been made available through the DSLContext.ddl() methods, which were added in jOOQ 3.8 with #3160. In order to generate and execute DDL queries (CREATE TABLE, ALTER TABLE ADD CONSTRAINT, etc.), just pass the table name or schema name to the ddl() method as such: Queries queries = DSL.using(configuration).ddl(EMPLOYEES); for (Query query : queries) query.execute();
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/75879525
type: Answer
has comment: http://stackoverflow.com/comment/40944441
has comment: http://stackoverflow.com/comment/40934590
has comment: http://stackoverflow.com/comment/75861873
accepted answer of: http://stackoverflow.com/q/26068865

http://stackoverflow.com/comment/40915415
comment on: http://stackoverflow.com/a/26086347
has text: Thank you for the help but... I've implemented your #2 fix but i still get a fully yellow rectangle. I guess my problem lies in the texture loader / openGL initialization. This code i'm working on is an old application i did some years ago and now i'm trying to update it and add some features
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41046878
type: Comment
comment on: http://stackoverflow.com/a/26179607
has text: I didn't even know this. Shame on me. Thanks to you. How stupid of me. Actually I didn't even know this. This is what happens when you just keep using NetBeans Drag and Drop
score: 1
type: AnswerComment

http://stackoverflow.com/q/26075490
has title: Filter an ArrayList with Dates by start and end time
downvote count: 0
score: 6
favorite count: 0
accepted answer: http://stackoverflow.com/a/39347360
has body: I am implementing a simple ListView where the data source is an ArrayList with that contains Name, Start and End dates. In iOS I would use a simple NSPredicate to filter the array but here in Android and Java I am confused of what I should use. Any suggestions are welcomed.
tagged with: android
upvote count: 6
has answer: http://stackoverflow.com/a/52349413
has comment: http://stackoverflow.com/comment/40861814
possible better answer: http://stackoverflow.com/a/52349413
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39347360
tagged with: java
has comment: http://stackoverflow.com/comment/40855675
type: Question
answer count: 2

http://stackoverflow.com/q/26155616
accepted answer: http://stackoverflow.com/a/26159902
type: Question
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has body: I'm attempting to create a Gridview of icons with the Imageview set to one of two images like in my example below: I'm retrieving two values from the sqlite content provider, one for the number of stamps and the other for the max number of stamps. I use a custom adapter with a view holder pattern so I attempt to set the model onLoadFinished() in the Fragment. The model I've currently tried is an int[] with either value of 0 or 1 in the values to determine if green stamp is used or gray. This isn't working however as nothing is being displayed in the GridView. Here's the code snippet from onLoadFinished() from the Fragment: imageSourceModel = new int[data.getInt(data.getColumnIndex(RewardsEntry.COLUMN_REW_MAX_POINTS))]; int i = data.getInt(data.getColumnIndex(RewardsEntry.COLUMN_REW_POINTS)); for (int j = 0; j &lt; imageSourceModel.length; j++, i--) { if (i &gt; 0) { imageSourceModel[j] = 1; } else { imageSourceModel[j] = 0; } } stampGridAdapter.setModel(imageSourceModel); and the code from the custom Adapter: @Override public View getView(int i, View view, ViewGroup parent) { ViewHolder viewHolder; if (view == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.list_item_discover, parent, false); viewHolder = new ViewHolder(view); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } if (model[i] &gt; 0) { viewHolder.stampView.setImageResource(R.drawable.ic_approved_stamp); } else { viewHolder.stampView.setImageResource(R.drawable.ic_approved_stamp_disabled); } return view; } And simple ViewHolder: private class ViewHolder { public ImageView stampView; public ViewHolder(View view) { stampView = (ImageView) view.findViewById(R.id.grid_stamp_image); } } If I had to guess, I would say that it fails because of the creation order such that getView() is completed before onLoadFinished() can pass the model in. I'm just not sure how to work around this or what …
answer count: 1
has comment: http://stackoverflow.com/comment/41002911
score: 0
has answer: http://stackoverflow.com/a/26159902
has comment: http://stackoverflow.com/comment/41003203
tagged with: android
has title: Procedurally set ImageVIew of GridView based on number
tagged with: gridview

http://stackoverflow.com/a/26045687
answers question: http://stackoverflow.com/q/26045513
has comment: http://stackoverflow.com/comment/124663381
has body: Looks like you spelt your packageName incorrectly. Check your AndroidManifest. com.example.canavstest.Draw2d Should probably be com.example.canvastest.Draw2d Notice the spelling of canvas Edit: Also, you have not implemented the constructor that the LayoutInflater calls. Add this. public Draw2d(Context context, AttributeSet attrs){ super(context, attrs); }
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40801694
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26045513
type: Answer
has comment: http://stackoverflow.com/comment/40801413

http://stackoverflow.com/a/26273488
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26144271
score: 1
has body: Your question is slightly confusing, probably because of the path you have taken. Your original plan creates a RESTlet web application, complete with web.xml to run inside a container, such as GAE, Jetty or Tomcat. What you're proposing creates a component and starts a stand alone server (it starts an internal instance of Jetty). This won't work on Google App Engine. You should continue with the web.xml approach and configure GAE to serve over https. See https://cloud.google.com/appengine/kb/general#https and https://cloud.google.com/appengine/docs/java/config/webxml#Secure_URLs for configuration instructions. Also, another tip: return 403 status when something attempts to access a resource without authorisation.

http://stackoverflow.com/comment/40811903
type: QuestionComment
type: Comment
has text: the second argument is supposed to be a `Class<? extends Activity>`. Typically, the activity you want to be started as a push callback. It could be `getActivity().getClass()`, for example.
comment on: http://stackoverflow.com/q/26051126
score: 0

http://stackoverflow.com/comment/40913532
has text: Since as it is you are not using the action-phase you can move the insert logic to serve-resource method and then return the output in JSON or in whatever way you want. Thanks
comment on: http://stackoverflow.com/a/26060177
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/40899542
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26099144
has text: Yes I can scrape the page 3 times every time with an other getElementsByClass but isn't there a better solution? So I only have to scrape the page once.

http://stackoverflow.com/q/26137133
type: Question
answer count: 2
upvote count: 1
has body: I am a programmer beginner (more or less), and I was wondering what is the best way to load resources(bmps, mp3s, and so on) in Android or java in general . What I mean is that I make a class that will hold other static classes that will hold my resources(so I don't need to pass parameters when i use them, the resources can be loaded with ease and unloaded just as easy). Something like this. public class ResourcesHandler { public static Context mContext; public static GraphicsCollection mGraphics; public static SoundFxPlayer mSoundFx; public static MusicPlayer mMusic; public static void unload() { mContext=null; mGraphics.unload(); mSoundFx.unload(); mMusic.unload(); } } It probably sounds like a stupid question, but I ask mostly because I never saw something like this from someone else. I saw only resources passed back and forth or they're loaded where they need to be used. What do you think? What is the best practice?
favorite count: 0
has comment: http://stackoverflow.com/comment/40968274
tagged with: memory-management
possible better answer: http://stackoverflow.com/a/26137372
tagged with: android
has answer: http://stackoverflow.com/a/26137330
accepted answer: http://stackoverflow.com/a/26137330
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26137372
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40969553
has comment: http://stackoverflow.com/comment/40968037
has title: Android resources management

http://stackoverflow.com/a/26190955
accepted answer of: http://stackoverflow.com/q/26129697
type: Answer
has comment: http://stackoverflow.com/comment/57802274
upvote count: 17
score: 17
has body: Query names are never URL encoded. The documentation for @QueryMap states: Values are URL encoded. And for @EncodedQueryMap: Values are not URL encoded. However, I just submitted a pull request to change this behavior a bit. I am adding support for encoding keys by using @Query(value = "..", encodeName = true) or @QueryMap(encodeNames = true).
answers question: http://stackoverflow.com/q/26129697
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/100732474

http://stackoverflow.com/comment/41137318
score: 0
type: AnswerComment
has text: Method setExceptionListener not permitted, cause suggesting to remove the exception listener. Try by removing the exception listener.
type: Comment
comment on: http://stackoverflow.com/a/26136059

http://stackoverflow.com/q/26120234
favorite count: 0
tagged with: spring
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I have read lot of question and answers regarding above mentioned title. But I am not still clear with it. If any one can explain it it would be really useful for me and others, I wish. My doubt is do we really want to use @Transactional on method level for read-only operation ? If your answer is yes and you are saying that use of propagation=read-only. I have observed that after fetching spring is taking some time for setting read-only flag back to false. and also it is doing commit operation. I think it will cause a performance issue. I can do fetching operation with out using @Transactional in service layer. Instead I will create an open session in DAO it self and perform the action. That time I have observed that, execution is faster. But I am not sure while doing like this am i trading any data integrity. I am using spring+hibernate. It will be very helpful if you give me an answer covering all the aspect .
type: Question
has comment: http://stackoverflow.com/comment/40938401
tagged with: transactions
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/17505204
has comment: http://stackoverflow.com/comment/40944466
linked to: http://stackoverflow.com/q/13539213
has title: Spring transaction management for Read only operations
downvote count: 0
linked to: http://stackoverflow.com/q/2562865

http://stackoverflow.com/comment/40791986
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26040597
has text: I don't see it anywehre... It would be much simpler if you would write something like: Hey guys, the exception is thrown in this line `hereIsSomePartOfYourCode.thatActuallyThrows(Exception);`

jdbc
tags question: http://stackoverflow.com/q/26052064
tags question: http://stackoverflow.com/q/26110185
tags question: http://stackoverflow.com/q/26165370
tags question: http://stackoverflow.com/q/26099863
tags question: http://stackoverflow.com/q/26122103
tags question: http://stackoverflow.com/q/26162964
tags question: http://stackoverflow.com/q/26137958
tags question: http://stackoverflow.com/q/26156171
tags question: http://stackoverflow.com/q/26076404
tags question: http://stackoverflow.com/q/26137693
tags question: http://stackoverflow.com/q/26157397
tags question: http://stackoverflow.com/q/26041418
tags question: http://stackoverflow.com/q/26062625
tags question: http://stackoverflow.com/q/26055493
tags question: http://stackoverflow.com/q/26121149
tags question: http://stackoverflow.com/q/26153110
tags question: http://stackoverflow.com/q/26118602
tags question: http://stackoverflow.com/q/26177977
type: Tag
tags question: http://stackoverflow.com/q/26193739
tags question: http://stackoverflow.com/q/26046234
tags question: http://stackoverflow.com/q/26169190
tags question: http://stackoverflow.com/q/26069312
tags question: http://stackoverflow.com/q/26142526
tags question: http://stackoverflow.com/q/26062900
tags question: http://stackoverflow.com/q/26146905
tags question: http://stackoverflow.com/q/26154920
tags question: http://stackoverflow.com/q/26097977
tags question: http://stackoverflow.com/q/26073280
tags question: http://stackoverflow.com/q/26092714
tags question: http://stackoverflow.com/q/26064489
tags question: http://stackoverflow.com/q/26180950
tags question: http://stackoverflow.com/q/26085972
tags question: http://stackoverflow.com/q/26125118
tags question: http://stackoverflow.com/q/26141289
tags question: http://stackoverflow.com/q/26080786
tags question: http://stackoverflow.com/q/26099434
tags question: http://stackoverflow.com/q/26147101
tags question: http://stackoverflow.com/q/26055220
tags question: http://stackoverflow.com/q/26165270
tags question: http://stackoverflow.com/q/26037870
tags question: http://stackoverflow.com/q/26164514
tags question: http://stackoverflow.com/q/26065214
tags question: http://stackoverflow.com/q/26041705
tags question: http://stackoverflow.com/q/26165126
tags question: http://stackoverflow.com/q/26094885
tags question: http://stackoverflow.com/q/26116588
tags question: http://stackoverflow.com/q/26097173
tags question: http://stackoverflow.com/q/26178724
tags question: http://stackoverflow.com/q/26180770
tag name: jdbc
tags question: http://stackoverflow.com/q/26155609
tags question: http://stackoverflow.com/q/26097341
tags question: http://stackoverflow.com/q/26133818
tags question: http://stackoverflow.com/q/26161626
tags question: http://stackoverflow.com/q/26174258
tags question: http://stackoverflow.com/q/26048321
tags question: http://stackoverflow.com/q/26063765
tags question: http://stackoverflow.com/q/26148152
tags question: http://stackoverflow.com/q/26127305

http://stackoverflow.com/comment/41118297
has text: I appreciate your trying to find a solution with me. Ultimately, though, the best I could get was to redirect the output to a file, so I'm not awarding you the bounty; I gave you a +1 so you should get the auto-award of half the bounty in about an hour.
type: Comment
comment on: http://stackoverflow.com/a/26089576
score: 0
type: AnswerComment

http://stackoverflow.com/q/26120917
tagged with: date
has comment: http://stackoverflow.com/comment/40937940
tagged with: jtable
has answer: http://stackoverflow.com/a/26122074
has comment: http://stackoverflow.com/comment/40938387
has comment: http://stackoverflow.com/comment/40939695
has comment: http://stackoverflow.com/comment/40937973
type: AnsweredQuestion
has title: Java Jtable coulmn shorting with date not working properly
has answer: http://stackoverflow.com/a/26122077
type: Question
answer count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/26122074
possible better answer: http://stackoverflow.com/a/26122077
tagged with: abstracttablemodel
score: 0
tagged with: java
has body: Sorry for asking basic question once again. As new to java, so i thought better to take guidance instead of doing something stupid. In my jtable, i have following data Id | Name | Date(month-year) 1 | XYZ | August-2014 2 | ABc | April-2014 my Modelclass is as follows class MyTableModel extends AbstractTableModel { private String[] columnNames = {"Id", "Country","Date"}; public final Object[] longValues = {Integer.class,"",Date.class}; now as recommended, i have overriden the getColumnClass in my model table @Override public Class getColumnClass(int c) { if(c == 2) { //return Date.class; return getValueAt(0,c).getClass(); } else return getValueAt(0,c).getClass(); } and i have enabled default column sorter. Now as default, all string columns work fine in shorting but for Date column also it consider as string and short it as string. If i force the column to short as date it give me error. What am i doing wrong and what is correct way of doing it. Thanks

http://stackoverflow.com/comment/40872209
type: AnswerComment
has text: Mark your answer as solution as soon as possible. :)
type: Comment
comment on: http://stackoverflow.com/a/26084056
score: 1

http://stackoverflow.com/comment/43879277
type: AnswerComment
comment on: http://stackoverflow.com/a/26163111
score: 0
has text: It still doesn't work with 7.3 and newest Eclipse Luna. Happy new year :)
type: Comment

http://stackoverflow.com/a/26169826
answers question: http://stackoverflow.com/q/26169696
upvote count: 1
type: Answer
has body: Seeing what you say, I will suppose that you use the java7 Path api. To know if a path is a directory or a simple file, use Files.isDirectory(Path) To list the files / directories in your directory, use Files.list(Path) The javadoc of the Files class : http://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html If you use the "old" java.io.File api, then you have a listFiles method, which can take a FileFilter as argument to filter, for exemple, only the files ending with ".mp3". Good luck
downvote count: 0
score: 1

http://stackoverflow.com/a/29788096
has comment: http://stackoverflow.com/comment/47706980
answers question: http://stackoverflow.com/q/26079616
downvote count: 0
type: Answer
score: 1
has body: String hql = "from Product as product where product.supplier='"+ supplier.getSupplier() + "'"; Query query = session.createQuery(hql); List resulList = query.list();
has comment: http://stackoverflow.com/comment/47706459
upvote count: 1

http://stackoverflow.com/comment/81391461
type: Comment
has text: @Mostafa: Suppose I have 10 item and I remove the last one, in that scenario holder.itemView.setVisibility(View.GONE), Hide all data,
comment on: http://stackoverflow.com/a/40710448
type: AnswerComment
score: 0

http://stackoverflow.com/q/26042373
tagged with: java
tagged with: pi
has comment: http://stackoverflow.com/comment/40795251
has title: approximate pi by iteration JAVA
type: Question
linked to: http://stackoverflow.com/q/52283039
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26042478
has comment: http://stackoverflow.com/comment/40795346
has body: I am trying to approximate pi by iteration. This is only a portion of the code. I'm trying to put this equation into java: pi = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 + ... + ((-1)^(i+1)) / (2i - 1) ). The problem I have is the summation of this equation (illustrated in my code). If the user keeps on entering y, the program is supposed to multiply i by 2 and calculate pi until user enters n, then it returns to the main menu. else if(input == 4) { System.out.print("i=1 pi=4.0\tWould you like to continue? (y|n) "); char y = keyboard.next().charAt(0); if (y =='y') { for (int i=2; i&lt;=1000; i=i*2) { int sum = 0; double pi =4 * (Math.pow(-1, i+1)/(2*i-1)); //Right here, how do I modify it to get a sum across a multitude of i's? System.out.print("i=" + i + " " + "pi" + "=" + pi + "\tcontinue (y|n)? " ); keyboard.next().charAt(0); } } else { }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/123835929
has comment: http://stackoverflow.com/comment/40795209
has comment: http://stackoverflow.com/comment/40795421

http://stackoverflow.com/q/26185013
has title: ThreadPoolExecutor: cancel tasks from invokeAll() when one task returns an error
has answer: http://stackoverflow.com/a/26187850
tagged with: threadpool
has body: I have a threadpool executor doing the same operation for a list of keys coming in batches. so i am using invokeall() method to do the processing for a list of keys in a batch. the usecase is such that if any of the tasks in a batch returns an error, there is no point to continue processing for other keys. So how can i cancel the tasks of the batch execution once a task has retuned an error. but not effect the other batch of keys execution. ie the cancellation should be isolated per batch. Thanks for your help.
answer count: 2
score: 3
downvote count: 0
tagged with: threadpoolexecutor
favorite count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/33845582
type: Question

http://stackoverflow.com/comment/101347019
score: 0
comment on: http://stackoverflow.com/a/44294279
type: AnswerComment
has text: Double `sudo` saves my day!
type: Comment

http://stackoverflow.com/q/26157249
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/41005912
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Issue file assets Libgdx
tagged with: libgdx
has answer: http://stackoverflow.com/a/26162397
downvote count: 0
answer count: 1
has body: I have a problem to load a file from assets. In pratcise I have to load TiledMap file and I do it in this way: arrayTiledMap.add(new TmxMapLoader().load(Gdx.files.internal("scenario.tmx").path()))); (I add it in array for other reason) In the project the tmx file(scenario.tmx) is located in the android assets folder. When I execute the program in Eclipse there aren't problems , but when I create the JAR file for Desktop project and I execute it I get this error on console(I launch it by terminal): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: Documents/University/Programming/Street.png (Internal) The file Street.png is a file that I used in tiledMap editor for create the map. At this point I check the JAR file contents and In the root directory of JAR there is the Documents folder and in it there is University folder and so on. Because if the path is in the JAR file I get this error? What is that wrong? Thank you very much for your time, this error is driving me crazy If you need other code, in particular, tell me. (although I do not think since the problem only occurs when loading the file)

http://stackoverflow.com/q/26156171
has answer: http://stackoverflow.com/a/28710355
type: Question
tagged with: blob
has body: In a DB2 database, I have the following table: CREATE TABLE MyTestTable ( MYPATH VARCHAR(512) NOT NULL, MYDATA BLOB, CONSTRAINT MYTESTTABLE_PK PRIMARY KEY (MYPATH) ); Using Java, I wish to update an existing row in this table with new blob data. My preferred way is to obtain an OutputStream to the BLOB column &amp; write my data to the OutputStream. Here is the test code I am using: Connection connection = null; PreparedStatement pStmnt = null; ResultSet rSet = null; try { connection = ... // get db connection String id = ... // set the MYPATH value String sql = "SELECT MYDATA FROM MyTestTable WHERE MYPATH='"+id+"' FOR UPDATE"; pStmnt = connection.prepareStatement(sql); rSet = pStmnt.executeQuery(); while (rSet.next()) { Blob blobData = rSet.getBlob("MYDATA"); // this is a java.sql.Blob OutputStream blobOutputStream = blobData.setBinaryStream(1); blobOutputStream.write(data); blobOutputStream.close(); connection.commit(); } } // close ResultSet/PreparedStatement/etc in the finally block The above code works for the Oracle DB. However, in DB2, calling setBinaryStream to get the OutputStream does not seem to work. The data does not get updated, and I do not get any error messages. Qs: How can I get an OutputStream to the BLOB column of a DB2 table? What might need to be changed in the above code?
tagged with: java
tagged with: database
tagged with: db2
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41019303
has comment: http://stackoverflow.com/comment/41047878
has title: OutputStream to the BLOB column of a DB2 database table
has comment: http://stackoverflow.com/comment/41035921
tagged with: jdbc
score: 2
has comment: http://stackoverflow.com/comment/41035942
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41010141

http://stackoverflow.com/q/26040860
favorite count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 3
duplicate of: http://stackoverflow.com/q/18448671
upvote count: 1
type: Question
has body: Hi I'm trying to create an Address Book and store all entries to an arrayList. I;m currently having a problem deleting a item from the list. Can someone please help me. Here is my ArrayList which contains my setter/getter and constructor List&lt;AddressBook&gt; addToList = new ArrayList&lt;AddressBook&gt;(); This my code for removing the item from the list : public class DeleteEntry { Scanner scanner = new Scanner(System.in); public void deleteEntry(List&lt;AddressBook&gt; addToList){ System.out.println(" Please input name to delete: "); String name = scanner.next(); for (AddressBook item : addToList) { if (name.equalsIgnoreCase(item.getName())){ addToList.remove(item); System.out.println("Item removed"); }else { System.out.println("name not found"); } } } The error that I'm getting is Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at addressbook.jedi.DeleteEntry.deleteEntry(DeleteEntry.java:12) at addressbook.jedi.MainAddressBook.main(MainAddressBook.java:29) line 12 is for (AddressBook item : addToList) {
has title: How to remove an item from ArrayList
score: -2
tagged with: arrays
tagged with: arraylist
linked to: http://stackoverflow.com/q/18448671
has answer: http://stackoverflow.com/a/26040940
answer count: 1

http://stackoverflow.com/comment/40986194
has text: simply walk the arrayList object via its size() and get(int) methods via jni
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26146540

http://stackoverflow.com/comment/40885241
comment on: http://stackoverflow.com/a/26091251
type: AnswerComment
score: 0
has text: so that is why we are able to say, `Object o = c;`. Because size does not matter and `class [LC` is subclass of `class Object`. Is that correct?
type: Comment

http://stackoverflow.com/q/26175993
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26176018
has title: Async finish first then mainActivity starts
score: -1
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/26176018
tagged with: android
type: AnsweredQuestion
has body: I got a problem I need to solve to be able to parse my menu items in my navigation drawer. Everything works fine: my asyncTask to get my xml feed of the internet and parse it into variables but, I want to use variable as menu items for my navigation drawer. My navigation drawer is called in my MainActivity its onCreate so that will be executed as first at the same time the asyncTask is running. My question to this is: is there a way to finish the asyncTask first and then execute my Mainactivity its lifecycle

http://stackoverflow.com/a/26142674
accepted answer of: http://stackoverflow.com/q/26142498
has body: It would be 0-9 = 10 characters + A-Z = 26 Characters so instead of being base 10 its base 36 You could put each character in an array and map to it value 1 through 36 Then to get the value of the plate you multiply starting at the rightmost character Char value * 1 + Char value * 36 + Char Value * (36*36) + Char value * (36 * 36 *36) + ...
answers question: http://stackoverflow.com/q/26142498
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26035204
has title: JTable RowFilter not filtering initial invocation
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40782869
tagged with: java
has comment: http://stackoverflow.com/comment/40784280
has comment: http://stackoverflow.com/comment/40783680
type: Question
accepted answer: http://stackoverflow.com/a/26036614
has comment: http://stackoverflow.com/comment/40783558
answer count: 1
tagged with: rowfilter
has body: No doubt this will be an easy fix, but as usual, I'm stumped. I'm trying to filter out font family names that are non-renderable in a JTable using a JCheckBox. The JTable contains installed font family names (column 0), sample alphabet(column 1) and sample digits(column 2). Columns one and two are rendered in their corresponding fonts and if the text in a cell cannot be renderered, the text is replaced with "non-renderable" using JTable.setValueAt(Object, int, int). I then use then use "non-renderable" as the filter. However, only rows which are visible are filtered. When I scroll to the bottom of the table and apply the filter, the entire table is filtered as desired. I also noticed, that when i move the horizontal divider, the divider doesnt repaint itself when it moves over the altered cells. Any help on this would also be appreciated. import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.table.*; class run { public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { Viewer viewer = new Viewer(); JFrame jframe = new JFrame(); jframe.add(viewer); jframe.createBufferStrategy(1); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setLocation(50,50); jframe.pack(); jframe.setVisible(true); } }); } } //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- class Viewer extends JPanel { final static long serialVersionUID = 0; String string_alphabet = "abcdefghijklmnopqrstuvwxyz"; String string_digits = "0123456789"; String string_punctuation = "`!:\";\',.-/(){}[]&lt;&gt;?"; String string_symbols = "~@#$%^&amp;*_+=|\\"; String string_installedFontsColumnNames[] = {"installed fonts","sample","sample"}; String string_installedFonts[]; DefaultTableModel defaultTableModel_installedFonts; JTable jtable_installedF…
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/26036614
has comment: http://stackoverflow.com/comment/40783811

http://stackoverflow.com/comment/77663356
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26142864
has text: One probable answer can be found in the question: https://stackoverflow.com/questions/45350095/how-to-get-date-in-utc-0-in-java
score: 0

http://stackoverflow.com/comment/40998899
comment on: http://stackoverflow.com/q/26153618
score: 1
has text: _"It seems strange that two completely different definitions manage to coexist."_ Not to me. Words are overloaded all the time. That said, this particular instance is especially confusing and unfortunate.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40795648
comment on: http://stackoverflow.com/q/26042547
type: Comment
score: 0
has text: Your variable names need to be more descriptive than they are now. `n` may have context now, but what about at 9AM? It'd also help to, in your `default` statement, print out that variable to see its value.
type: QuestionComment

http://stackoverflow.com/comment/41076407
score: 0
type: Comment
has text: Thank you so much. This helped me remove another bug from my code, which I was not able to comprehend. As my code was working for smaller data sets but not for larger ones. Now I understand why!
comment on: http://stackoverflow.com/a/26191049
type: AnswerComment

http://stackoverflow.com/comment/40876339
type: Comment
comment on: http://stackoverflow.com/q/26086535
type: QuestionComment
has text: No but if I added "hi" into the tree why doesnt it? What can I put in as a param for one of the values I inserted in the tree? I changed it to "10" (a value in the tree) and it did not work.
score: 0

http://stackoverflow.com/comment/40872973
type: QuestionComment
has text: yes i'm trying to do execute app from external different java folder
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26084759

http://stackoverflow.com/comment/40871621
type: Comment
type: QuestionComment
score: 2
has text: Yup, now you need to read the [HQL documentation](http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html) and write some valid queries. `HQL != SQL`! Maybe start with `from Employee where name = :name`.
comment on: http://stackoverflow.com/q/26084031

http://stackoverflow.com/a/30498591
answers question: http://stackoverflow.com/q/26101652
upvote count: 14
downvote count: 0
score: 14
has body: As Dimitri suggested, I solved this by adding classifier to spring-boot-maven-plugin: org.springframework.boot spring-boot-maven-plugin boot
type: Answer

http://stackoverflow.com/comment/40851056
comment on: http://stackoverflow.com/a/26072793
score: 0
type: AnswerComment
has text: I upvoted, but you could actually mention in the answer what are the rules that OP should obey - either intValue() or variable of type int would probably all that is needed here, given OP would want to work with pre-5 java.
type: Comment

http://stackoverflow.com/a/74047221
has body: I would like to complete above technical solution with performance tuning advice. Everyone didn't mention performance implication when storing entire SELECT output into program level variable in Java (applicable to any programming language). Commercial DB size has growth to 1TB easily, and a single table is normal to be 300GB. iPhone 14 with 512GB is available today as well, in case you think 300GB of data is unlikely for the output of the SELECT statement. Putting the table size of 1TB in mind, storing the entire SELECT output into simple variable like array, will indirectly used up 1TB of RAM. In Java, that is consider Java heap memory. Certainly they are members who suggest storing the data in array of HotelDao class which contains setHotelName(), getHotelName(), etc. This might double its Java internal memory usage from 1TB to 2TB. Running any Java application, you have to specify its heap memory with Java parameter -Xmx (assuming only heap memory involve) during application startup. If you are hosting it in J2EE, then it could be Apache Tomcat startup, IBM WebSphere Application Server startup, JBoss, etc. If you are doing it via reporting server, e.g. Cognos, Informatica, then they have their own configuration to define -Xmx parameter. Next, multi-user, multi-instance, concurrent access is norm in today's technology. If multiple users are trigger from GUI to request to run the same SELECT statement concurrently, e.g. flight booking system, reporting, then there will be multiple instance of the same SELECT with 1TB table size, and minimum 1TB Java array variable size in Java heap memory. Imagine 10 concurrent users, such as Expedia, will easily created 10 of such array variable, each of 1TB. The total variable size will be 10TB, if there is only 1 such SELECT-Array design in the entire program. The problem here it is impractical to define 2TB of Java heap memory during Java application startup. Configures 10TB Java heap memory is way beyond the hardware limitati…
answers question: http://stackoverflow.com/q/26127305
score: 0
type: Answer

http://stackoverflow.com/comment/40848511
score: 0
type: AnswerComment
has text: do i need to change something in the adapter ? cuz i got an error while running
type: Comment
comment on: http://stackoverflow.com/a/26058715

http://stackoverflow.com/comment/40945192
type: AnswerComment
comment on: http://stackoverflow.com/a/26124427
score: 0
type: Comment
has text: Peter I am talking about my heading error "Maximum number of threads (200) created for connector with address null and port 8080".

http://stackoverflow.com/comment/41072292
type: Comment
score: 0
type: QuestionComment
has text: @SamuelAudet I tried. I got a error message saying "c:/windows/system32/voice32.dll is not found on library.path"
comment on: http://stackoverflow.com/q/26186567

http://stackoverflow.com/q/26114254
has comment: http://stackoverflow.com/comment/41514346
answer count: 1
has body: when using JDev 12c Design time, the code generated in source time is read only and i need to modify or add something with code, and unfortunately the main method generated is read only
has title: how to modify the auto generated source code in JDeveloper 12c
score: 0
type: UnansweredQuestion
tagged with: jdeveloper
has answer: http://stackoverflow.com/a/26434794
tagged with: java
type: Question

http://stackoverflow.com/q/26049329
has answer: http://stackoverflow.com/a/35223691
answer count: 4
has answer: http://stackoverflow.com/a/50697839
has title: Javadoc in JDK 8 : Invalid "self-closing element not allowed"
score: 61
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28069357
possible better answer: http://stackoverflow.com/a/35223691
has comment: http://stackoverflow.com/comment/53198000
tagged with: maven
has comment: http://stackoverflow.com/comment/40808237
type: Question
has answer: http://stackoverflow.com/a/28587761
has comment: http://stackoverflow.com/comment/43488255
tagged with: java
tagged with: javadoc
has comment: http://stackoverflow.com/comment/68505438
accepted answer: http://stackoverflow.com/a/28587761
has body: What are the best workarounds when running javadoc using JDK 8 and one receives this error. It seems that for JDK 8 it has been decided that tags like &lt;br /&gt; and &lt;p /&gt; should generate errors, because they are invalid (strict) HTML 4. see discussion JDK mailing list here I wonder, because I just wanted to compile some java project using maven and tripped over this issue. Of course, I can file a ticket with the project (and I guess I will), but it would be great if there is a way how to disable this behaviour (for a machine). Otherwise, I expect that a lot of projects need to be fixed before they can be built on JDK 8 without issues.
has comment: http://stackoverflow.com/comment/68539565
has comment: http://stackoverflow.com/comment/43481819
linked to: http://stackoverflow.com/q/22528767
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/15886209
upvote count: 61
has comment: http://stackoverflow.com/comment/40808545

http://stackoverflow.com/comment/40848418
has text: Because the GPS updates more slowly (it's probably 1Hz on most devices) what you'll probably need to do is use the GPS time to periodically sync a 100Hz timer that keeps track of the milliseconds component, although I haven't done enough Android programming to suggest a specific way.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26071166
score: 0

http://stackoverflow.com/a/26086096
score: 0
type: Answer
has body: The error response from Jetty HTTP/1.1 400 Bad Request indicates that Jetty did detect that as a bad URL and rejected it. As for how to customize this, that is really tricky, mainly due to how early in the processing of this specific request it occurs in. This kind of error (400 Bad Request) occurs during the parsing of the raw incoming http request, well before the server container has even attempted to figure out what context to talk to. There is no way to have a custom error handler in a specific webapp context handle this sort of fundamental http error. As the server has yet to figure out what context to even talk to. There is also no way at the server side (even at a global level) to customize this error message. If you want such a feature, please file a feature request.
has comment: http://stackoverflow.com/comment/40889412
has comment: http://stackoverflow.com/comment/40987629
answers question: http://stackoverflow.com/q/26081813
has comment: http://stackoverflow.com/comment/40890133
accepted answer of: http://stackoverflow.com/q/26081813
type: AcceptedAnswer

http://stackoverflow.com/comment/40908133
type: Comment
type: QuestionComment
has text: When do you get the error, on startup? What is the exact message you get?
comment on: http://stackoverflow.com/q/26104084
score: 0

http://stackoverflow.com/comment/40833136
has text: actually, the second rule was higher, not lower, but regardless...
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26062613

http://stackoverflow.com/comment/41031734
type: AnswerComment
has text: The method might not be static (like a set membership method, for instance).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26171216

http://stackoverflow.com/a/26190681
type: Answer
has comment: http://stackoverflow.com/comment/41068141
upvote count: 5
has comment: http://stackoverflow.com/comment/41068763
score: 5
answers question: http://stackoverflow.com/q/26190097
has body: These are good approaches. A simpler solution might be to use shared memory. This has the performance of AtomicLong, while being shared across processes on the same machine. import net.openhft.lang.io.DirectBytes; import net.openhft.lang.io.MappedStore; import java.io.File; import java.io.IOException; import java.nio.channels.FileChannel; public class CounterExampleMain { static volatile long id; public static void main(String... ignored) throws IOException { int counters = 128; int repeats = 100000; File file = new File(System.getProperty("java.io.tmpdir") + "/counters"); MappedStore ms = new MappedStore(file, FileChannel.MapMode.READ_WRITE, counters * 8); DirectBytes slice = ms.bytes(); long start = System.nanoTime(); for (int j = 0; j < repeats; j++) { for (int i = 0; i < counters; i++) { id = slice.addAtomicLong(i * 8, 1); } } long time = System.nanoTime() - start; System.out.printf("Took %.3f second to increment %,d counters, %,d times, last id=%,d%n", time / 1e9, counters, repeats, id); ms.free(); } } Each time I run it on my laptop, I get Took 0.252 second to increment 128 counters, 100,000 times, last id=100,000 Took 0.267 second to increment 128 counters, 100,000 times, last id=200,000 Took 0.255 second to increment 128 counters, 100,000 times, last id=300,000 As you can see this is really cheap, averaging ~25 ns per increment and persisted between runs of the program. It is also thread safe and can be shared between JVMs. BTW in a contented example where multiple threads are updating the same counters, I would expect closer to 50 ns. The library I used was net.openhft lang 6.4.8
downvote count: 0
has comment: http://stackoverflow.com/comment/41068624

http://stackoverflow.com/a/26080212
score: 3
downvote count: 0
has body: Problem When you use &lt;input type="file" name="file" multiple /&gt; the files will all be sent with name="file", eg: Content-Disposition: form-data; name="file"; filename="foo.jpg" Content-Type: image/jpeg ........... . ... ....... Content-Disposition: form-data; name="file"; filename="bar.jpg" Content-Type: image/jpeg .... . .. ....... and this is the right parameter Struts2 FileUpload Interceptor is expecting to receive, to work with a List&lt;File&gt; and the related List&lt;String&gt; for fileName and contentType. When you use dropzone.js, instead, the filename will be altered to handle the multiple input client-side, by appending [] to it: paramName: The name of the file param that gets transferred. Defaults to file. NOTE: If you have the option uploadMultiple set to true, then Dropzone will append [] to the name. eg. Content-Disposition: form-data; name="file[0]"; filename="foo.jpg" Content-Type: image/jpeg ........... . ... ....... Content-Disposition: form-data; name="file[1]"; filename="bar.jpg" Content-Type: image/jpeg .... . .. ....... Struts2 doesn't like it at all. Solution Instead of messing with custom Interceptors and Converters, do a simple adjustment on the dropzone.js library you use for your Struts2 projects: Rename your dropzone.js to dropzone-struts2.js; Open the file and search "[" + n + "]" (line 866 in latest version) Change this line return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : ""); to this one return "" + this.options.paramName; //+ (this.options.uploadMultiple ? "[" + n + "]" : ""); Now it is Struts2 compliant, and will work with multiple uploads.
has comment: http://stackoverflow.com/comment/40925056
accepted answer of: http://stackoverflow.com/q/26057743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/86858358
answers question: http://stackoverflow.com/q/26057743
upvote count: 3
has comment: http://stackoverflow.com/comment/127609143
type: Answer
has comment: http://stackoverflow.com/comment/40934148

http://stackoverflow.com/comment/97618444
type: Comment
score: 1
has text: Please note, solution 1 is deprecated
type: AnswerComment
comment on: http://stackoverflow.com/a/37706836

http://stackoverflow.com/q/26037759
has answer: http://stackoverflow.com/a/26060264
tagged with: coordinates
type: Question
has title: Collision Between 2 views in android
has body: I have 2 views in android and they are dragable.I want to detect collision between them. Currently I am using this code to detect collision but I don't think its working .Please suggest what need to check the collision. public boolean onTouch(View view, MotionEvent event) { final int X = (int) event.getRawX(); final int Y = (int) event.getRawY(); switch (event.getAction() &amp; MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) view .getLayoutParams(); _xDelta = X - lParams.leftMargin; _yDelta = Y - lParams.topMargin; break; case MotionEvent.ACTION_UP: break; case MotionEvent.ACTION_POINTER_DOWN: break; case MotionEvent.ACTION_POINTER_UP: break; case MotionEvent.ACTION_MOVE: RelativeLayout.LayoutParams ParamsA = (RelativeLayout.LayoutParams) view .getLayoutParams(); ParamsA.leftMargin = X - _xDelta; ParamsA.topMargin = Y - _yDelta; ParamsA.rightMargin = -250; ParamsA.bottomMargin = -250; for (int i = 0; i &lt; balls.size(); i++) { if (balls.get(i).getTag() != view.getTag()) { RelativeLayout.LayoutParams ParamsB = (RelativeLayout.LayoutParams) balls .get(i).getLayoutParams(); Rect b = new Rect(ParamsB.leftMargin,ParamsB.topMargin,ParamsB.rightMargin,ParamsB.bottomMargin); Rect a = new Rect(ParamsA.leftMargin,ParamsA.topMargin,ParamsA.rightMargin,ParamsA.bottomMargin); if(a.intersect(b)) { Toast.makeText(getApplicationContext(), "Collision Detected", Toast.LENGTH_SHORT).show(); } } } view.setLayoutParams(ParamsA); break; } // _root.invalidate(); return true; } "balls" is array of type "View" which are laying in the screen.
tagged with: collision-detection
score: 4
upvote count: 4
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26060264
favorite count: 0
tagged with: drag-and-drop
tagged with: android
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26112140
accepted answer of: http://stackoverflow.com/q/26107707
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26107707
has body: It's possible that the obfuscator has renamed (or even removed) methods that internally need to be called by the enum class using reflections. Reflections won't work any more if the method has been renamed. You should try to compile and run the code without the obfuscator. If this works, you can try to narrow down the cause by excluding only the enum from getting obfuscated. In particular I suspect that the enum's values() method may have been obfuscated. valueOf at some point looks for this method using getMethod("values").
has comment: http://stackoverflow.com/comment/40946720
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40889300
type: AnswerComment
comment on: http://stackoverflow.com/a/26093259
score: 0
type: Comment
has text: @JohnKugelman Not so much subtyping as inheritance subtype-relationsips: mainly the increased (and too-easy) dependence upon LSP (beyond a defined interface contract) and concrete types.

http://stackoverflow.com/a/26112951
has comment: http://stackoverflow.com/comment/40926621
has comment: http://stackoverflow.com/comment/40924098
has comment: http://stackoverflow.com/comment/40924088
has comment: http://stackoverflow.com/comment/40931276
has comment: http://stackoverflow.com/comment/40924270
upvote count: 2
has comment: http://stackoverflow.com/comment/41003289
has comment: http://stackoverflow.com/comment/40923941
has comment: http://stackoverflow.com/comment/40933194
has comment: http://stackoverflow.com/comment/40930479
has comment: http://stackoverflow.com/comment/40926433
score: 2
has comment: http://stackoverflow.com/comment/40924074
has comment: http://stackoverflow.com/comment/40932350
has body: Did you want something like this : @RequestMapping(method= RequestMethod.GET,value = "/search/r/regNo={regNo}") public String getStudent(@PathVariable String regNo){ } for studentName : @RequestMapping(method= RequestMethod.GET,value = "/search/s/studentName={studentName}") public String getStudent(@PathVariable String studentName){ } then you need to add both request in different form tag, & in action tag provide : if regNo send : /search/r/ for studentName : /search/s/ Jsp : OR Second way to do so : controller : @RequestMapping(value = "/search", method = RequestMethod.GET, params = { "regno" }) public String getRegno(@RequestParam String regno) { } @RequestMapping(value = "/search", method = RequestMethod.GET, params = { "studentName" }) public String getStudent(@RequestParam String studentName) { } Post me.
has comment: http://stackoverflow.com/comment/40931008
accepted answer of: http://stackoverflow.com/q/26112783
has comment: http://stackoverflow.com/comment/40924299
has comment: http://stackoverflow.com/comment/40924177
has comment: http://stackoverflow.com/comment/40925765
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40926207
has comment: http://stackoverflow.com/comment/40924059
has comment: http://stackoverflow.com/comment/40924221
has comment: http://stackoverflow.com/comment/40923952
answers question: http://stackoverflow.com/q/26112783
has comment: http://stackoverflow.com/comment/40932407
type: Answer
has comment: http://stackoverflow.com/comment/40926525
has comment: http://stackoverflow.com/comment/40932045
has comment: http://stackoverflow.com/comment/40925741
has comment: http://stackoverflow.com/comment/40932203
has comment: http://stackoverflow.com/comment/40929779

auto-increment
type: Tag
tag name: auto-increment
tags question: http://stackoverflow.com/q/26095752

http://stackoverflow.com/q/26124059
answer count: 1
has answer: http://stackoverflow.com/a/26124427
has comment: http://stackoverflow.com/comment/92512143
tagged with: connection-pooling
has title: Maximum number of threads (200) created for connector with address null and port 8080
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: mysql
tagged with: apache-commons-pool
type: Question
has body: I am getting this error on prod in approximately every 7-8 days. So to debug this issue I downloaded the thread dump file. This file has following thread state 100 times: "http-8080-198" daemon prio=10 tid=0x08a62c00 nid=0x3a78 in Object.wait() [0x66467000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x87097728&gt; (a org.apache.commons.pool.impl.GenericObjectPool$Latch) at java.lang.Object.wait(Object.java:485) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1104) - locked &lt;0x87097728&gt; (a org.apache.commons.pool.impl.GenericObjectPool$Latch) So my questions are: Is this exception because of mysql connection pool? If yes, what should I do to solve it? My MAX-Active value is 50 and MinIdle value is 1. If this is not the case then how can I know which functionality are holding threads?

http://stackoverflow.com/comment/41056863
score: 0
comment on: http://stackoverflow.com/q/26184754
type: Comment
type: QuestionComment
has text: Lots of opinions about singletons here: http://stackoverflow.com/q/137975/10077

http://stackoverflow.com/comment/41071107
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26192709
has text: Use a Regex Matcher against the string. See [this tutorial](http://tutorials.jenkov.com/java-regex/matcher.html) on the Topicfor example

http://stackoverflow.com/q/26039865
has title: Why SingleColumnValueFilter do not returns true answer on < and > operator?
has comment: http://stackoverflow.com/comment/40793356
has comment: http://stackoverflow.com/comment/40793058
type: Question
has answer: http://stackoverflow.com/a/26060315
tagged with: hbase
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40821794
has body: Hi I am new to hbase and in phase of learning it. I created a table using hbase shell and put values into that table uing shell. But now when i want to get thos values using some filter like this: HTable table = new HTable(conf, "test"); List&lt;Filter&gt; filters = new ArrayList&lt;Filter&gt;(); SingleColumnValueFilter colValFilter = new SingleColumnValueFilter(Bytes.toBytes("col"), Bytes.toBytes("age") , CompareFilter.CompareOp.GREATER, new BinaryComparator(Bytes.toBytes("118"))); colValFilter.setFilterIfMissing(false); filters.add(colValFilter); FilterList fl = new FilterList( FilterList.Operator.MUST_PASS_ALL, filters); Scan s = new Scan(); s.setFilter(fl); ResultScanner ss = table.getScanner(s); JSONArray arr=new JSONArray(); for(Result r:ss){ JSONObject obj=new JSONObject(); for(KeyValue kv : r.raw()){ String column=new String(kv.getQualifier()); String value=new String(kv.getValue()); obj.accumulate(column, value); } arr.put(obj); } Now when i run this program i get different results. Like i get users whose age are less than 118 but still they get displayed. My Question: Why SingleColumnValueFilter do this? Any other way to solve this problem?
has comment: http://stackoverflow.com/comment/40818031
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40793417
tagged with: hadoop

http://stackoverflow.com/comment/40953924
comment on: http://stackoverflow.com/a/26127753
has text: Concerning the # URL: now I'm seeing these errors in the logs: ERR warning: Could not find remote branch tags/v2.4 to clone. ERR fatal: Remote branch tags/v2.4 not found in upstream origin
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41110432
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26143275
has text: @technomage So you suggest that the only way to create native memory leaks with jna and the user32.dll is when I keep references to returned buffers/memory ? Anything else will be released and there is no need for me to free something by hand? Given that I never alloc anything by myself - only using arrays, integers and Memory objects inside the java world.
score: 0

http://stackoverflow.com/q/26147085
type: UnansweredQuestion
has title: How to generate @XmlSchemaType for an element customized with xjc:javaType
has comment: http://stackoverflow.com/comment/40986942
has comment: http://stackoverflow.com/comment/40986762
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26149536
tagged with: xjc
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40987072
answer count: 1
tagged with: xsd
has comment: http://stackoverflow.com/comment/40987433
has body: I would like to use xjc to generate JAXB objects while using an XmlJavaTypeAdapter I'm currently using the following in global bindings: &lt;xjc:javaType name="java.lang.Boolean" xmlType="xsd:boolean" adapter="path.to.my.CustomBooleanAdapter"/&gt; It generates the following code: @XmlJavaTypeAdapter(CustomBooleanAdapter.class) @XmlElement(type=String.class) private Boolean finished; However I would like the code to have the @XmlSchemaType of boolean and without the @XmlElement type String @XmlJavaTypeAdapter(BooleanAdapter.class) @XmlSchemaType(name = "boolean") private Boolean finished; Adapter code: public class CustomBooleanAdapter extends XmlAdapter&lt;String, Boolean&gt; { @Override public Boolean unmarshal(String s) { if("true".equals(s) || "false".equals(s)){ return Boolean.valueOf(s); } return null; } @Override public String marshal(Boolean c) { return c == null ? null : c.toString(); } } Is there a way to tell xjc to generate the @XmlSchemaType annotation and remove the @XmlElement of type String
has comment: http://stackoverflow.com/comment/40987225
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/44547954
comment on: http://stackoverflow.com/a/28084905
type: AnswerComment
has text: Can you please point out where the JDBC spec states the JVM timezone as default? I searched yesterday, and I didn't find it.
score: 0
type: Comment

http://stackoverflow.com/q/26145408
tagged with: java
has comment: http://stackoverflow.com/comment/41020530
has body: I'm dealing with a system that runs a Java application per customer in its own JVM. We've got about a half dozen dedicated servers that are running close to 100 JVMs total now and sets of custom scripts for managing these JVMs. This setup is really showing its age at this point: managing that many JVMs is becoming a monitoring/management nightmare and we are constantly dealing with heap sizing issues. We'd like to move to a more modern approach and just run a bunch of applications in a single app server per physical machine. However, keeping the applications separate does have distinct advantages in terms of isolation (e.g. out of memory errors only affect one customer). Each customer's software stack has memory requirements that vary widely. My question: is there a way to have the best of both worlds here and run multiple applications in one JVM (app server) and still maintain some level of isolation? Or is it just a modern fact of life that you need to manage memory requirements of a set of applications these days? Are there other solutions here besides an app server or Java EE container (e.g. Wildfly or Spring) that I'm missing here? It seems like this system is a holdout from another era!
type: Question
tagged with: jakarta-ee
upvote count: 22
has answer: http://stackoverflow.com/a/26151145
tagged with: appserver
downvote count: 0
has comment: http://stackoverflow.com/comment/40998482
score: 22
favorite count: 0
has answer: http://stackoverflow.com/a/44395140
linked to: http://stackoverflow.com/q/16382787
accepted answer: http://stackoverflow.com/a/26151145
tagged with: jvm
answer count: 4
has answer: http://stackoverflow.com/a/26156954
has title: Multiple JVMs vs single app server
has comment: http://stackoverflow.com/comment/41004624
linked to: http://stackoverflow.com/q/15859245
has comment: http://stackoverflow.com/comment/64666271
possible better answer: http://stackoverflow.com/a/26145746
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26145746

http://stackoverflow.com/q/26147101
upvote count: 1
has comment: http://stackoverflow.com/comment/41257256
answer count: 0
type: UnansweredQuestion
tagged with: glassfish
has title: NetBeans unable to find org.postgresql.ds.PGSimpleDataSource driver
downvote count: 0
score: 1
favorite count: 0
tagged with: postgresql
type: Question
tagged with: jdbc
tagged with: netbeans
has body: I have glass fish installed and have set up a JDBC connection pool and resource like so (with the password hidden for obvious reasons!): I can ping the connection pool just fine. In NetBeans I have added a new driver under the "Services" tab which points to the jar I placed in the glass fish lib: /Applications/NetBeans/glassfish-4.0/glassfish/lib/postgresql-9.3-1102.jdbc41.jar. Note: When I choose the jar it populates the "Driver Class" text box with org.postgresql.Driver which is not the same as the one in the question title, but if I click the find button next to the text box it says "Searching for driver classes" with a progress bar and then under it an info symbol saying "Driver class is missing". If I press the find button again it populates it with the values that were there after selecting the jar. I then try to create some entity classes from the database, so I select the data source as my jdbc/FYP resource and from here there are two scenarios: 1. If I have my glassfish installation running then the error "The name of the driver class for the datasource is missing" appears 2. If it is not running then the error "Unable to find the driver org.postgresql.ds.PGSimpleDataSource" appears. This second case seems interesting as it is the driver name it can't find is the same as the one that is set when creating the JDBC connection pool, but is not the same as the driver class that gets sets when registering the driver in NetBeans. Even more interesting/weird is that if I create a new connection under the "Services" tab for the postgresql database and use the driver I created it can create a connection and find the tables absolutely fine.
tagged with: java

http://stackoverflow.com/a/26192812
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26189346
has comment: http://stackoverflow.com/comment/41072092
has comment: http://stackoverflow.com/comment/41071379
type: Answer
has body: I've refactored your code a little to show how to efficiently program this in Java. This should also make the utility functions more easy to read. I'll give you some hints about the encoding function below that. import java.util.Scanner; public class EncodervOwl { public static int position(char c) { if (c &lt; 'A' || c &gt; 'Z') { throw new IllegalArgumentException("Character out of range"); } return c - 'A' + 1; } public static char back(int i) { if (i &lt; 1 || i &gt; 'Z' - 'A' + 1) { throw new IllegalArgumentException("Character out of range"); } return (char) ('A' + i - 1); } public static int[] positionSetter(String s) { int[] positions = new int[s.length()]; for (int i = 0; i &lt; s.length(); i++) { positions[i] = position(s.charAt(i)); } return positions; } public static String backtoLetters(int[] p) { StringBuilder s = new StringBuilder(p.length); for (int i = 0; i &lt; p.length; i++) { s.append(back(p[i])); } return s.toString(); } public static void printCode(int[] positions) { System.out.print("Positions: "); for (int i = 0; i &lt; positions.length; i++) { if (i != 0) { System.out.print(", "); } System.out.print(positions[i]); } System.out.println(); } public static int[] newPosition(int[] p) { int[] p2 = new int[p.length]; for (int i = 0; i &lt; p.length; i++) { if (p[i] &lt;= 5) { p2[i] = p[i] * 2; } else if (p[i] &gt; 5 &amp;&amp; p[i] &lt; 11) { // not reversible (6 and 9 map to 0, 7 and 10 to 1 etc) p2[i] = (p[i] % 3) * 5; } else if (p[i] &gt; 10 &amp;&amp; p[i] &lt; 16) { p2[i] = (int) (p[i] / 4) * 8; } else if (p[i] &gt; 15 &amp;&amp; p[i] &lt; 21) { // from 1..26 to 0..25 p2[i] = (((p[i] % 10) + ((p[i] / 10) % 10)) * 10) % 26; } else if (p[i] &gt; 20 &amp;&amp; p[i] &lt;= 27) { // U IS 21 for(int e = 1;e &lt; 14; e++) { int factor = 0; if(p[i] % e == 0) { factor = e; } p2[i] = factor; } } } return p2; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); for (int i = 0; i &lt; 5; i++) { System.out.println("Enter any nu…
has comment: http://stackoverflow.com/comment/41072616
downvote count: 0
has comment: http://stackoverflow.com/comment/41128653
score: 1
has comment: http://stackoverflow.com/comment/41072874
has comment: http://stackoverflow.com/comment/41072165
has comment: http://stackoverflow.com/comment/41072282
accepted answer of: http://stackoverflow.com/q/26189346

http://stackoverflow.com/a/26168894
score: 0
type: Answer
has body: Use lists. They print out nicely. public class EvenOdd { public static void main(String[]args) { List&lt;String&gt; even = new ArrayList&lt;String&gt;(); List&lt;String&gt; odd = new ArrayList&lt;String&gt;(); int e = 50; while (e &lt;= 100) { if (e%2 == 0) even.add(String.valueOf(e)); else odd.add(String.valueOf(e)); e++; } System.out.print("Even numbers between 50 and 100: " + even); System.out.print("\nOdd numbers between 50 and 100: " + odd); } }
answers question: http://stackoverflow.com/q/26168701

bigdecimal
tags question: http://stackoverflow.com/q/26138548
tags question: http://stackoverflow.com/q/26069522
tags question: http://stackoverflow.com/q/26101918
tags question: http://stackoverflow.com/q/26089408
type: Tag
tags question: http://stackoverflow.com/q/26102362
tag name: bigdecimal
tags question: http://stackoverflow.com/q/26077775

http://stackoverflow.com/q/26148018
has comment: http://stackoverflow.com/comment/40989618
answer count: 4
has answer: http://stackoverflow.com/a/26151391
tagged with: java
has body: This is what the question wants: Write a program that displays employees and their total hours in decreasing of the total hours. I don't know how to write sorting coding. I'm just a beginner :/ How do I combine them into a single program and get the output in decreasing order? Su M T W H F Sa Employee 0 2 4 3 4 5 8 8 Employee 1 7 3 4 3 3 4 4 Employee 2 3 3 4 3 3 2 2 Employee 3 9 3 4 7 3 4 1 Employee 4 3 5 4 3 6 3 8 Employee 5 3 4 4 6 3 4 4 Employee 6 3 7 4 8 3 8 4 Employee 7 6 3 5 9 2 7 9 This is my coding for the display: import java.util.Scanner; public class WeeklyHours { private static int[][] hours; public static void main(String[] args) { int[][] WeeklyHours = new int[8][7]; WeeklyHours [0][0] = 2; WeeklyHours [0][1] = 4; WeeklyHours [0][2] = 3; WeeklyHours [0][3] = 4; WeeklyHours [0][4] = 5; WeeklyHours [0][5] = 8; WeeklyHours [0][6] = 8; WeeklyHours [1][0] = 7; WeeklyHours [1][1] = 3; WeeklyHours [1][2] = 4; WeeklyHours [1][3] = 3; WeeklyHours [1][4] = 3; WeeklyHours [1][5] = 4; WeeklyHours [1][6] = 4; WeeklyHours [2][0] = 3; WeeklyHours [2][1] = 3; WeeklyHours [2][2] = 4; WeeklyHours [2][3] = 3; WeeklyHours [2][4] = 3; WeeklyHours [2][5] = 2; WeeklyHours [2][6] = 2; WeeklyHours [3][0] = 9; WeeklyHours [3][1] = 3; WeeklyHours [3][2] = 4; WeeklyHours [3][3] = 7; WeeklyHours [3][4] = 3; WeeklyHours [3][5] = 4; WeeklyHours [3][6] = 1; WeeklyHours [4][0] = 3; WeeklyHours [4][1] = 5; WeeklyHours [4][2] = 4; WeeklyHours [4][3] = 3; WeeklyHours [4][4] = 6; WeeklyHours [4][5] = 3; WeeklyHours [4][6] = 8; WeeklyHours [5][0] = 3; WeeklyHours [5][1] = 4; WeeklyHours [5][2] = 4; WeeklyHours [5][3] = 6; WeeklyHours [5][4] = 3; WeeklyHours [5][5] = 4; WeeklyHours [5][6] = 4; WeeklyHours [6][0] = 3; WeeklyHours [6][1] = 7; WeeklyHours [6][2] = 4; WeeklyHours [6][3] = 8; WeeklyHours [6][4] = 3; WeeklyHours [6][5] = 8; WeeklyHours [6][6] = 4; WeeklyHours [7][0] = 6; WeeklyHours [7][1] = 3; WeeklyHours [7][2] = 5; WeeklyHours [7][3] = 9; WeeklyHours [7][4] = 2; WeeklyHours [7…
has answer: http://stackoverflow.com/a/26148944
has comment: http://stackoverflow.com/comment/40988360
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26150091
tagged with: arrays
has answer: http://stackoverflow.com/a/58634937
tagged with: sorting
linked to: http://stackoverflow.com/q/15422091
score: 0
downvote count: 2
has title: Employee Weekly Hours
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40988332

http://stackoverflow.com/comment/41014154
comment on: http://stackoverflow.com/q/26161917
score: 0
type: QuestionComment
type: Comment
has text: You mean when(repository.merge(any(SomeEntity.class))).thenReturn(entity); ?

http://stackoverflow.com/a/26055896
downvote count: 0
has body: This can be done using a custom TypeAdaptor for your model Object. You can iterate over the object field using reflection and whenever a field is null, set the value in the json representation to an empty string whenever you cross a null field. This would absolutely be hard to maintain and should be done with some risks as @Sotirios Delimanolis stated, What if the corresponding reference is not a String, how are you going to intending to handle it back and forth? Here is a bean structure just used to showcase the situation: public class MyEntity { private int id; private String name; private Long socialNumber; private MyInnerEntity innerEntity; public MyEntity(int id, String name, Long socialNumber, MyInnerEntity innerEntity) { this.id = id; this.name = name; this.socialNumber = socialNumber; this.innerEntity = innerEntity; } public int getId() { return id; } public String getName() { return name; } public Long getSocialNumber() { return socialNumber; } public MyInnerEntity getInnerEntity() { return innerEntity; } public static class MyInnerEntity { @Override public String toString() { return "whateverValue"; } } } Here is the TypeAdapter implementation which set any null value to and empty "" String: public class GenericAdapter extends TypeAdapter&lt;Object&gt; { @Override public void write(JsonWriter jsonWriter, Object o) throws IOException { jsonWriter.beginObject(); for (Field field : o.getClass().getDeclaredFields()) { Object fieldValue = runGetter(field, o); jsonWriter.name(field.getName()); if (fieldValue == null) { jsonWriter.value(""); } else { jsonWriter.value(fieldValue.toString()); } } jsonWriter.endObject(); } @Override public Object read(JsonReader jsonReader) throws IOException { /* Don't forget to add implementation here to have your Object back alive :) */ return null; } /** * A generic field accessor runner. * Run the right getter on the field to get its value. * @param field * @param o {@code Object} * @return */ public static Object runGetter(Fie…
score: 4
answers question: http://stackoverflow.com/q/26041726
type: Answer
upvote count: 4

http://stackoverflow.com/comment/40838903
comment on: http://stackoverflow.com/a/26065138
type: AnswerComment
score: 0
type: Comment
has text: Sorry, for that time it seemed like problem can be solved but how can i assign the values back to i and j without changing users code at large scale.

http://stackoverflow.com/q/26098631
tagged with: email
answer count: 0
tagged with: cyrillic
type: Question
has title: Java. Sending email to cyrillic email issue
has comment: http://stackoverflow.com/comment/40903976
tagged with: java
has comment: http://stackoverflow.com/comment/40903488
score: 0
has body: there is a problem with sending messages to email address in cyrillic symbols using java.mail.internet.InternetAddress. When im trying to parse email address it checks every char to fit range between 040 and 0177 ASCII chars, and it fails if it enounters a cyrillic symbol. And i'm looking for a solutin of that problem, probably any other package to create InternetAddress object for a email with cyrillic address. Class InternetAddress -> line 1214 (method checkAddress). Thanks in advance for any suggestions.
type: UnansweredQuestion

http://stackoverflow.com/comment/40903231
has text: Thanks Adam, would you know any way to do this in spring-mvc?
comment on: http://stackoverflow.com/q/26101420
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26160277
has answer: http://stackoverflow.com/a/26160579
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26160579
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26165133
has body: this question was asked many times but I couldn't find elegant workaround for it. This example works as desired: public class RequestWrapper&lt;T&gt; { private final T request; private final Class&lt;T&gt; type; public RequestWrapper(T request, Class&lt;T&gt; type) { this.request = request; this.type = type; } public T getRequest() { return request; } public Class&lt;T&gt; getType() { return type; } } public class Service { private void invoke(String request) { System.out.println("String:" + request); } private void invoke(Object request) { System.out.println("Object:" + request + "," + request.getClass().getSimpleName()); } public static void main(String[] args) { RequestWrapper&lt;String&gt; sw = new RequestWrapper&lt;String&gt;("A", String.class); RequestWrapper&lt;Integer&gt; iw = new RequestWrapper&lt;Integer&gt;(Integer.valueOf(0), Integer.class); new Service().invoke(sw.getRequest()); new Service().invoke(iw.getRequest()); } } But I would need to add one more method to Service class which do something before/after call of invoke method: public void invoke(RequestWrapper&lt;?&gt; wrapper) { try { // ... invoke(wrapper.getType().cast(wrapper.getRequest())); invoke(wrapper.getRequest()); } catch(Exception e ) { // ... } } then the main method would contain: new Service().invoke(sw); I understand the reason why the invoke(Object request) is used instead of invoke(String request). What would be an elegant solution to call proper invoke method and be able to do some common actions before/after it? To have an interface e.g. Invoker, implement it e.g. StringInvoker, Invoker> and call map.get(wrapper.getType()).invoke(wrapper.getRequest()) is possible solution but I expect something better.
answer count: 2
downvote count: 0
tagged with: generics
has title: Generics overloading of method - workaround
favorite count: 0
accepted answer: http://stackoverflow.com/a/26165133

http://stackoverflow.com/a/26169466
has comment: http://stackoverflow.com/comment/41028280
upvote count: 1
score: 1
has body: Maven has no impact on your runtime classpath (only your compile-time classpath). You need to add your dependencies to the classpath.
answers question: http://stackoverflow.com/q/26169424
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40976105
comment on: http://stackoverflow.com/q/26128665
has text: @lexicore oh yea? Try to consume an `int` from a java web service in C# when the `int` is null. C# does not allow `int` to be null, only a `int?` that is why a standard wrapper is used...
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26096736
tagged with: generics
has answer: http://stackoverflow.com/a/26145354
favorite count: 0
has answer: http://stackoverflow.com/a/26105077
has body: Let's say I need a class that is bounded to a generic Comparable type: class A&lt;T extends Comparable&lt;T&gt;&gt; { // this is just an example of usage of T type List&lt;T&gt; comparables; int compareSomething(T smth) { return comparables.get(0).compareTo(smth); } } The class has a method with own generics in signature: &lt;V&gt; Future&lt;V&gt; submit(Callable&lt;V&gt; task) { return someExecutorService.submit(task); } Now, is there a possibility to restrict the input of the submit method to accept only Callables that also implement T? I first tried this: &lt;V, W extends T &amp; Callable&lt;V&gt;&gt; Future&lt;V&gt; submit(W task) { if(compareSomething(task) != 0) throw new RuntimeException(""); return someExecutorService.submit(task); } but found out it's not possible (for reasons described here). Is there any elegant possibility to bypass it? EDIT: The one ugly possibility I can think about is to split the encapsulation in two different types and pass an object pair in submit: class A&lt;T extends Comparable&lt;T&gt;&gt; { // this is just an example of usage of T type List&lt;T&gt; comparables; int compareSomething(T smth) { return comparables.get(0).compareTo(smth); } &lt;V&gt; Future&lt;V&gt; submit(Callable&lt;V&gt; task, T comparable) { if(compareSomething(comparable) != 0) throw new RuntimeException(""); return someExecutorService.submit(task); } } The main disadvantage is that the method signature becomes more complicated, also I will need some one-to-one mapping of Ts to Callables for some latter code. Maybe one can suggest a pattern that solves it in an appropriate way?.. EDIT, take two: Let me explain briefly what I'm trying to achieve. I'm working on a custom thread pool implementation that is able to perform some kind of special task scheduling. To do so, this service accepts only one special sort of Callable tasks. Those Callables have to implement a custom interface that is similar to the Comparable one. By comparing pairs of tasks using methods i…
has answer: http://stackoverflow.com/a/26170936
downvote count: 1
score: 14
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7354740
tagged with: java
has answer: http://stackoverflow.com/a/26172022
type: Question
upvote count: 15
linked to: http://stackoverflow.com/q/197190
has answer: http://stackoverflow.com/a/26171529
has answer: http://stackoverflow.com/a/26170150
has comment: http://stackoverflow.com/comment/40895161
accepted answer: http://stackoverflow.com/a/26171529
possible better answer: http://stackoverflow.com/a/26173056
answer count: 7
has answer: http://stackoverflow.com/a/26173056
has title: Encapsulate class-specific and method-specific generics in one type

http://stackoverflow.com/a/26145746
has comment: http://stackoverflow.com/comment/40984441
answers question: http://stackoverflow.com/q/26145408
has comment: http://stackoverflow.com/comment/41021689
type: Answer
score: 6
upvote count: 6
has body: There's pros and cons of either approach: Shared JVM Lower overhead - JVM memory footprint (core libraries etc.) only needs to be loaded once. Better memory usage. Java processes will consume OS memory for heap space that may not currently be in use. Separate JVM Insulation from 'greedy' or 'leaky' applications. Better security from malicious code. Easier updates, updating one app without bringing down the other. Overall, I wouldn't set a blanket policy. Look for small / micro-services or other low-usage apps that may be good candidates to share first and expand from there.
has comment: http://stackoverflow.com/comment/40984565
downvote count: 0

http://stackoverflow.com/q/26122103
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26122692
has title: Inefficient way of getting information from Database (java, sql)
has comment: http://stackoverflow.com/comment/40940692
tagged with: sql
has body: I have a table in a database which contains folders/files. Each folder can contain several files and folders which can contain more folder etc. My table has 3 important attributes. id parentid name Now what I am trying to do is get the full path of a file/folder when I have its id.(the top level folders parentid is null) Problem being the only way I can see of doing this is by doing this while (continue) { "select (parentid) from table where id = (id)" if(parentid equals null) { continue is false; } else { path += "/" + parentid(name); } } sorry for the poor psudo But it will keep geting the parent folder until there isnt anymore and then I can make my path But this seems like a very inefficient way of doing this. Especially if I have to deal with hundreds of thousands of file and i would have to do this for each file/folder. Would there be a simpler more efficient sql query.
has answer: http://stackoverflow.com/a/26122638
tagged with: jdbc
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/40940557
has comment: http://stackoverflow.com/comment/40941015
has comment: http://stackoverflow.com/comment/40946198
has comment: http://stackoverflow.com/comment/40940491
has comment: http://stackoverflow.com/comment/40940784
has comment: http://stackoverflow.com/comment/40941020
has answer: http://stackoverflow.com/a/26122413
tagged with: performance
tagged with: java
answer count: 3
tagged with: mysql
has comment: http://stackoverflow.com/comment/40940855
downvote count: 1
has comment: http://stackoverflow.com/comment/40940753
upvote count: 0

http://stackoverflow.com/a/26173036
type: Answer
score: 2
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/26173012
has body: A valid array index is between 0 and array.length - 1. You don't need an instance of your class so I would make the method static and you should check that the array isn't null and that could be done with something like, static boolean isValidIndex(int[] array, int index) { return array != null &amp;&amp; index &gt;= 0 &amp;&amp; index &lt; array.length; }

http://stackoverflow.com/q/26092808
has comment: http://stackoverflow.com/comment/40891790
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: h2
accepted answer: http://stackoverflow.com/a/26094825
type: Question
has comment: http://stackoverflow.com/comment/40887991
has comment: http://stackoverflow.com/comment/40889947
has title: H2 data base storage Capacity
answer count: 1
downvote count: 0
has body: I have a small question about storing data on a h2data database. How many records in an h2data database can we maximally store? Is there any limitation? If the data goes beyond this limitation what type of error does it give? Will the whole the system fail, or what else happens? thank u
has answer: http://stackoverflow.com/a/26094825
favorite count: 0

http://stackoverflow.com/comment/41011246
has text: Show us what have you done so far and tell us what are the specific problems you're having with your current implementation. Read carefully the http://stackoverflow.com/tour
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26160364
score: 0

http://stackoverflow.com/comment/41017790
comment on: http://stackoverflow.com/q/26161398
score: 0
type: QuestionComment
has text: So maybe try from C:\jars\ folder.
type: Comment

http://stackoverflow.com/comment/40890869
has text: You seem to be discussing whether log4j is the right logging mechanism, whereas the question asks: should logging happen at all.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26093981
type: Comment

http://stackoverflow.com/comment/41068198
type: Comment
comment on: http://stackoverflow.com/q/26190395
score: 0
has text: Without an error log it would be hard to guess... One remark though: data.getData() in onActivityResult will give you a thumbnail, if you want the 'real' image you should use the 'fileUri' path you passed to the camera directly.
type: QuestionComment

http://stackoverflow.com/a/26117398
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40932404
has body: or you should use String Contains String test="demo string"; System.out.println(test.contains("demo")); This will then return true or false If you dont care about case you will have to do System.out.println(test.toLowerCase().contains(new String("demo").toLowerCase())); contains is case sensitive It wont do any fancy regex though just a simple check for comparison Edit String str = new String("demo"); if (test.toLowerCase().contains(str.toLowerCase())) { System.out.println(str); }
has comment: http://stackoverflow.com/comment/40933395
answers question: http://stackoverflow.com/q/26117230
downvote count: 0

http://stackoverflow.com/a/26062989
type: Answer
answers question: http://stackoverflow.com/q/26062922
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40833018
has body: Simply: day = key.nextInt(); int dayAbs = Math.abs(day); // to handle negatives if(dayAbs &gt;= 10 &amp;&amp; dayAbs &lt;= 99) { // ... }
upvote count: 1

http://stackoverflow.com/q/26044995
has body: Does anyone know an easy way to load java classes from maven project in a Clojure REPL? I took a look at the lein docs and they don't seem to support maven. The clojure-maven-plugin provides a clojure:repl target, but it seems to just load the project's dependencies, not the classes in my src/main/java. Ideally I wouldn't be willing to setup a lein project only for this task, since I just want to play around with some java classes I have on my project. Anyone?
tagged with: clojure-maven-plugin
has title: How to load java classes from maven project in a Clojure REPL?
tagged with: clojure
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26045485
tagged with: maven
type: Question
possible better answer: http://stackoverflow.com/a/26079027
has answer: http://stackoverflow.com/a/26079027
tagged with: java
has answer: http://stackoverflow.com/a/26045485
tagged with: leiningen
upvote count: 2
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/40874150
has text: `for (int i = 1; i <= 1 ; i++)`? What's the point of doing a loop with just one iteration? What are you trying to do?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26085454

http://stackoverflow.com/a/26116126
has body: Shortcut is cntrl+shift+R You can also customize shortcut keys for that
score: -1
answers question: http://stackoverflow.com/q/26116028
type: Answer
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/51120589
has comment: http://stackoverflow.com/comment/40929598

http://stackoverflow.com/comment/40804902
score: 3
has text: fix your indentation please.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26047555

http://stackoverflow.com/comment/40955139
has text: You can also use `Collections.synchronizedMap(map)`.
score: 0
comment on: http://stackoverflow.com/q/26128548
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26058192
possible better answer: http://stackoverflow.com/a/26060020
downvote count: 1
type: Question
has body: I am able to make maven project using command line but when I am trying to make it from eclipse it shows me following error: I switched my workspace and also added maven in path variable but still getting same. please guide me what should I do to create maven project directly from eclipse.
accepted answer: http://stackoverflow.com/a/26062918
score: -1
has answer: http://stackoverflow.com/a/26060020
tagged with: eclipse
has title: Maven: unable to create project from archetype
answer count: 2
has answer: http://stackoverflow.com/a/26062918
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40824910
tagged with: maven
has comment: http://stackoverflow.com/comment/40823970
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40899290
has text: Can't you use `getElementsByClass` as you did before?
comment on: http://stackoverflow.com/q/26099144
score: 0
type: Comment
type: QuestionComment

jitsi
type: Tag
tag name: jitsi
tags question: http://stackoverflow.com/q/26133676

http://stackoverflow.com/comment/40923968
type: QuestionComment
has text: RajaReddy PolamReddy: it's display.setText(data[index]);
comment on: http://stackoverflow.com/q/26112812
score: 0
type: Comment

http://stackoverflow.com/comment/41037169
has text: try changing the colon to a semi colon
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/26123168
type: Comment

http://stackoverflow.com/comment/41070864
score: 0
comment on: http://stackoverflow.com/q/26192209
type: Comment
type: QuestionComment
has text: @KeanAllen: also, writing in ALL CAPS is the equivalent of shouting. Don't do that.

http://stackoverflow.com/q/26159220
downvote count: 0
has body: suppose with the following code, does JVM always create instance of Object class, since Object is parent for all the classes the in Java. class MyTestclass{ void printMe(String name){ System.out.println('I am '+name); } public static void main(String args[]){ MyTestclass obj = new MyTestclass(); obj.printMe("stackOverFlow.com"); } } Another class say TestClass2 class TestClass2{ void printMe(String name){ System.out.println('I am '+name); } public static void main(String args[]){ MyTestclass obj = new MyTestclass(); TestClass2 obj2 = new TestClass2(); obj.printMe("stackOverFlow.com"); obj2.printMe("stackOverFlow.com"); } } Will JVM creates two object instances if i run these two classes?
answer count: 3
has comment: http://stackoverflow.com/comment/41010071
has answer: http://stackoverflow.com/a/26159244
tagged with: jvm
favorite count: 0
has title: Will JVM always create instance of Object class
tagged with: classloader
has answer: http://stackoverflow.com/a/26159280
possible better answer: http://stackoverflow.com/a/26159365
upvote count: 1
has answer: http://stackoverflow.com/a/26159365
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26159280

http://stackoverflow.com/comment/41055405
score: 0
type: Comment
has text: Im missing something i cannot quite understand what you want to do. Do you want the alternate keys to me removed ?
type: QuestionComment
comment on: http://stackoverflow.com/q/26183932

http://stackoverflow.com/q/26173966
upvote count: 2
tagged with: java
downvote count: 2
type: Question
has title: Invalid Character Constant in Java?
has answer: http://stackoverflow.com/a/26173983
has comment: http://stackoverflow.com/comment/41037084
answer count: 6
has answer: http://stackoverflow.com/a/54724221
score: 0
has comment: http://stackoverflow.com/comment/41036801
has answer: http://stackoverflow.com/a/26174077
favorite count: 0
has answer: http://stackoverflow.com/a/26174072
type: UnansweredQuestion
has body: Here is my code: import java.util.Scanner; import javax.swing.JOptionPane; import java.text.DecimalFormat; /* Medium Speed Air 1100 feet per second Water 4900 feet per second Steel 16,400 feet per second Write a program that asks the user to enter "air", "water", or "steel", and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time = Distance / 1100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time = Distance / 4900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time = Distance / 16400 */ public class SpeedOfSound { public static void main(String[] args) { String input; char timeTraveled; Scanner keyboard = new Scanner(System.in); double distance; double time; double time2; double time3; time = (distance/ 1100); time2 = (distance/ 4900); time3 = (distance/ 16400); DecimalFormat formatter = new DecimalFormat("#0.00"); System.out.println("Enter air, water, or steel: "); input = keyboard.nextLine(); System.out.print("Enter distance: "); distance = keyboard.nextDouble(); switch(timeTraveled) { case 'air': System.out.printf("The total time traveled is " + formatter.format(time) + "."); break; case "water": System.out.printf("The total time traveled is " + formatter.format(time2) + "."); break; case "steel": System.out.printf("The total time traveled is " + formatter.format(time3) + "seconds."); timeTraveled = input.charAt(0); break; keyboard.close(); } } // main() } // class SpeedOfSound Why is case 'air': giving me the error invalid character constant twice? My professor has a different example for a different program and it's almost the same as what I'm doing but he doesn't get the error. Why do I get this error?
has answer: http://stackoverflow.com/a/26173992
has answer: http://stackoverflow.com/a/26174006

http://stackoverflow.com/comment/106917314
has text: why would you offer python solution for a Java question?
comment on: http://stackoverflow.com/a/60437231
type: Comment
score: 5
type: AnswerComment

http://stackoverflow.com/q/26096170
score: 1
tagged with: java
tagged with: date
tagged with: class
answer count: 3
has body: I'm trying to build class project that include (startDate_) and (endDate_) as instance variables. the problem that i have store the date in int type. Is there better way to do it ? if so, how i can use them in the constructor and setter and getter ?. which library i should include in this class ? public class Project { private int pid_; private String name_; private int statDate_; private int endDate_; public Project(int pid, String name, int statDate, int endDate) { pid_ = pid; name_ = name; statDate_ = statDate; endDate_ = endDate; } // getter public int getPid(){ return this.pid_; } public int getName(){ return this.name_; } public int getStatDate(){ return this.statDate_; } public int getendDate(){ return this.endDate_; } // setter public void setPid(int Pid){ this.pid_ = Pid; } public void setName(String Name){ this.name_ = Name; } public void setStatDate(int StatDate){ this.statDate_ = StatDate; } public void setEndDate(int EndDate){ this.endDate_ = EndDate; } // methods private void updateTask(String Name){ if (Name != null) this.name_ = Name; }
downvote count: 0
has comment: http://stackoverflow.com/comment/40894007
has answer: http://stackoverflow.com/a/26096885
favorite count: 0
tagged with: getter-setter
has title: Store date in class
tagged with: constructor
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26096612
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26096228

http://stackoverflow.com/q/26055075
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40818126
has comment: http://stackoverflow.com/comment/40820155
has comment: http://stackoverflow.com/comment/40818293
linked to: http://stackoverflow.com/q/5069539
tagged with: extends
has body: i want to compile child.java class an get child.class, child class extends parent class. i want child.class include all necessary code from parent class, in fact i can use it independently. is it possible? second Question: suppose we have a .jar library containing a.class , b.class , c.class ... i have make an updated version of a.class, how can i replace the new one with the original a.class in jar? is it possible ? sorry for bad English.
has title: how to compile extended class in java?
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26055255

http://stackoverflow.com/comment/40945045
has text: @jgr208 - Yes. I did. It works on command line but not within Java environment.
score: 0
comment on: http://stackoverflow.com/q/26123706
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26171656
downvote count: 0
linked to: http://stackoverflow.com/q/13351936
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41057120
score: 2
has title: GraphicsDevice isFullScreenSupported() = false, now what?
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41032524
type: Question
tagged with: fullscreen
tagged with: graphics
has comment: http://stackoverflow.com/comment/41063125
has body: I'm facing the problem, that my Linux machine is returning false, when I check, if fullscreen mode is allowed. Is there a way to bypass this? I currently use a nasty workaround, where I turn of all decorations and put the window to maximized both, but I really don't like that, since the gnome specific taskbar is still visible. This Link explained, when it usually returns false, but in my case it's not an Applet, I don't know what a WebStart Application is, so that's probably not my case either I'm not running in headless mode. The answer to this question was, that I have to manage everything on my own, but since it's an older one, I hope this is not the case anymore. Graphics card: GTX-460 768mb msi java -info gave me: java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) I use two different kinds of monitors. EDIT: Here is the problem. The device does not do fullscreen with two (different) monitors 1920x1080 - BenQ GL2450H 1280x1024 - Samsung (Model unknown) Kernel: Linux Main-PC 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Linux Version: Gnome3, Pinguy OS Debian Other full screen applications run just fine. Actually I don't know if this is related, but running an old game (supertux), will not support fullscreen as well.
tagged with: java
has comment: http://stackoverflow.com/comment/41100015
linked to: http://stackoverflow.com/q/8837719

http://stackoverflow.com/a/26132356
answers question: http://stackoverflow.com/q/26132340
has body: It is possible starting in Java 7: http://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html
score: 4
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40879039
score: 1
type: QuestionComment
type: Comment
has text: OK. Let me put that another way. It's clear to you, but is it clear to anyone else? Adding an MCVE & an explicit question will help make it clear to others. As it is, I voted to close for lack of an MCVE.
comment on: http://stackoverflow.com/q/26087917

http://stackoverflow.com/q/26090567
has answer: http://stackoverflow.com/a/26090622
tagged with: c#
type: AnsweredQuestion
tagged with: call
tagged with: oop
has answer: http://stackoverflow.com/a/33443797
tagged with: java
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/33443797
answer count: 3
score: 0
has title: Calling a function 2 or more degrees below
has answer: http://stackoverflow.com/a/26090626
has body: I'm sure this is a classic case in OOP and the answer will be straightforward for most programmers, but I don't seem to find the explanation anywhere. Suppose I have a method belonging to a class A instantiated in a class B, like in the following code : class A { public void foo() {/*do something*/} } class B { public A objectA; public B() { objectA = new A(); } public void call() { objectA.foo(); } } Suppose now that I have a third class C that instantiates class B (which in turn instantiates class A with the code above) : class C { public C() { objectB = new B(); } } What is the best way to call function foo() from class C (if any): objectB.call(); or else objectB.objectA.foo(); I feel that the first option might be the right answer in terms of modularity, but it seems redundant if the class B never has to call foo(). Is there a good answer here or is this whole pattern inherently flawed ? And if it is, what design principle does it violate and what are the workarounds?
possible better answer: http://stackoverflow.com/a/26090626

http://stackoverflow.com/q/26103909
has comment: http://stackoverflow.com/comment/40907729
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/4529055
favorite count: 0
accepted answer: http://stackoverflow.com/a/26104238
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40908245
has title: Simple Java library for graphing mathematical functions/equations
has comment: http://stackoverflow.com/comment/40908344
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40908317
upvote count: 1
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/40907801
has comment: http://stackoverflow.com/comment/40942811
has comment: http://stackoverflow.com/comment/40908458
has body: I'm looking (have looked on Google, no luck) for a Java library that can produce graphs of mathematical functions and equations. It would be great if I could us it as a JComponent for adding to frames, but I can do without. If there aren't any good ones I'll probably make one anyway. Thanks in advance
tagged with: math
has answer: http://stackoverflow.com/a/26104238
has comment: http://stackoverflow.com/comment/40907832

http://stackoverflow.com/a/26191218
type: Answer
accepted answer of: http://stackoverflow.com/q/26190960
upvote count: 3
has comment: http://stackoverflow.com/comment/41070971
score: 3
has comment: http://stackoverflow.com/comment/41084236
has body: I want to ask what wrong is my code? There's nothing inherently wrong with your code. The short answer is that you're running into a Java-specific quirk. Bear with me: The source code for the ArrayAdapter constructor you're invoking looks like this: public ArrayAdapter(Context context, int textViewResourceId, T[] objects) { init(context, textViewResourceId, 0, Arrays.asList(objects)); } Not what happens to the last parameter, the array you supply: it is 'converted' into an ArrayList by calling Arrays.asList(objects). Now, the answer can actually be found by looking at the documentation for this method call: Returns a List of the objects in the specified array. The size of the List cannot be modified, i.e. adding and removing are unsupported, but the elements can be set. Setting an element modifies the underlying array. Basically what happens is that the array you pass in is converted into a fixed-size list (if you breakpoint your code at runtime, you should see an UnmodifiableCollection instance - note: different from immutable). You can't add or remove any items, but only set items (which doesn't change the list size as it replaces an existing item), although the latter operation is not exposed by the ArrayAdapter class by default. The easiest solution is to call the equivalent ArrayAdapter constructor that takes an ArrayList instead of an array yourself: public ArrayAdapter(Context context, int resource, List&lt;T&gt; objects) This would require some minor changes to your current code, but arrays and list are very similar to work with. Also, remember to implement the ViewHolder/RowWrapper pattern in your adapter - plenty of examples out there. Finally, there's not really any benefit to storing the titles &amp; description into separate arrays, and it's kind of in contradiction to the idea of object-oriented programming and encapsulation. Just let the object 'own' those properties and use the getter methods to access them. //edit: Here's some example code that illu…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41071553
answers question: http://stackoverflow.com/q/26190960

http://stackoverflow.com/comment/40811707
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26051301
has text: you are missing closing } in your compareTo method

http://stackoverflow.com/q/26111350
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/40921439
tagged with: database
has comment: http://stackoverflow.com/comment/40942814
has title: Connecting to database with GWT after compiling
score: 0
has body: I am having trouble connecting to a database after compiling the GWT. I am using Eclipse for the development. The server is setup at //database.corp.company.com I have set up my onModuleLoad like this: public void onModuleLoad() { if (databaseService == null) { databaseService = GWT.create(DatabaseService.class); } AsyncCallback&lt;String&gt; callback = new AsyncCallback&lt;String&gt;() { public void onFailure(Throwable caught) { Window.alert("Error: " + caught.getMessage()); } public void onSuccess(String s) { Window.alert("Success: " + s); } }; databaseService.getProblems(callback); } I have set up the Service and the Async and then here is the code for the impl: @Override public String getProblems() { StringBuilder builder = new StringBuilder(); builder.append("Starting; "); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection(HOST, USERNAME, PASSWORD); builder.append("\nConnected!"); } catch (SQLException e) { builder.append("\nError SQLException: " + e.getMessage() + "; "); } catch (InstantiationException e) { builder.append("\nError InstantiationException: " + e.getMessage() + "; "); } catch (IllegalAccessException e) { builder.append("\nError IllegalAccessException: " + e.getMessage() + "; "); } catch (ClassNotFoundException e) { builder.append("\nError ClassNotFoundException: " + e.getMessage() + "; "); } catch (Exception e) { builder.append("\nError OtherException: " + e.getMessage() + "; "); } return builder.toString(); } When I run the code through Eclipse in development mode. It works and it able to connect and get the message: Success: Starting; Connected! When I compile the code using GWT Complile and then trying launching the html out of the "war" folder I just get Error: 0 This means that the caught.getMessage() is just "0". Why would is work through dev mode, but not once compiled.

http://stackoverflow.com/comment/41005134
has text: 180MB for the raw file + 3 million x (8 bytes obj header + 6 x 4 byte floats) for the objects + (12 byte array header + 3 mil x 8 byte pointer) for the arrays to hold all objects = 180 + 114 MB = ~300MB for the whole thing. guess i dont know either.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26156411

http://stackoverflow.com/comment/41040212
type: QuestionComment
has text: missed to mention that I still face this, but gave up since stopping server from console serves the purpose..
comment on: http://stackoverflow.com/q/26175736
score: 0
type: Comment

http://stackoverflow.com/comment/50573830
has text: For those interested, I finally got it working by using `org.apache.xpath.XPathAPI` instead of `org.w3c.dom.xpath.XPathEvaluator` in an alternative but similar implementation. Cheers
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26114760

http://stackoverflow.com/a/26059121
has comment: http://stackoverflow.com/comment/40888544
has body: a) if you want to stick to the hash-code use something like SELECT sha256(CONCAT(col1, "-", col2, "-", col3)) FROM ... instead of MD5() - I had some collisions here recently. Dont forget to add an index on the new column. b) For your purpose a simple SELECT col1, col2, col3, Count(*) FROM table GROUP BY 1,2,3 HAVING Count(*) &gt; 1 might be what you want. This will give you 100% duplicates as well and you dont have to add a new hash-col and check for it...
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26057177
score: 2
answers question: http://stackoverflow.com/q/26057177
upvote count: 2
has comment: http://stackoverflow.com/comment/40899413

http://stackoverflow.com/q/26151364
has comment: http://stackoverflow.com/comment/41068327
tagged with: java
has comment: http://stackoverflow.com/comment/41037237
tagged with: jcr
type: Question
tagged with: magnolia
has answer: http://stackoverflow.com/a/26219649
accepted answer: http://stackoverflow.com/a/26219649
has comment: http://stackoverflow.com/comment/41161734
has title: CPU Load Issue (Magnolia-5.3.3 Jackrabbit-2.8.0)
tagged with: jackrabbit
score: 0
has comment: http://stackoverflow.com/comment/41068347
answer count: 1
favorite count: 0
tagged with: jelastic
upvote count: 1
downvote count: 1
has body: Project use DAM as storage of many mp3 for licensing (plan more then 750Gb) We upload mp3 and metadata by Rest. Server: CPU 2 GHz, mem 1.2 Gb available for java 64bit 1.7.0_51-b13 (jelastic), DB - MySQL We upload 30 Gb of mp3. After that suddenly magnolia loads all CPU resource - 100%. Anything errors or warnings about it are in logs. Magnolia works but very slow. Restart don't helped. May be after repair all workspace repositories server started and worked - I don't sure. DAM workspace loaded more then 1.5 hour at first time and more then 5-10 or 30 min next. But after uploading next 20 Gb we have got the same troubles. Repair of repositories don't helped. For repair repositories changed in each workspace.xml next param: &lt;PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager"&gt; .... &lt;param name="consistencyCheck" value="true" /&gt; &lt;param name="consistencyFix" value="true" /&gt; &lt;/PersistenceManager&gt; &lt;SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex"&gt; ... &lt;param name="forceConsistencyCheck" value="true"/&gt; &lt;param name="autoRepair" value="true"/&gt; &lt;param name="onWorkspaceInconsistency" value="log"/&gt;
type: AnsweredQuestion

http://stackoverflow.com/comment/40865033
has text: It's gonna be tricky. Both JTrees and JLists work using a Component Renderer. This renderer is used to draw list / tree elements, but isn't actually added to the GUI, so event capture / element selection would need to be customized in your situation
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26080383
score: 1

http://stackoverflow.com/q/26084412
type: Question
has body: I have an input files as follows: conf/iastedCSN/KangHPLNL06 Quoc V. Phung conf/iastedCSN/KangHPLNL06 Kungmeng Lo conf/iastedCSN/KangHPLNL06 Hoang Nam Nguyen conf/iastedCSN/KangHPLNL06 M. M. Lee series/sci/ZighedAB13 Djamel Abdelkader Zighed series/sci/ZighedAB13 Rafik Abdesselam series/sci/ZighedAB13 Ahmed Bounekkar series/sci/LermanG13 Isra챘l-C챕sar Lerman And I want to the output with delimiter as follows: conf/iastedCSN/KangHPLNL06 | QuocV.Phung conf/iastedCSN/KangHPLNL06 | KungmengLo conf/iastedCSN/KangHPLNL06 | HoangNamNguyen conf/iastedCSN/KangHPLNL06 | M.M.Lee series/sci/ZighedAB13 | DjamelAbdelkaderZighed series/sci/ZighedAB13 | RafikAbdesselam series/sci/ZighedAB13 | AhmedBounekkar series/sci/LermanG13 | Isra챘l-C챕sarLerman However for now, I got lots of lines duplicated in the result and I could not seem to find out why. The output I got as follows: conf/iastedCSN/KangHPLNL06 | QuocV.Phung conf/iastedCSN/KangHPLNL06 | KungmengLo conf/iastedCSN/KangHPLNL06 | HoangNamNguyen conf/iastedCSN/KangHPLNL06 | M.M.Lee conf/iastedCSN/KangHPLNL06 | M.M.Lee series/sci/ZighedAB13 | DjamelAbdelkaderZighed conf/iastedCSN/KangHPLNL06 | M.M.Lee series/sci/ZighedAB13 | RafikAbdesselam conf/iastedCSN/KangHPLNL06 | M.M.Lee series/sci/ZighedAB13 | AhmedBounekkar conf/iastedCSN/KangHPLNL06 | M.M.Lee series/sci/LermanG13 | Isra챘l-C챕sarLerman series/sci/ZighedAB13 | AhmedBounekkar Below is the source code: package authorgraph; import java.io.*; import java.util.*; public class graph { private static BufferedReader br; public static void main(String[] args) { try{ br = new BufferedReader (new FileReader ("inproceedings-author-test1.txt")); Map&lt;String, String&gt; items = new TreeMap&lt;String, String&gt;(); String line; while (null != (line = br.readLine())) { String[] line_parts = line.split(" "); if (line_parts.length &gt; 1) { StringBuilder name = new StringBuilder(line_parts[1]); for (int i = 2; i &lt; line_parts.length; i++) { name.append(line_parts[i]); } items.put(new Strin…
tagged with: arrays
score: 0
accepted answer: http://stackoverflow.com/a/26084441
tagged with: file-structure
answer count: 1
tagged with: string
has title: Reading lines from text file in Java and splitting the content
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26084441

http://stackoverflow.com/a/26035109
accepted answer of: http://stackoverflow.com/q/26034527
type: Answer
answers question: http://stackoverflow.com/q/26034527
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40784712
type: AcceptedAnswer
downvote count: 0
has body: I take it you are using Action for your actions. Call setActionDefinitionId("command id"); in your Action constructor to specify a command that this action handles. Declare the command in your plugin.xml using the org.eclipse.ui.commands extension point. Use the org.eclipse.ui.bindings extension point to bind a key sequence to the command.
has comment: http://stackoverflow.com/comment/40880616

http://stackoverflow.com/comment/53618282
type: Comment
comment on: http://stackoverflow.com/a/26104128
type: AnswerComment
has text: @SudiptoChandra if you use an IDE and a recent enough version of Java (in this case after Java 5), you don't need to manually import anything - just let the IDE do it for you. E.g. in Eclipse, Ctrl-Shift-O.
score: 0

http://stackoverflow.com/comment/41038076
has text: remove `src/main/resources` from the path that basically is the root of your classpath. So use `classpath:spring-config.xml`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26174649
type: QuestionComment

http://stackoverflow.com/comment/40785881
comment on: http://stackoverflow.com/a/26036308
score: 0
type: Comment
has text: Please let me know what are other things so may be I can make it even better. Thanks
type: AnswerComment

http://stackoverflow.com/a/26098849
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40899425
has comment: http://stackoverflow.com/comment/40898484
has body: Signature of main method in Java The main method has to strictly follow its syntax; otherwise the JVM will not be able to locate it and your program will not run. Here is the exact signature of main method: public static void main(String args[]) If a program does not have this signature then the JVM will not able to find main method. In this signature .......... public defines that this method is accessible out of class, static shows that this method is accessible without creating any object of class, void shows that this method will not return any value, String args defines no. of argument is passed by user. If the above signature does not match the JVM will return main method not found exception.
upvote count: 1
answers question: http://stackoverflow.com/q/26098372
score: 1

http://stackoverflow.com/comment/40934225
type: Comment
comment on: http://stackoverflow.com/a/26118761
score: 0
has text: Thanks. im looking for this.
type: AnswerComment

http://stackoverflow.com/q/26116270
has comment: http://stackoverflow.com/comment/43007704
has comment: http://stackoverflow.com/comment/42967285
favorite count: 0
type: UnansweredQuestion
has title: Maven Assembly Plugin - Include classes from another module
tagged with: maven-assembly-plugin
tagged with: maven
has body: I have a multimodule project and am trying to generate an assembled file in SubProject2 that includes some of its classes plus some DTOs defined in SubProject1. However, Proc.jar file only has Proc.class and com\myproy\spr\dto*.class, whereas SubProject1's files (com\myproy\dto*.class) are not included and cannot come up with a way to make it work. Projects' layout: Parent |-pom.xml | SubProject1 |-pom.xml |-src\main\java\com\myproy\dto |-src\main\java\com\myproy\util | SubProject2 |-pom.xml |-src\assembly\def.xml |-src\main\java\com\myproy\spr |-src\main\java\com\myproy\spr\dto def.xml: Proc jar false target/classes com/myproy/spr/Proc.class com/myproy/spr/dto/*.class com/myproy/dto/*.class / SubProject2->pom.xml maven-assembly-plugin 2.4.1 distro-assembly package single src/assembly/def.xml
has answer: http://stackoverflow.com/a/26116665
tagged with: java
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/26118274
downvote count: 0
score: 4

http://stackoverflow.com/comment/66431975
type: AnswerComment
comment on: http://stackoverflow.com/a/39559438
type: Comment
score: 1
has text: Sorry, but the question is about Java, so C# code is definitely off-topic here.

http://stackoverflow.com/q/26193772
favorite count: 0
has comment: http://stackoverflow.com/comment/41073454
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41073010
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/26193864
has comment: http://stackoverflow.com/comment/41072995
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41072977
upvote count: 0
has title: program to remove vowels from a user input and diplay the remaining alphabets in alphabetic order in java
possible better answer: http://stackoverflow.com/a/26193976
downvote count: 4
has answer: http://stackoverflow.com/a/26193976
accepted answer: http://stackoverflow.com/a/26193864
has body: Please help me with the full code modified by someone again. I have tried, but error is coming as StringIndexOutOfBoundsException. I am able to enter just the input from the user. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class RemoveVowels{ public static void main(String []args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Sample Program to Remove Vowels"); System.out.println("from a given string \n"); System.out.println("Enter a words : "); String s = in.readLine(); System.out.println("\n" + "String with Vowels removed : "); String r = removeVowels(s); System.out.println(r); } private static String removeVowels(String s) { String finalString = ""; for(int i = 0; i &lt; s.length(); i++) { if(!isVowel(Character.toLowerCase(s.charAt(i)))) { finalString = finalString + s.charAt(i); } } return finalString; } private static boolean isVowel(char c) { String vowels = "aeiou"; for(int i = 0; i &lt; 5; i++) { if(c == vowels.charAt(i)) return true; } return false; } }

http://stackoverflow.com/comment/50440270
type: Comment
has text: It's very good that you provide an example project, but GitHub projects vanish all the time. If it does, your answer won't be useful anymore. That's why I said that posts should be self-contained. You can always provide external resources for reference, but StackOverflow posts should contain some content.
comment on: http://stackoverflow.com/a/31219539
score: 2
type: AnswerComment

http://stackoverflow.com/q/26073292
tagged with: google-glass
answer count: 1
has answer: http://stackoverflow.com/a/26116342
favorite count: 0
tagged with: android
has body: I want to do a google glass application that can recognize the words said by others to you. I tries to use the same Android code for voice recognition @Override public void onClick(View v) { Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US"); try { startActivityForResult(i, REQUEST_OK); } catch (Exception e) { Toast.makeText(this, "Error initializing speech to text engine.", Toast.LENGTH_LONG).show(); } } This didn't work because, this code recognizes only the speech the person putting the glass on his head is saying. I need my application to also recognize the voice of others talks to me. Anyone could help please? Thanks
upvote count: 1
tagged with: android-intent
tagged with: voice-recognition
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26116342
has title: Google glass voice recognition
type: Question
downvote count: 0

http://stackoverflow.com/comment/41004160
score: 2
comment on: http://stackoverflow.com/q/26149711
type: Comment
has text: I'm confused. It sounds like the wars you are trying to run are not using Spring Boot. Assuming that is correct, why are you trying to use Spring Boot to run them? I may well have misunderstood. Could you expand a bit on what you're trying to achieve and why you think Spring Boot will help you to achieve it?
type: QuestionComment

http://stackoverflow.com/comment/40804637
comment on: http://stackoverflow.com/q/26045472
has text: Never heard of it before, i'll look into it thanks
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26152764
tagged with: java
score: 0
tagged with: mongodb
has body: I am trying to compare and contrast MongoDB vs Cassandra. Our project is Java based. Some of the differences i found out are Cassandra is highly available and partition supportive vs MongoDb is consistent and highly available(not so good with partitions). MongoDb is document based.Cassandra gives more flexibility in terms of modelling the data and also storing JSON like structures directly into it. But another difference someone told me is that Cassandra is Java stack based while MongoDB is Javascript based. From a third party users(developers) perspective, how does the stack matter? Considering that i work on a Java project, would a product build on Java stack provide me additional benefits? If so what are those?
answer count: 1
tagged with: javascript
tagged with: cassandra
has comment: http://stackoverflow.com/comment/40997625
has title: Cassandra on Java stack vs Mongo Db on JavaScript stack
has answer: http://stackoverflow.com/a/26153062
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26153062
type: Question
has comment: http://stackoverflow.com/comment/40997329

http://stackoverflow.com/comment/41051463
type: Comment
has text: And in run() method i need to make something like Thread.SLeep(val) before initReminder()? Am i right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26181821

http://stackoverflow.com/comment/40788904
comment on: http://stackoverflow.com/q/26039111
score: 0
type: Comment
has text: os.flush() - method flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.
type: QuestionComment

http://stackoverflow.com/q/26122975
has answer: http://stackoverflow.com/a/26123019
type: Question
has answer: http://stackoverflow.com/a/26123093
tagged with: arrays
has comment: http://stackoverflow.com/comment/40942159
has body: There must be a way to shorthandcode this. I use it all the time and its not beautiful at all. ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); items.add( "Foo" ); items.add( "Bar" ); String zxc; I know this exist for( String s : items ) { zxc = s; } But when using indexes there must be a way to shorthand this for( int i = 0; i &lt; items.size(); i++ ) { zxc = items.get( i ); }
tagged with: shorthand
upvote count: 2
score: 0
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/40942085
has comment: http://stackoverflow.com/comment/40942065
has answer: http://stackoverflow.com/a/26123092
favorite count: 0
type: UnansweredQuestion
has title: Java: String.length() > 0 and Array.size() > 0 shorthand?
has comment: http://stackoverflow.com/comment/40942955
tagged with: java
has comment: http://stackoverflow.com/comment/40942665

http://stackoverflow.com/comment/41032233
type: AnswerComment
score: 0
has text: I have no idea where you get that text from. What documentation do you refer to? Can you provide a link?
type: Comment
comment on: http://stackoverflow.com/a/26170789

http://stackoverflow.com/a/26056875
type: Answer
has comment: http://stackoverflow.com/comment/40834425
accepted answer of: http://stackoverflow.com/q/26055187
upvote count: 2
answers question: http://stackoverflow.com/q/26055187
score: 2
has body: This code can help you to set row height of your table . table.setRowHeight(anInteger); In addition you know that with this code you can have your pleasant height of your jtabel: int scrollPaneHeight = scrollPane.getHeight(); So you want every row has this height : int spaceForRows = scrollPaneHeight -heightOfheaderOfTabel; float rowH =(float) spaceForRows / (rowData.length ); But as you know when you re-size your jframe and consequently your scrollPane and your table can not be full screen twice. So you most use a componentListener . So when your component is re-sizing your code calculate rowH twice. complete code is public static void main(String[] args) { // TODO Auto-generated method stub final JFrame frame = new JFrame(); final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); frame.setContentPane(tabbedPane); final Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "", "", "", "", "" }, { "Row1-Column1", "Row1-Column2", "", "", "", "", "" }, { "Row1-Column1", "Row1-Column2", "", "", "", "", "" }, { "Row1-Column1", "Row1-Column2", "", "", "", "", "" }, { "Row1-Column1", "Row1-Column2", "", "", "", "", "" }, { "Row2-Column1", "Row2-Column2", "Row2-Column3", "", "", "", "", "" } }; Object columnNames[] = { "Column One", "Column Two", "Column Three", "", "", "", "" }; final JTable table = new JTable(rowData, columnNames); final JScrollPane scrollPane = new JScrollPane(table); tabbedPane.addTab("table", null, scrollPane, null); frame.setSize(new Dimension(500, 500)); tabbedPane.addComponentListener(new ComponentListener() { @Override public void componentShown(ComponentEvent arg0) { // TODO Auto-generated method stub } @Override public void componentResized(ComponentEvent arg0) { // TODO Auto-generated method stub int scrollPaneHeight = scrollPane.getHeight(); JTableHeader header = table.getTableHeader(); int heightOfheaderOfTabel = header.getHeight(); int spaceForRows = scrollPaneHeight - heightOfheaderOfTabel; float rowH = (float) spaceForRows / (r…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41075435
type: Comment
has text: Yeah but if I try to reconnect, the server will recieve a new connection request from a DIFFERENT IP. How do I handle that? How can I tell this new IP is the same user from before?
comment on: http://stackoverflow.com/a/26194475
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41007644
comment on: http://stackoverflow.com/q/26137869
has text: If i go to the link, I just have to enter a captcha and it downloads... Here is a different link... http://wikisend.com/download/827766/sunspots.rar
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40955966
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26129806
has text: Also, "Remote" sounds like it might be generated code. Do a clean recompile and see if your changes are still there.
type: Comment

http://stackoverflow.com/comment/40926792
has text: Recreate the user first before invalidating the session, so that when the new session is created, the correct user data is available in the newly created httpsession to be injected to sessionscoped beans
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26114296

http://stackoverflow.com/q/26068809
type: Question
has comment: http://stackoverflow.com/comment/40844217
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/40844253
tagged with: class
has answer: http://stackoverflow.com/a/26068978
tagged with: linux
has comment: http://stackoverflow.com/comment/40844051
tagged with: exception
answer count: 1
accepted answer: http://stackoverflow.com/a/26068978
has title: Java cannot find a class in a .jar file in Linux
favorite count: 0
has body: I built a java program in Eclipse in Windows and it worked well. The program included 5 java classes and 5 jar library files. Then I copied all *.java files and *.jar files to Linux. After I compiled and run it, I got an exception, the class PaserException of htmlparser.jar was not found. Exception in thread "main" java.lang.NoClassDefFoundError: org/htmlparser/util/ParserException Caused by: java.lang.ClassNotFoundException: org.htmlparser.util.ParserException at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) I just begin to learn Linux so I'm not sure if I compiled and run it correctly. All of my files(*.java and *.jar) are in the same directory, and my operation is in this directory. To compile: javac -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar *.java To run:(the main method is in Crawler class, main method requires at lease 1 argument) java -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar Crawler arg0 arg1 Then I got the exception above. Did I compile and run it correctly? Why did I got this exception? Thanks.
has comment: http://stackoverflow.com/comment/40844145
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40844194
score: 1
tagged with: java
upvote count: 1

macos
tags question: http://stackoverflow.com/q/26073572
tags question: http://stackoverflow.com/q/26168443
tags question: http://stackoverflow.com/q/26079473
tags question: http://stackoverflow.com/q/26127729
tags question: http://stackoverflow.com/q/26155742
tags question: http://stackoverflow.com/q/26034683
tags question: http://stackoverflow.com/q/26055552
tags question: http://stackoverflow.com/q/26133765
tags question: http://stackoverflow.com/q/26157334
tags question: http://stackoverflow.com/q/26127403
tags question: http://stackoverflow.com/q/26069315
tags question: http://stackoverflow.com/q/26125841
tags question: http://stackoverflow.com/q/26057685
type: Tag
tags question: http://stackoverflow.com/q/26061726
tags question: http://stackoverflow.com/q/26117089
tags question: http://stackoverflow.com/q/26064642
tag name: macos
tags question: http://stackoverflow.com/q/26154316

http://stackoverflow.com/a/26153799
accepted answer of: http://stackoverflow.com/q/26153696
answers question: http://stackoverflow.com/q/26153696
has comment: http://stackoverflow.com/comment/40999268
type: Answer
has body: So at first you need to understand in JSON you need to access the value from top to bottom, not directly to the key. I guess this will do what you want This is for 2.3 gson library JsonParser jsParser = new JsonParser(); JsonObject jsObject = (JsonObject)jsParser.parse(jsonStr); JsonObject property = jsObject.getAsJsonObject("property"); JsonObject tourist = property.getAsJsonObject("/travel/travel_destination/tourist_attractions"); JsonArray values = tourist.getAsJsonArray("values"); for(int i=0;i&lt;values.size();i++) { JsonObject data = values.get(i).getAsJsonObject(); String text = data.get("text").getAsString(); } I hope my answer is clear enough. If you have any question regarding my answer feel free to ask in the comment :)
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/q/26090063
tagged with: java
has comment: http://stackoverflow.com/comment/40883050
has comment: http://stackoverflow.com/comment/40883484
has comment: http://stackoverflow.com/comment/40883139
has comment: http://stackoverflow.com/comment/40883275
type: Question
has answer: http://stackoverflow.com/a/26090102
has comment: http://stackoverflow.com/comment/40883240
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40884070
tagged with: oop
has comment: http://stackoverflow.com/comment/40882882
has comment: http://stackoverflow.com/comment/40883248
has comment: http://stackoverflow.com/comment/40883506
has body: I want to return an array that is accessible by other objects after having read a text file. My instruction parsing class is: import java.io.*; public class Instruction { public String[] instructionList; public String[] readFile() throws IOException { FileInputStream in = new FileInputStream("directions.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); int n = 5; instructionList = new String[n]; for (int j = 0; j &lt; instructionList.length; j++) { instructionList[j] = br.readLine(); } in.close(); return instructionList; } } The above takes in a text file with 5 lines of text in it. In my main() I want to run that function and have the string array be accessible to other objects. import java.util.Arrays; public class RoverCommand { public static void main(String[] args) throws Exception { Instruction directions = new Instruction(); directions.readFile(); String[] directionsArray; directionsArray = directions.returnsInstructionList(); System.out.println(Arrays.toString(directionsArray)); } } What's the best way to do that? I would need the elements of the array to be integers if they are numbers and strings if they are letters. P.S. I'm brand new to Java. is there a better way to do what I'm doing?
has comment: http://stackoverflow.com/comment/40883122
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40883346
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26090102
has answer: http://stackoverflow.com/a/26090225
has title: How can i return an array in java that is accessible by other objects?
has comment: http://stackoverflow.com/comment/40883079
has answer: http://stackoverflow.com/a/26090236
accepted answer: http://stackoverflow.com/a/26090236
has comment: http://stackoverflow.com/comment/40883445
has comment: http://stackoverflow.com/comment/40883422
has comment: http://stackoverflow.com/comment/40883171

http://stackoverflow.com/comment/41140934
type: AnswerComment
score: 0
has text: Explanation to 1.c:- Yes, what u have said is absolutely right.How fast we have completed crawling a domain depends on depth the crawling. That's y I mentioned that too!!
type: Comment
comment on: http://stackoverflow.com/a/26215190

http://stackoverflow.com/comment/40944572
score: 0
type: AnswerComment
has text: It attaches a name to the Thread running the Timer. IE: Thread.currentThread().getName()
type: Comment
comment on: http://stackoverflow.com/a/26124173

http://stackoverflow.com/comment/40893235
has text: Is it a jSon or what ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26095758
score: 0

http://stackoverflow.com/comment/40930096
score: 0
has text: It's because it says "first" catch clause in the spec.
type: Comment
comment on: http://stackoverflow.com/a/26116183
type: AnswerComment

http://stackoverflow.com/comment/41061893
comment on: http://stackoverflow.com/q/26185728
score: 0
has text: maybe try http://codereview.stackexchange.com/
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26066452
tagged with: jax-rs
accepted answer: http://stackoverflow.com/a/26244346
has comment: http://stackoverflow.com/comment/40987598
has body: I posted questions about this topic twice (here and herehere but never got a satisfying answer, it felt like I could not articulate the question well enough. I have since figured it out but my understanding of it is weak. It was chance that led me to this solution. What I am doing it is generating results on a seperate process spawned by my webserver. As those results are generated I want to use Jersey to stream the bytes to the webserver and eventually that will get passed back to my client (at a later time). I had the hardest time figuring out how to make my data stream from my process back to my webserver. I guessed that using a StreamingOuput type for my Entity would work. There are not examples on the web of this, can anyone explain what is going on in Jersey land. I was stunned that I was able to read the data out on the webserver as an InputStream. Running in my servlet container on the server @PUT @Path("groups/{myUuid:" + Regex.UUID + "}") public void updateSpectraData(@PathParam("myUuid") UUID myUuid, InputStream inputStream) { float[] floatHolder = new float[512]; byte[] bytes = ByteStreams.toByteArray(inputStream); ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); byteBuffer.asFloatBuffer().get(floatHolder); System.out.println(Arrays.toString(floatHolder)); } The code below is running in a separate process spawned by the server. private void doPut(byte[] data, Object ctx) { final Client client = ClientBuilder.newClient(); ObjectMapper objectMapper = new ObjectMapper(); MyTask myTask = objectMapper.readValue(data, MyTask.class); MyConifguration config = getConfig(); WebTarget createTaskTarget = client.target(myTask.getURI()); Builder request = createTaskTarget.request(MediaType.APPLICATION_OCTET_STREAM); request.put(Entity.entity(createData(config), MediaType.APPLICATION_OCTET_STREAM), InputStream.class); } Here is the function which creates the data, the return type is what is important: private StreamingOutput createData(MyConfiguration config) { return n…
linked to: http://stackoverflow.com/q/25922920
tagged with: streaming
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40906895
score: 0
tagged with: java
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/40988387
has title: jax-rs streamingoutput and reading in the data on the server, why does this work?
tagged with: jersey
has comment: http://stackoverflow.com/comment/41166933
has answer: http://stackoverflow.com/a/26244346
answer count: 1

http://stackoverflow.com/comment/92806914
type: Comment
comment on: http://stackoverflow.com/a/46482582
score: 0
type: AnswerComment
has text: ya your correct we also use notifyItemRemoved(position) instated of notifyDataSetChanged()

http://stackoverflow.com/comment/40846547
type: QuestionComment
comment on: http://stackoverflow.com/q/26058903
has text: I'm just tring to do the thing above. When MainProject's button is clicked, a new window with SubProject in it pops up.
score: 0
type: Comment

http://stackoverflow.com/comment/40933337
score: 0
type: Comment
has text: For translation it really makes sense to spend time on the "main dictionary" - collecting all strings, removing double texts, disambiguising (verb or noun, ...), extracting a glossary. This improves quality, consistency, and esp. crucial understandability. It saves money. XML (docbook, xliff, tmx) is ideal. Excel/Word can be painful, but the xlsx, docx are in fact zips with XML; Word being easy to process in java. The best experience was with docbook, XMLSpy as editor, and a table with text, title, tooltip, help text, comment. Using XSLT to extract an XML for the i18n.
type: AnswerComment
comment on: http://stackoverflow.com/a/26105197

http://stackoverflow.com/comment/41017609
comment on: http://stackoverflow.com/a/26148081
type: Comment
has text: My bad, Not used to these type of things. Sorry for the hassle.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41051093
type: AnswerComment
has text: 0.5 is for rounding to int.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26181774

http://stackoverflow.com/comment/40930246
type: AnswerComment
type: Comment
has text: weird.. i thought lambda expressions came with JDK 1.8. - maybe the reason is another jdk version on your other computer?
comment on: http://stackoverflow.com/a/26116381
score: 1

http://stackoverflow.com/comment/41045139
comment on: http://stackoverflow.com/q/26178559
has text: Don't know that it helps, but the difference between the two long values corresponds to three hours' difference.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40942871
has text: Sure, I'm executing each of these by getResultList().
type: Comment
comment on: http://stackoverflow.com/q/26122814
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41071947
type: Comment
comment on: http://stackoverflow.com/a/26192845
score: 0
has text: The approach is right and you don't need a cast there.
type: AnswerComment

http://stackoverflow.com/comment/40824722
type: Comment
type: QuestionComment
has text: Yes I did all the steps but the error is still there
comment on: http://stackoverflow.com/q/26040021
score: 0

http://stackoverflow.com/q/26042532
has answer: http://stackoverflow.com/a/26042862
tagged with: object
linked to: http://stackoverflow.com/q/4288084
has answer: http://stackoverflow.com/a/26042791
has comment: http://stackoverflow.com/comment/40795880
type: UnansweredQuestion
has title: How to convert List<Object> into List<MyClass>?
score: 2
has answer: http://stackoverflow.com/a/26042892
favorite count: 0
has comment: http://stackoverflow.com/comment/40795777
type: Question
has answer: http://stackoverflow.com/a/26042866
has comment: http://stackoverflow.com/comment/40795636
has answer: http://stackoverflow.com/a/26043124
answer count: 6
linked to: http://stackoverflow.com/q/1917844
tagged with: list
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26043202
has comment: http://stackoverflow.com/comment/40795920
tagged with: collections
downvote count: 1
has body: in Java i have one List of Objects from my database and i want to convert this objects into my class objects but i cant find the solution. My List of objects is SalvaguardasAGR and i want to convert this objects to List&lt;AGRSalvaguardasInforme&gt;. I tried with List&lt;AGRSalvaguardasInforme&gt; InformeFinal = new ArrayList&lt;AGRSalvaguardasInforme&gt;(SalvaguardasAGR); as i see in How to cast List&lt;Object&gt; to List&lt;MyClass&gt; and How to Convert List&lt;String&gt; to List&lt;Object&gt; but throw this exception: 25-sep-2014 17:40:47 org.apache.catalina.core.StandardWrapperValve invoke GRAVE: El Servlet.service() para el servlet [procop2front] en el contexto con ruta [/CDNMS] lanzó la excepción [java.lang.Error: Unresolved compilation problem: The constructor ArrayList&lt;AGRSalvaguardasInforme&gt;(List&lt;Object&gt;) is undefined ] con causa raíz java.lang.Error: Unresolved compilation problem: The constructor ArrayList&lt;AGRSalvaguardasInforme&gt;(List&lt;Object&gt;) is undefined at com.dominion.procop.agr.struts.actions.AGRInformes.mostrarInformeActivosAGR(AGRInformes.java:1140) I tried a simple List&lt;AGRSalvaguardasInforme&gt; InformeFinal = (AGRSalvaguardasInforme)SalvaguardasAGR; too but still not working. What im doing wrong? how i can convert a List of objects into a List of AGRSalvaguardasInforme? Thank you in advance.

http://stackoverflow.com/comment/83962905
type: Comment
comment on: http://stackoverflow.com/a/26112036
has text: if firebase failed to authenticate, the thread will never stop. I tested by removing the key in the admin console.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40904087
score: 0
comment on: http://stackoverflow.com/q/26101540
type: QuestionComment
has text: @T.J.Crowder The order of `FOO` and `foo` is not that important, the tricky part is to get both of them in the set, and at the same time `bar` before `FOO`.
type: Comment

named-query
type: Tag
tags question: http://stackoverflow.com/q/26062495
tags question: http://stackoverflow.com/q/26084031
tags question: http://stackoverflow.com/q/26164375
tags question: http://stackoverflow.com/q/26159402
tag name: named-query

http://stackoverflow.com/comment/41044357
score: 1
has text: I don't know kryonet, but I guess you need to ship the classes so that the Server and the Client have the same classes (or the same serial UID). And don't copy source, copy the generated class file. The JVM can't guess which classes you have, but if the JVM can find them it must work
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26178091

http://stackoverflow.com/q/26041012
tagged with: try-with-resources
type: Question
has body: Uscase Suppose we run execution with CompletableFuture.runAsync(..) and in runnable we have try-with-resources block (we are using some resource that should be closed whatever happens), and at some point when execution is not finished in try block we cancel the completable future... altough execution is stopped the resource that should be closed is not closed the close() of AutoClosable is not called... Question Is that a java issue or there is a way to do that properly? without hacky workarounds like using futures (that support interruption etc..), and if its expected behaviour how should one handle similar situation when non interruptable CompletableFuture is canceled...? The Code public class AutoClosableResourceTest { public static class SomeService{ public void connect(){ System.out.println("connect"); } public Integer disconnect(){ System.out.println("disconnect"); return null; } } public static class AutoClosableResource&lt;T&gt; implements AutoCloseable { private final T resource; private final Runnable closeFunction; private AutoClosableResource(T resource, Runnable closeFunction){ this.resource = resource; this.closeFunction = closeFunction; } public T get(){ return resource; } @Override public void close() throws Exception { closeFunction.run(); } } @Test public void testTryWithResource() throws InterruptedException { SomeService service = new SomeService(); CompletableFuture&lt;Void&gt; async = CompletableFuture.runAsync(() -&gt; { try (AutoClosableResource&lt;SomeService&gt; resource = new AutoClosableResource&lt;&gt;(service, service::disconnect)) { resource.get().connect(); while (true) { Thread.sleep(1000); System.out.println("working..."); } } catch (Exception e) { e.printStackTrace(); } }); Thread.sleep(2500); async.cancel(true); Thread.sleep(2500); } } this will produce connect working... working... working... working... as you can see it does not call cancel() and leaves resource opened...
has answer: http://stackoverflow.com/a/52275073
upvote count: 7
has answer: http://stackoverflow.com/a/45399775
has answer: http://stackoverflow.com/a/26041185
favorite count: 0
possible better answer: http://stackoverflow.com/a/26041185
has title: How to release resource in canceled CompletableFuture
downvote count: 0
has answer: http://stackoverflow.com/a/34316509
tagged with: java-8
has answer: http://stackoverflow.com/a/26042293
accepted answer: http://stackoverflow.com/a/26042293
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/57043107
tagged with: java
score: 7
answer count: 6
tagged with: concurrency

http://stackoverflow.com/comment/41072092
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26192812
score: 0
has text: Wow thank you! I love that you gave me hints instead of just doing it, because I know from experience when someone just does it I can study it all I want, but i'll never learn as much as actually doing it

http://stackoverflow.com/a/58446284
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26121499
has body: Try this way: sudo rm /var/lib/dpkg/info/oracle-java8-installer-local.postinst -f sudo dpkg --configure oracle-java8-installer-local

http://stackoverflow.com/comment/89886680
comment on: http://stackoverflow.com/a/26173956
score: 0
type: AnswerComment
type: Comment
has text: Also when doing such `join` you may need to set distinct select `query.distinct(true)`.

http://stackoverflow.com/comment/40902262
has text: I'd also like to check whether the values are not null or whether they meet certain conditions..
comment on: http://stackoverflow.com/q/26100587
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41021799
comment on: http://stackoverflow.com/a/26163068
type: Comment
has text: WOW awesome job. Thanks dear
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41057020
score: 1
type: AnswerComment
has text: You're right, otherItems was never being populated. It does fail if there is data in it, good catch!
comment on: http://stackoverflow.com/a/26184757
type: Comment

http://stackoverflow.com/comment/40836432
score: 2
comment on: http://stackoverflow.com/q/26064109
type: Comment
type: QuestionComment
has text: You can use [`LocalDate`](http://docs.oracle.com/javase/tutorial/datetime/iso/format.html) and [`Period`](http://docs.oracle.com/javase/tutorial/datetime/iso/period.html).

http://stackoverflow.com/a/26178579
has body: loadproperties is just a normal Ant task. It is equivalent to multiple calls to the property task to set properties. You can call it at the beginning of the script, in the middle of a certain target, or anywhere else. Therefore if the properties file is being dynamically filled during the execution and at some point in target targetX you'd like to load it, you would just call the task as usual: &lt;target name="targetX" &gt; &lt;loadproperties srcfile="${pathToFile}" /&gt; &lt;/target&gt; Note that if you already loaded the properties before (at the very beginning of the Ant script), then the second load will not override property values that have been set in the first call to loadproperties (since properties are immutable). If you want to override them, you can use the var task from Ant-Contrib.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26175427
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26175427

http://stackoverflow.com/comment/71262817
type: Comment
comment on: http://stackoverflow.com/a/26118557
type: AnswerComment
has text: I've done this, yet I keep getting errors about ths content type being not supported. Any idea why [this is not working](http://stackoverflow.com/questions/42044639/file-upload-wont-work/42044768#42044768)?
score: 0

http://stackoverflow.com/a/37574919
score: 0
type: Answer
has body: getWebContentLink() is designed for interactive users (browsers). Instead, at the raw API level you'll want to use File.get with alt=Media AND also set the acknowledgeAbuse flag if you initially get returned the 'Google can't scan'. Read more on downloading files here and the abuse flag here. In the Java client library, it'd look something like this: String fileId = "0BwwA4oUTeiV1UVNwOHItT0xfa2M"; OutputStream outputStream = new ByteArrayOutputStream(); driveService.files().get(fileId) .set("acknowledgeAbuse", true) .executeMediaAndDownloadTo(outputStream); Disclaimer, I haven't compiled the above. Note: Do not use the .../host/id method mentioned in the other answer - that method is deprecated and scheduled to stop serving content by end of August, 2016 (this year)
answers question: http://stackoverflow.com/q/26053011

http://stackoverflow.com/a/26193165
score: 0
has body: USER is a PostgreSQL reserved word. Rename the table @Table(name="usertable")
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26193141
accepted answer of: http://stackoverflow.com/q/26193141

http://stackoverflow.com/comment/40858661
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26077072
has text: Where do you expect to see the output and why?

http://stackoverflow.com/q/26081813
type: Question
tagged with: jetty-9
downvote count: 0
answer count: 1
tagged with: url
has answer: http://stackoverflow.com/a/26086096
favorite count: 0
tagged with: jetty
tagged with: web-services
has title: How to customize response Error 400 Bad Request
type: AnsweredQuestion
has body: I have a web service provided by jetty. How can i filter URL with illegal characters? I can not control some return information when the request URL has illegal characters. actually, i want to return some specific info when the URL is invalid. for example: i added a filter in my application to validate the URL, if illegal then i will return defined info. but, I can not filter some URL like "%adsasd", it seem be handled by jetty. curl -v -X PUT -u user:password 'http://myip.com:8080/%adsasd' * Trying 127.0.0.1... * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) * Server auth using Basic with user 'user' &gt; PUT /%adsasd HTTP/1.1 &gt; Authorization: Basic YWRtaW46MTIzNDU2 &gt; User-Agent: curl/7.35.0 &gt; Accept: */* &gt; Host:127.0.0.1:8080 &gt; &lt; HTTP/1.1 400 Bad Request &lt; Content-Length: 0 * Server Jetty(9.0.6.v20130930) is not blacklisted &lt; Server: Jetty(9.0.6.v20130930) &lt; * Connection #0 to host 127.0.0.1 left intact
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26086096
upvote count: 1

http://stackoverflow.com/comment/41068622
score: 0
comment on: http://stackoverflow.com/q/26190889
type: QuestionComment
has text: Great! I reimported the project using the pom.xml and it now shows all the dependencies under the dependencies tab. However, there is still the issue with this R package which I am using. I am importing this: import org.rosuda.REngine.REXPMismatchException; import org.rosuda.REngine.REngineException; And I am unable to import this package. It shows cannot resolve symbol 'rosuda' and hence I am unable to compile the program at all. Do I need to specify the path somewhere?
type: Comment

http://stackoverflow.com/comment/40899852
has text: I think it would be more helpful for the op and further visitors, when you add some explaination to your intension.
type: AnswerComment
comment on: http://stackoverflow.com/a/26099248
score: 0
type: Comment

http://stackoverflow.com/comment/41015894
type: Comment
type: QuestionComment
has text: @NewbieGirl The process you posted is the common method to convert csv to array, but that is not the problem with your code. You are trying to access variables in methods where that variable is out of scope.
comment on: http://stackoverflow.com/q/26162763
score: 0

http://stackoverflow.com/q/26132059
has body: I have this input file: 6 8 ABBEJCDD ULSCALAR FUGLVRUT STOUASTO STOALGOT LALGOSLU 8 SCALA JAVA ALGOS ALGORITHM SLUG SLUR GOES TURTLE Currently, what I have it doing is reading the first two items, which are ints, and adding them to an ArrayList. I then want to read only the next 6 lines up to and not including the "8" and add them to an array. How would I modify my code to do so? Scanner fileScanner = null; File inFile = new File("input.dat"); ArrayList&lt;Integer&gt; rc = new ArrayList&lt;Integer&gt;(); try { fileScanner = new Scanner(inFile); System.out.println("The input has been loaded successfully."); while (fileScanner.hasNextInt()) { int tempRowsCols = fileScanner.nextInt(); rc.add(tempRowsCols); } // end while while (fileScanner.hasNext()) { System.out.print(fileScanner.next()); } } // end try catch (Exception e) { System.out.println("Did not work."); }
has comment: http://stackoverflow.com/comment/40959114
has comment: http://stackoverflow.com/comment/40959198
favorite count: 0
has comment: http://stackoverflow.com/comment/40959042
has answer: http://stackoverflow.com/a/26132162
upvote count: 2
tagged with: io
has comment: http://stackoverflow.com/comment/40959051
tagged with: input
has answer: http://stackoverflow.com/a/26132318
has comment: http://stackoverflow.com/comment/40959165
score: 2
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/40959225
tagged with: java
accepted answer: http://stackoverflow.com/a/26132162
type: Question
has comment: http://stackoverflow.com/comment/40959178
possible better answer: http://stackoverflow.com/a/26132092
has answer: http://stackoverflow.com/a/26132092
tagged with: arrays
has title: How would I get my Java Scanner to read in these strings from this file?
answer count: 3
downvote count: 0

applet
tags question: http://stackoverflow.com/q/26092404
tags question: http://stackoverflow.com/q/26163375
tags question: http://stackoverflow.com/q/26055514
tags question: http://stackoverflow.com/q/26189439
tags question: http://stackoverflow.com/q/26119783
tags question: http://stackoverflow.com/q/26132061
tags question: http://stackoverflow.com/q/26169634
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/26174269
tags question: http://stackoverflow.com/q/26126220
tags question: http://stackoverflow.com/q/26139301
tags question: http://stackoverflow.com/q/26089364
tags question: http://stackoverflow.com/q/26134245
tags question: http://stackoverflow.com/q/26079180
tags question: http://stackoverflow.com/q/26105184

http://stackoverflow.com/a/26172160
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26172131
has comment: http://stackoverflow.com/comment/41033602
has body: You can match the key with the following regex and see whether it returns true: key.matches(".*\\.[A-Z]+");
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41033417
has comment: http://stackoverflow.com/comment/41064084

http://stackoverflow.com/q/26147041
tagged with: http://stackoverflow.com/tag/xml
tagged with: maven
tagged with: xsd
has title: Trying to get the XML element attributes using JIBX
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/30489618
type: Question
tagged with: jibx
has body: I have an XML where some of the elements have attributes. Following is the example; 09/30/2014 <TIME>06:35:00 <PRODUCT/> <PRODUCT/> <PRODUCT/> <PRODUCT/> I have defined the XML Schema Definition as follows: <xsd:element name="RATES" type="RATES_REF" /> <xsd:complexType name="RATES_REF"> <xsd:sequence> <xsd:element name="DATE" type="xsd:string" minOccurs="0" maxOccurs="1"/> <xsd:element name="TIME" type="xsd:string" minOccurs="0" maxOccurs="1"/> <xsd:element name="STATE" type ="STATE_REF" minOccurs="0" maxOccurs="100"> <xsd:complexType> <xsd:attribute name="CODE" type="xsd:string" use="required"></xsd:attribute> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> Please ignore the STATE_REF detail as I feel it is irrelevant to this discussion. Now I am using JIBX to generate the mapping Java objects. I am using Maven and have used a JIBX plugin to generate the Java objects. The generated Java objects are as follows: public class RATESREF { private String DATE; private String TIME; private List<STATEREF> STATEList = new ArrayList<STATEREF>(); //Ignore Getters/Setters } public class STATEREF { private List<PRODUCTREF> PRODUCTList = new ArrayList<PRODUCTREF>(); //Ignore Getters/Setters } My question to you all is why was there no variables created for the State attribute named Code? Thanks Raj
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/30489618

http://stackoverflow.com/comment/40931900
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26117425
has text: It is also displays the lines of not present the given search string.Same as my code.

http://stackoverflow.com/q/26099338
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has title: The function of JPanel
score: 1
tagged with: java
tagged with: jpanel
has body: I am working with Swing, trying to learn how to use it. I am doing an excercise in my book where I am supposed to make buttons (JButtons) like the ones a dvd-player has. I am adding no funcionality to the buttons at this point. The program worked just fine when I first ran it. Then I thought that I would expand it by making a second panel (JPanel) with the same buttons. When I run my code however, I just get one set of buttons (not two areas with two sets of buttons). Have I misunderstood the concept of Panels? I have understood a Panel to be an area (a container) in my frame where I can display different output, and that I can have several panels i one frame. Here is my code: import javax.swing.*; public class Oppgave91 extends JFrame { public Oppgave91() { super ("We make buttons"); setDefaultCloseOperation(EXIT_ON_CLOSE); JButton play = new JButton("Play"); JButton stopeject = new JButton("Stop/Eject"); JButton rewind = new JButton("Rewind"); JButton fastforward = new JButton("FastForward"); JButton pause = new JButton("Pause"); JPanel panel = new JPanel(); panel.add(play); panel.add(stopeject); panel.add(rewind); panel.add(fastforward); panel.add(pause); JPanel panel2 = new JPanel(); panel2.add(play); panel2.add(stopeject); panel2.add(rewind); panel2.add(fastforward); panel2.add(pause); add(panel); add(panel2); setVisible(true); } public static void main(String[] args) { Oppgave91 showbuttons = new Oppgave91(); showbuttons.pack(); } }
type: Question
has answer: http://stackoverflow.com/a/26099692
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26099692

http://stackoverflow.com/q/26079776
score: 0
has comment: http://stackoverflow.com/comment/40864649
answer count: 2
has comment: http://stackoverflow.com/comment/40865108
has comment: http://stackoverflow.com/comment/40864812
has comment: http://stackoverflow.com/comment/40864891
has comment: http://stackoverflow.com/comment/40864716
has answer: http://stackoverflow.com/a/26079898
has comment: http://stackoverflow.com/comment/40864860
has comment: http://stackoverflow.com/comment/40864880
has comment: http://stackoverflow.com/comment/40864859
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40864878
has comment: http://stackoverflow.com/comment/40864937
has comment: http://stackoverflow.com/comment/40864636
has comment: http://stackoverflow.com/comment/40864998
tagged with: java
has comment: http://stackoverflow.com/comment/40864873
has comment: http://stackoverflow.com/comment/40863906
has comment: http://stackoverflow.com/comment/40864866
type: Question
has answer: http://stackoverflow.com/a/26079844
has comment: http://stackoverflow.com/comment/40864847
has title: Get Top 5 Values From Map
has body: I have a map like so Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); This will be populated with a lot of entrys and what i am trying to do is make some kind of Top 5 stats. What i have right now is int maxValueInMap=(Collections.max(map.values())); for (Entry&lt;String, Integer&gt; entry : map.entrySet()) { if (entry.getValue()==maxValueInMap) { name = entry.getKey(); } } Which works great for getting the key/value of the number 1 top highest value in the map but i can't figure out how i can get the top 5 highest and have something like int maxValueInMap=(Collections.max(map.values())); for (Entry&lt;String, Integer&gt; entry : map.entrySet()) { if (entry.getValue()==maxValueInMap) { name = entry.getKey(); name2 = entry.getKey(2ndHighest); //so on } } Would appreciate any help, thank you. EDIT I found this code which works like it want it to do public class Main { public static void main(String[] args) { HashMap&lt;String,Integer&gt; map = new HashMap&lt;String,Integer&gt;(); ValueComparator bvc = new ValueComparator(map); TreeMap&lt;String,Integer&gt; sorted_map = new TreeMap&lt;String,Integer&gt;(bvc); map.put("a",10); map.put("b",6); map.put("c",6); map.put("d",56); map.put("e",54); map.put("f",32); map.put("g",1); System.out.println("unsorted map: "+map); sorted_map.putAll(map); System.out.println("results: "+sorted_map); } } class ValueComparator implements Comparator&lt;String&gt; { Map&lt;String, Integer&gt; base; public ValueComparator(Map&lt;String, Integer&gt; base) { this.base = base; } public int compare(String a, String b) { if (base.get(a) &gt;= base.get(b)) { return -1; } else { return 1; } } } Which prints out unsorted map: {a=10, b=6, c=6, d=56, e=54, f=32, g=1} results: {d=56, e=54, f=32, a=10, c=6, b=6, g=1} But how would i only get the top 5 from the sorted_map rather than all the entrys?
has comment: http://stackoverflow.com/comment/40864841
has comment: http://stackoverflow.com/comment/40863932

http://stackoverflow.com/comment/41256213
comment on: http://stackoverflow.com/a/26237354
type: Comment
has text: @Gas no, type of datasource doesn't matter (I've checked a sec ago to be sure). To be honest... your amount of comments is annoying. Why do not you write a normal answer? If it would be correct, I would vote for it, really.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40830053
score: 0
type: QuestionComment
type: Comment
has text: The problem comes when am using json.
comment on: http://stackoverflow.com/q/26061145

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/26109094
tags question: http://stackoverflow.com/q/26056098

http://stackoverflow.com/a/26106080
has comment: http://stackoverflow.com/comment/40941572
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26105972
answers question: http://stackoverflow.com/q/26105972
has comment: http://stackoverflow.com/comment/40939945
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40912419
has comment: http://stackoverflow.com/comment/40911914
type: Answer
has comment: http://stackoverflow.com/comment/40939593
has body: You are running into the effects of the ObjectOutputStream's attempt to preserve object identity. Repeatedly writing the same object instance will result on the same instance on the receiver's end. This is generally a good thing, but confusing if you are modifying the object on the sender's end and expecting those modifications to show up on the receiver's end. Thus, you have two issues: In order to send the data each time, you either need to create a new FileTest instance each time, or use the writeUnshared() method. Due to this identity preserving behavior, you will need to periodically reset() the ObjectOutputStream in order to keep all these instances from being held forever (and potentially leading to an OOME on the client or server).
has comment: http://stackoverflow.com/comment/40912635

http://stackoverflow.com/q/26065041
has comment: http://stackoverflow.com/comment/40837010
has answer: http://stackoverflow.com/a/26067378
has comment: http://stackoverflow.com/comment/40838836
type: Question
has answer: http://stackoverflow.com/a/26065109
has answer: http://stackoverflow.com/a/26065519
downvote count: 0
has answer: http://stackoverflow.com/a/26065138
answer count: 6
has comment: http://stackoverflow.com/comment/40837894
has body: This might be the silliest question anybody ever asked, but just for curiosity, Can we assign values to Objects which are passed as arguments. For example public class ForDemo3 { int i = 0; ArrayList cp = new ArrayList(); public ForDemo3() { int j = 30; cp.add(j); cp.add(i); i = 5; j = 12; System.out.println("i = " + i + " &amp; j= " + j); assignDvalues(i, j); System.out .println("After Restoring the values i = " + i + " &amp; j= " + j); } public void assignDvalues(Object... obj) { for (int n = 0; n &lt;= obj.length - 1; n++) { obj[n] = cp.get(n); System.out.println("" + obj[n]); } } public static void main(String[] args) { new ForDemo3(); } } I'm trying to develop checkpoint based recovery in java. And cp is a checkpoint object where values can be stored. Output of Above is i = 5 &amp; j= 12 30 0 After Restoring the values i = 5 &amp; j= 12 Edit Apologies i am not a great user of stackoverflow. I'm working on a framework for parallel computing. And there will be a function savecheckpoint(List l) which will be used to store list or array list to DB as a checkpoint, and another functionpublic object restoreCheckPoint(int i) will restore the list. So far i'm able to save the checkpoint and then restore it back. But how can i assign back the values of the Objects or variables without effecting user's code? As given in the above example i want to restore the values using assignDvalues(). Is there any way to make it possible?
accepted answer: http://stackoverflow.com/a/26067378
possible better answer: http://stackoverflow.com/a/26065138
favorite count: 0
has title: Can we assign values to objects passed in arguments without using return in Java?
tagged with: recovery
has answer: http://stackoverflow.com/a/26065216
has answer: http://stackoverflow.com/a/26065195
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26090639
has answer: http://stackoverflow.com/a/26131271
has comment: http://stackoverflow.com/comment/40884946
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/40956830
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40884933
favorite count: 0
has body: trying to use jython in my android project but whenever i start the application i get the following error message: 09-29 01:04:24.841: E/AndroidRuntime(2212): FATAL EXCEPTION: Thread-11144 09-29 01:04:24.841: E/AndroidRuntime(2212): Process: com.spitmarks.spitman, PID: 2212 09-29 01:04:24.841: E/AndroidRuntime(2212): java.lang.NoClassDefFoundError: org/python/util/PythonInterpreter 09-29 01:04:24.841: E/AndroidRuntime(2212): at com.spitmarks.spitman.TestPythonClass.TestMetoda(TestPythonClass.java:8) 09-29 01:04:24.841: E/AndroidRuntime(2212): at com.spitmarks.spitman.MainMenuScreen.paint(MainMenuScreen.java:89) 09-29 01:04:24.841: E/AndroidRuntime(2212): at com.spitman.framework.implementation.AndroidFastRenderView.run(AndroidFastRenderView.java:49) 09-29 01:04:24.841: E/AndroidRuntime(2212): at java.lang.Thread.run(Thread.java:841) 09-29 01:04:24.841: E/AndroidRuntime(2212): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.python.util.PythonInterpreter" on path: DexPathList[[zip file "/data/app/com.spitmarks.spitman-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.spitmarks.spitman-2, /vendor/lib, /system/lib]] 09-29 01:04:24.841: E/AndroidRuntime(2212): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 09-29 01:04:24.841: E/AndroidRuntime(2212): at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 09-29 01:04:24.841: E/AndroidRuntime(2212): at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 09-29 01:04:24.841: E/AndroidRuntime(2212): ... 4 more I am using Win8, Eclipse Kepler, Android SDK 23. Specified Java class can be found in jython install folder. P.S. And when i try to debug i get the screen with description that i can not access source code of BaseDexClassLoader.class, and i cant even find it anywhere on my OS. Every help is greatly appreciated. UPDATE: package com.spi.spit; import org.python.util.PythonInterpreter; import org.python.core.*; public class JythonTestClass { public static String Test() thr…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40957629
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
tagged with: jython
has comment: http://stackoverflow.com/comment/40884027
has title: java.lang.NoClassDefFoundError: org/python/util/PythonInterpreter

http://stackoverflow.com/comment/92465722
score: 0
comment on: http://stackoverflow.com/a/26094619
type: AnswerComment
type: Comment
has text: @Senshi not sure what you mean. Can you post another question with an example. I'm sure there's a solution, but I'm not quite sure what the problem is.

http://stackoverflow.com/q/26115851
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27300142
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40972770
score: 6
has comment: http://stackoverflow.com/comment/40962011
upvote count: 6
tagged with: javax.imageio
tagged with: imgscalr
tagged with: java
has comment: http://stackoverflow.com/comment/40938860
tagged with: bufferedimage
has body: I am trying to convert an image (url below) using two libraries (thumbnailator and imgscalr. My code works on most of the images except a few which after conversion have a pink/reddish tint. I am trying to understand the cause and would welcome any recommendation. Note - Image type of this image is 5 i.e BufferedImage.TYPE_3BYTE_BGR and i am using Java 7 Using Thumbnailator Thumbnails.of(fromDir.listFiles()) .size(thumbnailWidth, thumbnailHeight) .toFiles(Rename.SUFFIX_HYPHEN_THUMBNAIL); Using imgscalr BufferedImage bufferedImage = ImageIO.read(file); final BufferedImage jpgImage; LOG.debug("image type is =[{}] ", bufferedImage.getType()); BufferedImage scaledImg = Scalr.resize(bufferedImage, Method.ULTRA_QUALITY, thumbnailWidth, thumbnailHeight, Scalr.OP_ANTIALIAS); File thumbnailFile = new File(fromDirPath + "/" + getFileName(file.getName()) +THUMBNAIL_KEYWORD + ".png"); ImageIO.write(scaledImg, getFileExtension(file.getName()), thumbnailFile); bufferedImage.flush(); scaledImg.flush();
type: Question
tagged with: thumbnails
has answer: http://stackoverflow.com/a/40584735
linked to: http://stackoverflow.com/q/17755036
has title: Pink/Reddish tint while resizing jpeg images using java thumbnailator or imgscalr
has comment: http://stackoverflow.com/comment/43064353

http://stackoverflow.com/comment/41010482
score: 0
comment on: http://stackoverflow.com/q/26159993
type: QuestionComment
has text: @SaniHuttunen care to elaborate what advantages that will have? The features in B-Tree doesn't seem to offer any particular advantages to this particular scenario. But that just might be my data structure ignorance speaking :-)
type: Comment

http://stackoverflow.com/a/26062970
accepted answer of: http://stackoverflow.com/q/26062495
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26062495
has body: Try SELECT b FROM Book b WHERE NOT EXISTS ( SELECT o FROM Order o WHERE b MEMBER OF o.items ) to find books for which there is no order such that the book is a member of the order's items list. (I should note that this is probably not very efficient due to the negations. Flagging Books once they occur in an Order is actually more efficient.)
has comment: http://stackoverflow.com/comment/40850908
has comment: http://stackoverflow.com/comment/40835341

http://stackoverflow.com/comment/40934473
type: Comment
comment on: http://stackoverflow.com/a/26118985
has text: Thanks for your insight. It was working till yesterday and I am not sure whether any java update i got from Mac os is causing this and I am not finding answers on the net
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40886489
has text: For two *small* lists a O(n*m) brute force may be "fastest".. I imagine these sequences are of significant size, but do remember to find and focus on actual bottlenecks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26091882
score: 1

http://stackoverflow.com/q/26142819
answer count: 4
accepted answer: http://stackoverflow.com/a/26142904
linked to: http://stackoverflow.com/q/33931175
has title: Scanner not finding blank lines, returning index out of bounds
duplicate of: http://stackoverflow.com/q/33931175
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26142916
has answer: http://stackoverflow.com/a/26142924
type: Question
has answer: http://stackoverflow.com/a/26142904
possible better answer: http://stackoverflow.com/a/26142916
has comment: http://stackoverflow.com/comment/40978549
score: 0
has answer: http://stackoverflow.com/a/26142950
has body: I am trying to read a file line by line and take action on every line that begins with the character 'Q'. I keep getting this error after trying many solutions from SO and the JavaDoc. I cannot figure out for the life of me what I am getting it. My method looks like this: public Question makeQuestion(){ //scanner checks line and takes action while(fileScan.hasNextLine()){ //save the line String line = fileScan.nextLine(); //if line is blank move on to next line if(line.isEmpty()) fileScan.nextLine(); //if line starts with Q do something if(line.charAt(0) == 'Q'){ System.out.println(line); } } The method finds the first line that begins with Q but fails after that. What could I be doing wrong?

http://stackoverflow.com/comment/41069680
score: 0
has text: assuming it was mutable and not a string, say an int?
type: Comment
comment on: http://stackoverflow.com/a/26191811
type: AnswerComment

http://stackoverflow.com/q/26130238
tagged with: http://stackoverflow.com/tag/c
type: Question
tagged with: swig
has answer: http://stackoverflow.com/a/26141400
tagged with: arrays
tagged with: pointers
score: 0
accepted answer: http://stackoverflow.com/a/26141400
answer count: 1
has body: I swig how do you convert the return value in c to a float[] in java //C Function inline float32* b2Body::GetWorldPoint(float32 localX, float32 localY) { b2Vec2 val = b2Mul(m_xf, b2Vec2(localX, localY)); fin[0] = val.x, val.y; fin[1] = val.y; return fin; } As you can see the function returns float32* which is a two element array. In my swig file I included %include cpointer.i %include "arrays_java.i" %apply float[] {float32*}; But I get the error: .cpp: In function '_jfloatArray* Java_com_google_fpl_liquidfun_liquidfunJNI_Body_1getWorldPoint_1_1SWIG_11(JNIEnv*, jclass, jlong, jobject, jfloat, jfloat)': C:/Users/Garrett/Desktop/liquidfun-master/liquidfun//Box2D/swig/jni/../gen/cpp/armeabi-v7a/liquidfun_wrap.cpp:6147:59: error: 'FillMeInAsSizeCannotBeDeterminedAutomatically' was not declared in this scope make.exe: *** [obj/local/armeabi-v7a/objs/liquidfun_jni/gen/cpp/armeabi-v7a/liquidfun_wrap.o] Error 1
has comment: http://stackoverflow.com/comment/40957948
type: AnsweredQuestion
has title: Swig, convert c pointer to float[]
tagged with: java

http://stackoverflow.com/q/26144742
has title: get value by element xpath
has comment: http://stackoverflow.com/comment/40982836
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40983032
favorite count: 0
accepted answer: http://stackoverflow.com/a/26145005
tagged with: selenium-webdriver
tagged with: xpath
has comment: http://stackoverflow.com/comment/40982372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40982199
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
has body: &lt;input id="ctl00_MainContent_AllowanceGridView_ctl46_DHD" class="allowanceValue" type="text" onkeydown="return formattime(this,event);" value="00:56" name="ctl00$MainContent$AllowanceGridView$ctl46$DHD"/&gt; How to get value=00:56, by seleniun, Java ? Tried using .getText();, but it doesn't get me the value ?
type: Question
has answer: http://stackoverflow.com/a/26145005
has comment: http://stackoverflow.com/comment/40982995

http://stackoverflow.com/a/26118871
has comment: http://stackoverflow.com/comment/40970410
has comment: http://stackoverflow.com/comment/40970217
has comment: http://stackoverflow.com/comment/40967501
has comment: http://stackoverflow.com/comment/40934296
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26117230
has comment: http://stackoverflow.com/comment/40973322
accepted answer of: http://stackoverflow.com/q/26117230
type: Answer
has body: Does my answer below works for you? public static void main (String [] args){ String given = "dsfhgs the dgfre fh \n" + "hjfgeh fhg hghjr \n" + "fhvhjf the vgh fhjghf \n" + "fbvhjfd fhvfg fjvhf \n" + "the hfdvhjf vhf fhdvjfd \n" + "hfvbhd thehjdvhj hdfvhdf." ; String[] lines = given.split("\n"); String searchStr = "the"; for(String line : lines) { String[] wordOfLine = line.split(" "); boolean match = false; for(String word : wordOfLine) { if (searchStr.equals(word)) { match = true; } } if(match) { System.out.println("Found value: " + searchStr); } else { System.out.println("NO MATCH"); } } }

http://stackoverflow.com/comment/40904737
type: QuestionComment
comment on: http://stackoverflow.com/q/26102185
type: Comment
has text: @HovercraftFullOfEels - I'm wondering how I can throw an exception to another class. Like for my InvalidNameException. That is another class I have in the same folder as PayrollDemo. What I want it to do is to check if the name the user enters is an empty string, and if it is it's meant to throw this exception to the exception class which will take care of it. If all is good it'll continue as normal.
score: 0

http://stackoverflow.com/comment/41028600
type: Comment
comment on: http://stackoverflow.com/a/26159902
type: AnswerComment
score: 0
has text: you are absolutely correct! works like a charm now. I think I was dubious on setting the adapter in onLoadFinished() as I wasn't sure what atrocities that could cause during run. Thanks for the help, Su-Au.

http://stackoverflow.com/comment/40789846
type: Comment
type: AnswerComment
has text: @Goldorak84 Yes, the Java Language Specification that I've linked previously.
comment on: http://stackoverflow.com/a/26039523
score: 0

http://stackoverflow.com/q/26187870
upvote count: 0
downvote count: 5
tagged with: while-loop
has answer: http://stackoverflow.com/a/26187906
score: -5
favorite count: 0
has comment: http://stackoverflow.com/comment/41062953
type: UnansweredQuestion
has body: I want to make this program repeat itself using a do while loop. However, when I run it. All I get is errors. Any help? int Col = in.nextInt(); int Row = in.nextInt(); do { //Start of the do loop here System.out.print(" * "); for(int i = 1; i&lt;=Row;i++ ) { System.out.format("%4d",i); } System.out.println(); System.out.println("------------------------------------------"); for(int i = 1; i&lt;=Col; i++) { System.out.format("%4d |",i); for(int j=1; j&lt;=Row; j++) { System.out.format("%4d",i*j); } System.out.println(); } while (!(Col = 0) &amp;&amp; !(Row = 0));// This is the while loop } }
has comment: http://stackoverflow.com/comment/41062985
has answer: http://stackoverflow.com/a/26187958
has comment: http://stackoverflow.com/comment/41062950
tagged with: java
has comment: http://stackoverflow.com/comment/41062972
type: Question
has title: My program is not repeating when being nested in do- while loop in java
tagged with: do-while
answer count: 2

http://stackoverflow.com/a/26148582
type: Answer
answers question: http://stackoverflow.com/q/26101463
has comment: http://stackoverflow.com/comment/41102658
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26101463
score: 1
type: AcceptedAnswer
downvote count: 0
has body: This works with Jetty 9.2.3.v20140905 package org.eclipse.jetty.demo; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.net.URLEncoder; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; public class VideoServerMain { @SuppressWarnings("serial") public class IndexerServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.println(" "); out.println(" Videos "); out.println(" "); for (File file : baseDir.listFiles()) { if (file.isFile() && file.getName().endsWith(".mp4")) { String encodedFilename = URLEncoder.encode(file.getName(), "UTF-8"); out.println(" "); out.printf(" %n",encodedFilename); out.println(" "); out.printf(" %s %n",file.getName()); out.println(" "); } } out.println(" "); out.println(" "); } } public static void main(String[] args) { if (args.length != 1) { System.err.printf("ERROR: Usage %s [videos-dir]%n",VideoServerMain.class.getName()); System.exit(-1); } File baseDir = new File(args[0]); if (!baseDir.exists() || !baseDir.isDirectory()) { System.err.printf("ERROR: not a valid directory: %s%n",baseDir); System.exit(-1); } try { new VideoServerMain(baseDir).start(); } catch (Throwable t) { t.printStackTrace(System.err); } } private final File baseDir; public VideoServerMain(File baseDir) { this.baseDir = baseDir; } public void start() throws Exception { Server server = new Server(8080); // Establish Scratch directory for the servlet context (used by JSP compilation) File tempDir = new File(System.getProperty("java.io.tmpdir")); File scratchDir…

http://stackoverflow.com/q/26079180
has body: import java.awt.*; import java.awt.event.*; import java.applet.*; /* &lt;applet code="XOR" width=400 height=200&gt; &lt;/applet&gt; */ public class XOR extends Applet { int chsX = 100, chsY = 100; public XOR() { addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent me) { int x = me.getX(); int y = me.getY(); chsX = x - 10; chsY = y - 10; repaint(); } }); } } In above program when applet is started then obviously XOR() is called.AddMouseMotionListener() takes argument of a listener refernce.But here wat is happening.Here in parameter first an object of MouseMotionAdapter is made and some statements are written .How these can act as a refernce to listener for addMouseMotionListener().Please clearify my doubt ?? I am not able to understand anything here.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40862751
answer count: 0
tagged with: java
type: Question
has title: how constructor in applet work and how event is handled?
has comment: http://stackoverflow.com/comment/40862810
score: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/40862891

overriding
tags question: http://stackoverflow.com/q/26067831
tags question: http://stackoverflow.com/q/26126760
tags question: http://stackoverflow.com/q/26071567
tags question: http://stackoverflow.com/q/26151218
type: Tag
tags question: http://stackoverflow.com/q/26091066
tag name: overriding

http://stackoverflow.com/q/26130708
type: Question
has comment: http://stackoverflow.com/comment/40957284
downvote count: 0
has comment: http://stackoverflow.com/comment/40957175
tagged with: listview
tagged with: android
has title: Android - Making a snapping Horizontal ListView
favorite count: 0
has comment: http://stackoverflow.com/comment/40957230
answer count: 0
has body: How can I make a horizontal list view in android that snaps? What I mean by snaps is that it acts like a Pager, but I can use an adapter for the list with mList.setAdapter(adapter);. I have tried libraries but none of them work because I am working with Android Studio. Thanks.
type: UnansweredQuestion
upvote count: 1
tagged with: horizontal-scrolling
has comment: http://stackoverflow.com/comment/40957240
score: 1
tagged with: java

http://stackoverflow.com/q/26105854
answer count: 2
accepted answer: http://stackoverflow.com/a/26142415
has title: Gradle android application build failed with IntelliJ (java not found issue, but set correctly)
has body: I've problem with build my Android project from IntelliJ. I set up default Android project and try to compile, then: Error: Gradle: Execution failed for task ':app:preDexDebug'. (...) /android-sdk/sdk/build-tools/android-4.4W/dx: line 89: exec: java: not found I use gradle wrapper from ide. I have java on the PATH, and JAVA_HOME properly. So what is the reason of error?
downvote count: 0
score: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: android-gradle-plugin
possible better answer: http://stackoverflow.com/a/26106278
tagged with: java
has answer: http://stackoverflow.com/a/26106278
upvote count: 1
tagged with: gradle
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/26142415

http://stackoverflow.com/q/26084613
upvote count: 1
tagged with: java
tagged with: haskell
type: Question
has body: I have written a server in Haskell which passes messages to connected clients. If the connection drops from one of the clients, it takes several minutes for my server to notice that the client is gone. hGetLine in Haskell is blocking and I can't close the thread if it's still listening (there is a way with async, but it's not working for me). If I write to the broken pipe from that client, I get a broken pipe exception in Java and have to make a new socket. Implementing heartbeats to check if the connection is still open could work, but if there are two telnet sessions connected to the server, it's nearly impossible to instantly reply on a heartbeat message from the server. Is there any way to notice quickly if the client is disconnected? Is there a way to use SIG_IGN to ignore the broken pipe exception in Java and write to the same pipe after Internet connectivity is restored?
has title: Broken Pipe Exception
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40874220
has comment: http://stackoverflow.com/comment/40873427
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/40987225
type: Comment
has text: @lexicore Thanks from the quick response. there is a plan to use a code documentation generation tool which is generating the documentation from the annotation... and based on the xjc generated code, the documentation generation tool is currently creating an xsd with type xs:string instead of xs:boolean
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26147085

http://stackoverflow.com/a/26191128
type: AcceptedAnswer
type: Answer
has body: Based on my understanding of your code snippet and comment, I think this might suffice your need. public static void main(String[] args) throws IOException { Document doc = Jsoup.connect("http://www.fidalservizi.it/risultati/Izmir_2014/Gara053.htm").get(); Elements table = doc.select("tr:gt(0)").not("td#t1_ckrs.td_fine"); for (Element row : table) { if (isDataRow(row)) { System.out.print(" Pos :" + row.getElementById("t1_clas").text()); System.out.print(" Name :" + row.getElementById("t1_atle").text()); System.out.println(" Country " + row.getElementById("t1_soci").text()); } } } private static boolean isDataRow(Element row){ Elements elements = row.select("tr.due"); elements.addAll(row.select("tr.uno")); return !elements.isEmpty() &amp;&amp; !elements.text().equalsIgnoreCase(""); } This prints Pos :1 Name :CHEVAUX Christophe Country FRA FRANCE Pos : Name :European Champion Country Pos :2 Name :VAN DER PUTTEN Marijn Country NED NETHERLANDS Pos :3 Name :BAGHIROV Faig Country AZE AZERBAIJAN Pos :4 Name :DIEGO Miguel Angel Country ESP SPAIN Pos :5 Name :CAMBRIA Giuseppe Country ITA ITALY Pos :6 Name :YILMAZ Ozgur Country TUR TURKEY Pos :7 Name :MAFTEI Nelu Vasilica Country ROU ROMANIA
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26121811
upvote count: 1
answers question: http://stackoverflow.com/q/26121811

xpath
tags question: http://stackoverflow.com/q/26144742
tags question: http://stackoverflow.com/q/26136232
tags question: http://stackoverflow.com/q/26038255
tag name: xpath
tags question: http://stackoverflow.com/q/26067078
tags question: http://stackoverflow.com/q/26104411
tags question: http://stackoverflow.com/q/26060841
tags question: http://stackoverflow.com/q/26086493
tags question: http://stackoverflow.com/q/26060890
tags question: http://stackoverflow.com/q/26114760
type: Tag
tags question: http://stackoverflow.com/q/26074166

http://stackoverflow.com/a/26167151
has body: Number timeoutNum = (Number) paramJson.get("valInMs"); Long timeoutLong = null; Double timeoutDouble = null; if (timeoutNum instanceof Long) { timeoutLong = (Long) timeoutNum; } else if (timeoutNum instanceof Double) { timeoutDouble = (Double) timeoutNum; } else { ... punt ... } Or one can use intValue() et al on timeoutNum, if necessary coercing between integer and float.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26166767
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26166767
type: Answer

http://stackoverflow.com/a/26035036
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26034859
has comment: http://stackoverflow.com/comment/133732943
type: Answer
has body: There are few ways to do that: @Transient private String password; Mark your field with @Transient annotation or: private transient String password; These won't allow hibernate either to persist or serialize the object. The problem is that probably you need the password to be persisted but not serialized when reading. In this case I would create a new POJO entity of the user which doesn't have the password and copy other values to it or just simply write the JPQL query to get necessary fields and exclude the password.
score: 2
has comment: http://stackoverflow.com/comment/40819464
upvote count: 2
answers question: http://stackoverflow.com/q/26034859
type: AcceptedAnswer

http://stackoverflow.com/q/26130148
tagged with: eclipse
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/26130222
accepted answer: http://stackoverflow.com/a/26130222
answer count: 1
has body: My idea of the project is to write a simple Spring pure java application using Gradle that will connect to a DB2 database and pull some data and print on the console. To start off, I created a Gradle project using Eclipse Luna. My challenges: How do I read the database.properties file in src/main/resources which has the db.driver, db.url, db.username and db.password ? How do I tell Gradle to pick up my db2cc4.jar for the driver ? I cannot manage it with Gradle dependencies because it is a proprietary jar. Here is my build.gradle apply plugin: 'java' apply plugin: 'eclipse' repositories { mavenCentral() } jar { baseName = 'QueryExecutor' version = '0.1.0' } dependencies { compile 'org.springframework:spring-context:4.1.0.RELEASE' compile 'org.springframework:spring-jdbc:4.1.0.RELEASE' runtime files('lib/db2cc4.jar') testCompile 'junit:junit:4.+' } task wrapper(type: Wrapper) { gradleVersion = '2.1' } Here is my ApplicationConfig.java import javax.annotation.Resource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.shrinathk.queryexecutor.persistence.QueryExecutorDAO; @Configuration @Import({DatabaseConfig.class}) @PropertySource("classpath:application.properties") @PropertySource("classpath:database.properties") public class ApplicationConfig { @Resource private Environment env; @Bean public QueryExecutorDAO queryExecutor() { return new org.shrinathk.queryexecutor.persistence.QueryExecutorDAO(); } } Here is my DatabaseConfig.java import javax.annotation.Resource; import javax.sql.DataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.sp…
score: 4
favorite count: 0
upvote count: 4
tagged with: build.gradle
has title: Challenges starting off with Gradle, Spring and DB2
tagged with: spring
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/26102905
has answer: http://stackoverflow.com/a/26103401
has body: Are there any custom JSON to java object parsers to map json properties to Java object attributes through some configuration. suppose I have class class Person { String id; String name; String loc;} My json String is {name:"xy",id:12, address: {location: "abc"}} I need map location.address of json to loc property of Person. We need to drive this mapping through config XML or prop file. EDITED.... I am trying to have grammer or rules defined in property file such as: address.location = loc id = id name = name This is what I am thinking. Not sure how map complex types such as List, Map, etc So my code would call a method Person p = ObjectMapper.map(jsonData,Person.class,configuration) and actual mapping is done is this way class ObjectMapper { public static &lt;T&gt; T map(String jsonData,Class&lt;T&gt; rootType, Map&lt;String,String&gt; rules) { T object = rootType.newInstance(); // TODO: code to parse json using the rules //and finally return object return (T) object; } This is what I am planning to do. Any help is appreciated. Thanks in Advance.
has comment: http://stackoverflow.com/comment/40905971
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26115929
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 1
score: 2
type: UnansweredQuestion
has title: json to java object custom parsers
tagged with: jackson
type: Question
has comment: http://stackoverflow.com/comment/40927653
has comment: http://stackoverflow.com/comment/40926425
has comment: http://stackoverflow.com/comment/40929458
favorite count: 0
has comment: http://stackoverflow.com/comment/40905957
answer count: 2

http://stackoverflow.com/comment/40879309
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26088221
score: 2
has text: What is that you want to test?

http://stackoverflow.com/a/26127063
score: 1
answers question: http://stackoverflow.com/q/26126975
has comment: http://stackoverflow.com/comment/40949855
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40949808
has body: You're incrementing spine as you put values into the array, so when you then print out temp[spine], you're printing the next one, which you haven't filled yet! Change this while(sc.hasNextInt()){ temp[spine++] = sc.nextInt(); System.out.println("" + temp[spine]); } to while(sc.hasNextInt()){ temp[spine] = sc.nextInt(); System.out.println("" + temp[spine]); spine++; }

http://stackoverflow.com/comment/40851111
score: 1
comment on: http://stackoverflow.com/q/26072170
has text: Do you have any control over the schema? It would be much better XML form to transmit the id as an attribute instead of embedding it in the tag name. If not, you could use @XmlAnyElement, but you'd end up with DOM objects that you'd have to do some manual mapping from to achieve your desired result.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26151268
has comment: http://stackoverflow.com/comment/40995506
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26151182
answers question: http://stackoverflow.com/q/26151182
type: Answer
has comment: http://stackoverflow.com/comment/40994719
score: 1
upvote count: 1
has body: It's not necessarily inefficient. It will just run endlessly. If you want that then this isn't necessarily evil. One thing you may consider is adding a stop boolean. That way you can ask the user if they want to quit, and set the variable to true/false. boolean stop = false; while(stop == false) { //... } Also, stylistically I like doing infinite while loops like this: while(true) { //... } Instead of using "1==1"
downvote count: 0
has comment: http://stackoverflow.com/comment/40995554
has comment: http://stackoverflow.com/comment/40994838
has comment: http://stackoverflow.com/comment/40997160

http://stackoverflow.com/a/26096415
has comment: http://stackoverflow.com/comment/40895007
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: Can't you just use ContainerListener public void componentAdded(ContainerEvent e); for your container to get the docking event?
answers question: http://stackoverflow.com/q/26096241
type: Answer
has comment: http://stackoverflow.com/comment/40894826
accepted answer of: http://stackoverflow.com/q/26096241
has comment: http://stackoverflow.com/comment/40897459
has comment: http://stackoverflow.com/comment/40938938

http://stackoverflow.com/q/26092816
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40888514
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40919834
type: UnansweredQuestion
tagged with: dns
has body: when using dig to query a particular dns server you get the following: dig @e.root-servers.net test.it. ; DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 @e.root-servers.net test.it ; (1 server found) ;; global options: +cmd ;; Got answer: ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 7, ADDITIONAL: 14 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;test.it. IN A ;; AUTHORITY SECTION: it. 172800 IN NS a.dns.it. it. 172800 IN NS c.dns.it. it. 172800 IN NS m.dns.it. it. 172800 IN NS r.dns.it. it. 172800 IN NS s.dns.it. it. 172800 IN NS dns.nic.it. it. 172800 IN NS nameserver.cnr.it. However I'm not getting anything using the following java code using dnsjava. Lookup lookup = new Lookup("test.it", Type.NS); SimpleResolver resolver=new SimpleResolver("e.root-servers.net"); //Message msg=new //resolver.send(msg); lookup.setDefaultResolver(resolver); lookup.setResolver(resolver); Record [] records = lookup.run(); for (int i = 0; i &lt; records.length; i++) { Record r = (Record ) records[i]; System.out.println(r.getName()+&quot;,&quot;+r.getAdditionalName()); } what's wrong?
answer count: 0
downvote count: 0
has title: querying dns server in java

http://stackoverflow.com/q/26186258
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26186809
type: Question
tagged with: performance
score: 1
tagged with: java
has body: I need to speed up a search. Currently we let our users input a name: John Doe Then in Java we split that string to create multiple values (or "terms") ["John", "Doe"] and loop through the terms provided doing a select in the database looking for that term in a number of relevant columns: // For each term in the string[] SELECT * FROM Person p WHERE 1=1 AND (p.idNumber = '#{term}' OR LOWER(p.firstName) LIKE '%#{term}%' OR LOWER(p.lastName) LIKE '%#{term}%' OR LOWER(p.companyName) LIKE '%#{term}%' OR p.phone = '#{term}'); at the end of the loop we use Java to do an intersection of the matched rows so that all matches are unique. persons = (List&lt;Person&gt;)CollectionUtils.intersection(persons, tmpPersons); I'm planning on changing this to a dynamic SQL statement to match all terms provided in one sql statement and removing the CollectionUtils.intersection but before I go through that process is there another way to do this that produce a faster search?
tagged with: query-performance
tagged with: mysql
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41060820
favorite count: 0
accepted answer: http://stackoverflow.com/a/26186809
has title: Mysql and Java search matching multiple values in multiple columns
tagged with: database-performance

http://stackoverflow.com/a/26091102
answers question: http://stackoverflow.com/q/26090986
accepted answer of: http://stackoverflow.com/q/26090986
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: The line x = in.nextInt(); has to be inside the while loop. ... int x = -1; ... while (x != 0) { x = in.nextInt(); .... }

http://stackoverflow.com/comment/41069688
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26191752
has text: Thank u the problem was that i didnt break out of the loop after something collided. But i don't get why I should get rid of falling. If falling is true velY will be added to y, so the object(goomba) is falling down. But thanks anyways :D

http://stackoverflow.com/q/26085720
type: Question
tagged with: http://stackoverflow.com/tag/csv
tagged with: regex
has title: Extracting comma separated values from String coming from HTTP post
score: -1
has answer: http://stackoverflow.com/a/26085944
tagged with: java
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/26085994
type: UnansweredQuestion
upvote count: 0
has body: I would like extract comma separated values which I am getting from HTML post request. Example: ****"file"; filename="TEST.csv" Content-Type: application/vnd.ms-excel RECEIVERID,RECEIVERSITE,SENDERID,EMAIL_TO 1000003884,PEPSICO LTD.,1005,ZZZ@company.com 1000003884,PEPSICO LTD.,1010,ABC@company.com ------WebKitFormBoundary5ADzaHQgUvmKoZPI Content-Disposition: form-data; name="submit" Submit ------WebKitFormBoundary5ADzaHQgUvmKoZPI--**** I want to extract only data starting from RECEIVERID,RECEIVERSITE.... to ,ABC@company.com by using regex. Could you kindly help me with this? Thanks in advance !! Tanveer
favorite count: 0
has answer: http://stackoverflow.com/a/26085751

http://stackoverflow.com/a/26082964
type: Answer
accepted answer of: http://stackoverflow.com/q/26082941
answers question: http://stackoverflow.com/q/26082941
has body: Remember the argument as a private instance member, then use that member: public class Counter { // The instance member we'll use, note that we initialize it to `null` // because you have a zero-args constructor, so we want to be sure we // know whether we have one or not private Counter otherCounter = null; public Counter() {} public Counter(Counter oldCounter) { // Remember it here this.otherCounter = oldCounter; } public void someMethod() { // Use it here if (this.otherCounter != null) { this.otherCOunter.someOtherMethod(); } } }
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/40903282
type: Comment
comment on: http://stackoverflow.com/q/26101159
score: 0
has text: You mean doing only this: context.startActivity(NewActivity); on the postExecute? Because that didnt work.
type: QuestionComment

http://stackoverflow.com/comment/40860955
type: QuestionComment
type: Comment
has text: If you decide to answer yourself please post it as an answer and accept it (it's legitimate to answer your own question).
score: 0
comment on: http://stackoverflow.com/q/26075081

http://stackoverflow.com/a/33015452
has comment: http://stackoverflow.com/comment/53867082
type: AcceptedAnswer
downvote count: 0
score: 1
has body: I'm able to plug in my T(n) appropriately so that T(1) = Θ(1) and T(n) = Θ(n) but I feel that I haven't accurately proved that. Can anyone weigh in on where my math may be incorrect? I'm too late and I'm pretty sure you already know all this but here it goes: c1(tj+1) + c2tj +c3 + c4 = tj(c1+ c2) + (c1 + c3 + c4) = tj(c) + c = tj I would change it to c1(tj+1) + c2tj +c3 + c4 = tj(c1+ c2) + (c1 + MAX(c3,c4)) = tj(c) + c = tj As you pointed out, only c3 or c4 would run, so for the worst case we pick the one with more complexity (despite in this case both are constant). How are you supposed to evaluate early return statements within an algorithm? Complexity goes from the best case to the worst case (and an average case), you're evaluating the worst case. An early return would fit into the best case. Where the conditions supposed made it possible.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26074754
answers question: http://stackoverflow.com/q/26074754

http://stackoverflow.com/q/26051510
score: -1
has answer: http://stackoverflow.com/a/26051597
has answer: http://stackoverflow.com/a/26051596
type: UnansweredQuestion
downvote count: 1
tagged with: java
tagged with: eclipse
tagged with: import
type: Question
has title: Is there a way to "import" from other on-disk Java projects in Eclipse?
answer count: 2
upvote count: 0
favorite count: 0
has body: I have two Java Projects in Eclipse, and I'd like to make one be able to access the classes in the other, without making it difficult to tell which classes came from which -- or, ideally, without having to list the classes in the accessing project. In other words, it looks like this (but with many more files): Proj01 &nbsp; &nbsp; [package] &nbsp; &nbsp; &nbsp; &nbsp; Useful.java Proj02 &nbsp; &nbsp; [package] &nbsp; &nbsp; &nbsp; &nbsp; CurrentProject.java And I want to have some sort of equivalent of "import Proj01.Useful;" in CurrentProject.java. How would I do this?

http://stackoverflow.com/comment/40822129
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26057140
score: 0
has text: Running this code (with `timestart` initialized with `new GregorianCalendar()`) I see two identical Strings produced. Are any other threads operating on the object referenced by the `timestart` variable? (Are you sharing the object with other threads?)

http://stackoverflow.com/q/26131352
accepted answer: http://stackoverflow.com/a/26131452
has comment: http://stackoverflow.com/comment/40958006
linked to: http://stackoverflow.com/q/8395916
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/40958004
type: AnsweredQuestion
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: Question
has body: Is it possible, for example with the help of ant, to avoid deep directory structures that come along with deep package nesting? Suppose I wrote ClassA and ClassB, both in package com.domain.name, is it possible to avoid a directory layout like project/ - build.xml - src/ - com/ - domain/ - name/ - ClassA.java - ClassB.java and go instead for the simpler project/ - build.xml - src/ - ClassA.java - ClassB.java
has title: Avoid deep directory structure in a java project
has answer: http://stackoverflow.com/a/26131452
has comment: http://stackoverflow.com/comment/40958132
has comment: http://stackoverflow.com/comment/40958156
upvote count: 1
tagged with: directory-structure

http://stackoverflow.com/comment/40810107
comment on: http://stackoverflow.com/q/26050410
has text: What specific use case scenario would you want to have this?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41935742
comment on: http://stackoverflow.com/q/26051880
score: 0
has text: Are you sending ajax request?
type: Comment
type: QuestionComment

tabs
type: Tag
tags question: http://stackoverflow.com/q/26159126
tags question: http://stackoverflow.com/q/26035562
tags question: http://stackoverflow.com/q/26186261
tags question: http://stackoverflow.com/q/26097794
tag name: tabs
tags question: http://stackoverflow.com/q/26039910

http://stackoverflow.com/comment/40965691
comment on: http://stackoverflow.com/a/26135023
score: 0
type: AnswerComment
has text: Thank you so much for your reply :) I will test this in the morning. May I ask how come my code works in some cases but not others? Cheers
type: Comment

http://stackoverflow.com/q/26040741
has answer: http://stackoverflow.com/a/48817648
type: Question
has comment: http://stackoverflow.com/comment/40791980
tagged with: java
has comment: http://stackoverflow.com/comment/40791905
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40792014
has title: I am getting an error on .addFirst method, why?
has answer: http://stackoverflow.com/a/26040877
accepted answer: http://stackoverflow.com/a/26040877
has body: import javax.swing.*; import java.util.*; import java.awt.*; public class ConverAryToList { public static void main(String[] args) { // TODO Auto-generated method stub String[] stuff = { "people ", "watermelon ", "melons ", "fudge " }; List&lt;String&gt; list = new java.util.LinkedList&lt;String&gt;( Arrays.asList(stuff)); list.add("pumpkin"); list.addFirst("first"); stuff = list.toArray(new String[list.size()]); for (String x : stuff) System.out.printf("%s", x); } } This is a simple exercise on adding elements to a list. On list.addFirst I get: The method addFirst(String) is undefined for the type List. Where did I go wrong?
has comment: http://stackoverflow.com/comment/40792041
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26040869
has answer: http://stackoverflow.com/a/26040869

http://stackoverflow.com/comment/40850803
type: Comment
has text: And I did mean to use |=, but it was pretty arbitrary - it isn't representative of the actual operations being performed.
comment on: http://stackoverflow.com/a/26072144
score: 1
type: AnswerComment

http://stackoverflow.com/comment/40933979
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26114505
has text: @AleksandrM, earlier I tried to use List and this way didn't work. It's strange but now it work, as though I changed nothing :D Thanks a lot!
score: 0

freebase
tag name: freebase
tags question: http://stackoverflow.com/q/26153696
type: Tag

http://stackoverflow.com/comment/40881867
comment on: http://stackoverflow.com/q/26089551
type: QuestionComment
type: Comment
score: 1
has text: Read the root cause of the exception, many things will clear up.

http://stackoverflow.com/a/79422557
has body: java.time.LocalDate In modern Java, use the LocalDate class to represent a date. The toString method generates text in standard ISO 8601 format YYYY-MM-DD. To get your desired output, swap the hyphen for a slash. LocalDate ld = LocalDate.of ( 2025, Month.JANUARY , 23 ) ; String output = ld.toString().replace ( &quot;-&quot; , &quot;/&quot; ) ;
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26174521
downvote count: 0
score: 1

http://stackoverflow.com/comment/40947785
type: Comment
has text: I don't know if Java compilers are permitted to do the same tricks that C compilers are, but I'd at least consider the possibility that the summary loop has been optimized away.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26120311

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/26162855
tag name: nosuchmethoderror

http://stackoverflow.com/comment/40943064
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26122266
has text: @JasperVanzRecitas You can't change the class name, otheriwse it doesn't know which one to run. Use the one it gives you.

http://stackoverflow.com/comment/41076149
comment on: http://stackoverflow.com/a/26194676
type: AnswerComment
has text: Thanks for pointing it out, @NightwareSystems! Really! I would like to upvote your answer, but because my reputation is that low ( rep < 15) I'm not allowed.
type: Comment
score: 0

http://stackoverflow.com/comment/41055558
score: 0
type: Comment
type: QuestionComment
has text: Because you have to create one instance of the controller in order to load the FXML, which then creates another instance of the controller. Typically you would load the FXML from a different class (the exception perhaps being if you are using a [dynamic root](http://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html#custom_components) (which looks very different).
comment on: http://stackoverflow.com/q/26172967

http://stackoverflow.com/comment/40883960
comment on: http://stackoverflow.com/q/26080161
score: 0
type: Comment
type: QuestionComment
has text: There is nothing in this code that prints 'no attributes'. Please explain, or amend your question.

http://stackoverflow.com/comment/41005407
has text: Why use Java 1.4? It's been out of date for a decade.
comment on: http://stackoverflow.com/q/26157252
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/40786440
type: QuestionComment
comment on: http://stackoverflow.com/q/26034874
has text: This problem exist also for the Parse PHP SDK for numeric fields with value = 0 and boolean fields with value = false
score: 0
type: Comment

http://stackoverflow.com/a/26091868
has body: If you believe it is due to the copy of the array, try System.arraycopy in illegalCheck.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26091838
upvote count: 1
has comment: http://stackoverflow.com/comment/40886635

http://stackoverflow.com/comment/40955525
comment on: http://stackoverflow.com/q/26128067
has text: @PatriceGahide Yes. The "No Reuse" constraint applies to this problem, unlike the classic problem we know. The "no reuse" constraint implies both the players pick a number in for each turn from the common pool and the number and number once used cannot be re-used by either player.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26140002
has comment: http://stackoverflow.com/comment/41007653
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26141399
type: Question
has body: Since ByteArrayInputStream is limited to 2GB, is there any alternate solution that allows me to store the whole contents of a 2.3GB (and possibly larger) file into an InputStream to be read by Stax2? Current code: XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(in); //ByteArrayInputStream???? try { SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); Schema schema = factory.newSchema(new StreamSource(schemaInputStream)); Validator validator = schema.newValidator(); validator.validate(new StAXSource(xmlStreamReader)); } finally { xmlStreamReader.close(); } For performance tuning, variable in must not come from disk. I have plenties of RAM.
possible better answer: http://stackoverflow.com/a/26140091
has title: Reading a file larger than 2GB into memory in Java
has answer: http://stackoverflow.com/a/26140091
tagged with: io
accepted answer: http://stackoverflow.com/a/26141399
downvote count: 0
has answer: http://stackoverflow.com/a/26140483
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/26140077
upvote count: 8
has comment: http://stackoverflow.com/comment/40973436

http://stackoverflow.com/q/26050241
downvote count: 0
has answer: http://stackoverflow.com/a/26050257
favorite count: 0
has body: I am trying to understand the ExecutorService in java. There is not much performance difference when I use 1 thread or 4 threads. I have a quad core CPU and I do not have any other process running. ExecutorService exService = Executors.newFixedThreadPool(4); exService.execute(new Test().new RunnableThread()); exService.awaitTermination(25, TimeUnit.SECONDS); class RunnableThread implements Runnable { @Override public void run() { StopWatch stopWatch = new StopWatch(); stopWatch.start(); long cnt = 0; for (cnt = 0; cnt &lt; 999999999; cnt++) { try { for (long j = 0; j &lt; 20; j++){ x += j; } } catch (Exception e) { e.printStackTrace(); } } stopWatch.stop(); System.out.println(stopWatch.getTime()); } } If my understanding is right, my task should have close to 4x performance improvement when I say newFixedThreadPool(4) right?
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40809816
has answer: http://stackoverflow.com/a/26050264
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40809809
has title: Performance of ExecutorService in Java
answer count: 2

http://stackoverflow.com/a/26158620
score: 1
has body: Try to use StringBuffer or StringBuilder when doing string operation so that it won't leaving behind a lot of new unused objects and cause memory inefficient since repeated millions of times as you mentioned
answers question: http://stackoverflow.com/q/26158430
has comment: http://stackoverflow.com/comment/41007842
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41008274

http://stackoverflow.com/q/26134338
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/40963029
type: UnansweredQuestion
has title: webpage forward to itself by Java Servlet doesn't act correct on browser back/forward button
has body: I try to design a discussion forum but it seems to have a little problem. For my example, structure of my forum is topicsPage.jsp contains a bunch of topics, and replyPage.jsp contains a bunch of replies and a textArea allows people to reply to that topic. and now I got a problem, if an user posted a reply, and he want to go back to the topicPage.jsp, he clicked browser's back button, the browser didn't go to topicsPage.jsp, instead of doing that, the browser still stay at replyPage.jsp with the state which before user submit his reply. I believe this is not the only situation will cause this problem, any situation which needs servlet to forward to the original webpage will having this problem. is there any ways to solve this problem?
tagged with: java
has answer: http://stackoverflow.com/a/26134542
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26134430
tagged with: jsp

http://stackoverflow.com/a/26145875
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26145089
upvote count: 2
has body: For the record, this question isn't so much about bash itself as about the command-line tools that are commonly available on systems that provide bash. You can, in fact, perform the heavy lifting mostly with bash itself, but if you want a two- (or in fact a one-)liner then you should meet the sed program. For example: find . -name '*.jar' -exec ls -l {} \; | sed 's,^\([^ ]\+ \+\)\{4\}\([0-9]\+\) \+.* \([^ ]\+/\)\([^ /]\+\)$,\3 | \4 | \2 ,' Yes, it's incredibly cryptic. Most of the cryptic part is a regular expression that selects the wanted pieces of a long-form directory listing. But you wanted short, and concision comes with a price.
type: Answer

http://stackoverflow.com/comment/40796944
type: Comment
has text: @Frosty the ternary operator must be used judiciously: nesting conditions usually loses a lot of readability.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26041693

http://stackoverflow.com/comment/41182388
type: Comment
comment on: http://stackoverflow.com/a/26181523
type: AnswerComment
has text: ok, at least I understand your problem now :) I updated the post accordingy.
score: 0

http://stackoverflow.com/a/26072660
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40851570
has comment: http://stackoverflow.com/comment/40850990
has comment: http://stackoverflow.com/comment/40851363
accepted answer of: http://stackoverflow.com/q/26072639
type: Answer
answers question: http://stackoverflow.com/q/26072639
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40856586
has comment: http://stackoverflow.com/comment/40851612
has body: To write it line wise to a plain text file, use a BufferedWriter and write each line of the values like so: File outputFile = new File("/path/to/file.txt"); Writer writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(outputFile), "UTF-8")); for (long id : ids.getIDs()) { writer.write(id + "\n"); } writer.close(); (a DataOutputStream in contrast will not give you a human-readable format).
has comment: http://stackoverflow.com/comment/40851688
has comment: http://stackoverflow.com/comment/40851699

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/26073016
tags question: http://stackoverflow.com/q/26091277
tags question: http://stackoverflow.com/q/26115753
type: Tag
tags question: http://stackoverflow.com/q/26156310

http://stackoverflow.com/comment/40811213
score: 0
has text: Please share your `form` variable..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26043895

x509
tags question: http://stackoverflow.com/q/26117104
tag name: x509
type: Tag

http://stackoverflow.com/q/26114222
score: 1
tagged with: java
type: Question
answer count: 1
has title: how to set a time limit for a REST call made with angularjs ngResource ($resource)
tagged with: rest
has answer: http://stackoverflow.com/a/26114368
downvote count: 0
favorite count: 0
tagged with: angularjs
has body: I'm using angularjs to call a java api using REST. var app = angular.module("MyApp", ["ngResource","ngProgress"]) .factory('ConnectionData',function ($resource){ return $resource('URI'); }); function connectionTestController($scope,ConnectionData,ngProgress,$timeout){ $scope.connectionTest = function(){ var success = function(data, getResponseHeaders){ ngProgress.complete(); $scope.datas = data; $('#testConnectionBtn').attr("disabled", false); }; var failure = function(data){ if(data.status == 404) { $scope.errorString = data.status+", Request Error, Try Again"; }else{ $scope.datas = data.data; $scope.errMessage = $scope.datas.message; } ngProgress.complete(); $('#testConnectionBtn').attr("disabled", false); }; ConnectionData.get(success,failure); }; }; Connection Test Click to Test Code: {{datas.code}} Status: {{datas.status}} Data: {{datas.data}} Message: {{errMessage}} {{errorString}} REST call is being made when the button is clicked. I want to put a time limit to the request. (example: 30 seconds.) If the reply isn't received within the time limit then it should display an error message.
upvote count: 1
tagged with: ngresource
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26114368

http://stackoverflow.com/a/26172933
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: You can use method from String. System.out.println(String.format("This is [%s] test", name)); in your case, it would be: logger.error(String.format("Error in Filename = %s", s.getFileName())); For more formatting options: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
answers question: http://stackoverflow.com/q/26172361
score: 2
accepted answer of: http://stackoverflow.com/q/26172361
downvote count: 0

http://stackoverflow.com/comment/40985784
comment on: http://stackoverflow.com/q/26146620
has text: Which one is exactly failing?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26191230
linked to: http://stackoverflow.com/q/20740703
score: 0
has answer: http://stackoverflow.com/a/26192629
has body: I am new to spring and trying to write a pom.xml file to be executed with mvn exec:java. <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.satisfeet app 0.0.0 org.springframework.boot spring-boot-starter-parent 1.1.7.RELEASE com.satisfeet.Application <java.version>1.8</java.version> org.springframework.boot spring-boot-starter-web My directory structure is: /src |_ /main |__ /java |__ /com |__ /satisfeet |__ /core |__ /http |__ Application.java When I now run mvn package or mvn exec:java I get first a warning: java.lang.ClassNotFoundException: com.satisfeet.Application at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285) at java.lang.Thread.run(Thread.java:745) which then results in: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project app: An exception occured while executing the Java class. com.satisfeet.Application -> [Help 1] which I do not understand as the Application.java file should be correct: package com.satisfeet; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.ComponentScan; import com.satisfeet.http.CustomerController; @Configuration @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } What did I miss?
answer count: 1
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/41073466
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/41068771
has comment: http://stackoverflow.com/comment/41069500
has comment: http://stackoverflow.com/comment/41069065
has title: Spring-Starter pom.xml cannot find Application start class
type: Question
has comment: http://stackoverflow.com/comment/41073451

http://stackoverflow.com/comment/98762500
score: 0
type: Comment
has text: The easiest way to read a jar file from the (local) maven repository, as you seem to want to do, is simply to declare it as a dependency. That way, maven will handle the "where is this jar and how do I get it" for you. ;-)
comment on: http://stackoverflow.com/a/56003380
type: AnswerComment

http://stackoverflow.com/a/26107382
answers question: http://stackoverflow.com/q/26106819
type: Answer
has body: You should send each value of the array at a time. You can't send the array as it is as an argument to the bash script since it can't extract the values by itself. Process proc = Runtime.getRuntime().exec("/var/www/redbutton/marsh_webreset.sh "+array[0]+" "+ array[1]+" /");
score: 0

http://stackoverflow.com/q/26096097
tagged with: tomcat
favorite count: 0
has title: Java SSO with using waffle in Tomcat
type: UnansweredQuestion
tagged with: single-sign-on
has answer: http://stackoverflow.com/a/29300834
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/37523016
tagged with: waffle
upvote count: 5
answer count: 2
score: 5
downvote count: 0
has body: I am using following code to get actual logged in user: IWindowsSecurityContext clientContext = WindowsSecurityContextImpl.getCurrent("Negotiate", "localhost"); WindowsAuthProviderImpl provider = new WindowsAuthProviderImpl(); IWindowsSecurityContext serverContext = null; do { if (serverContext != null) { byte[] tokenForTheClientOnTheServer = serverContext.getToken(); SecBufferDesc continueToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, tokenForTheClientOnTheServer); clientContext.initialize(clientContext.getHandle(), continueToken, "localhost"); } byte[] tokenForTheServerOnTheClient = clientContext.getToken(); serverContext = provider.acceptSecurityToken("server-connection", tokenForTheServerOnTheClient, "Negotiate"); System.out.println("SSO-Identity: " + serverContext.getIdentity().getFqn()); } while (clientContext.getContinue()); System.out.println("Identity: " + serverContext.getIdentity().getFqn()); It works fine when I start it in Eclipse and returns my username. When I deploy my Web Application and start it in Tomcat, it returns nt-authority\system. But I need the name of the actual logged in user. (Using Waffle SSO in Tomcat works fine, but I have no possibility to get the name of the user) Please, anyone an idea? Edit: The user principal in eclipse is correct, too. When I start in Tomcat it is always null.

http://stackoverflow.com/q/26096086
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26111133
type: Question
has body: I want to make a list of all the predictions. I have this code : //Get File BufferedReader reader = new BufferedReader(new FileReader(PATH + "TempArffFile.arff")); //Get the data Instances data = new Instances(reader); reader.close(); //Setting class attribute data.setClassIndex(data.numAttributes() - 1); //Make tree J48 tree = new J48(); String[] options = new String[1]; options[0] = "-U"; tree.setOptions(options); tree.buildClassifier(data); //Print tree System.out.println(tree); It works fine i can see the tree printed , but dont know how to work with that from here. I want to make a list for each root how can i do that?
tagged with: java
score: 0
tagged with: weka
accepted answer: http://stackoverflow.com/a/26111133
answer count: 1
tagged with: decision-tree
has title: weka decision tree java

junit4
tags question: http://stackoverflow.com/q/26086739
tags question: http://stackoverflow.com/q/26086760
tags question: http://stackoverflow.com/q/26085096
tags question: http://stackoverflow.com/q/26158465
tags question: http://stackoverflow.com/q/26096401
tags question: http://stackoverflow.com/q/26118217
tags question: http://stackoverflow.com/q/26071236
type: Tag
tags question: http://stackoverflow.com/q/26102865
tags question: http://stackoverflow.com/q/26108999
tags question: http://stackoverflow.com/q/26059003
tag name: junit4

http://stackoverflow.com/comment/40915543
comment on: http://stackoverflow.com/a/26107970
type: AnswerComment
score: 0
type: Comment
has text: Then the master will forward the messages properly and will retrieve the suitable response?

static
tags question: http://stackoverflow.com/q/26042833
tags question: http://stackoverflow.com/q/26074023
tags question: http://stackoverflow.com/q/26188919
tags question: http://stackoverflow.com/q/26184754
tags question: http://stackoverflow.com/q/26119826
tag name: static
tags question: http://stackoverflow.com/q/26152038
tags question: http://stackoverflow.com/q/26064483
tags question: http://stackoverflow.com/q/26154149
tags question: http://stackoverflow.com/q/26131849
tags question: http://stackoverflow.com/q/26150272
type: Tag
tags question: http://stackoverflow.com/q/26070662
tags question: http://stackoverflow.com/q/26062051

http://stackoverflow.com/comment/40810028
comment on: http://stackoverflow.com/q/26050262
score: 0
type: Comment
type: QuestionComment
has text: Yes. I just want it to do that when the SAVE case is executed.

http://stackoverflow.com/comment/40948508
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26126115
has text: Input: op1 = 6, op2 = 7, hypo = 8 Output: 55.51°, 44.28°, 80.21°.

http://stackoverflow.com/comment/40808248
comment on: http://stackoverflow.com/a/26048907
has text: Please see my adjusted answer.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40900939
has text: Please provide more details
comment on: http://stackoverflow.com/q/26100245
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40851545
has text: Take a look at my answer. It didn't fully get it to work the way it's supposed to, but hopefully it gets you started in the right direction.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26072653

http://stackoverflow.com/comment/41040007
comment on: http://stackoverflow.com/q/26175371
score: 0
has text: According to [this article](https://intellij-support.jetbrains.com/entries/23358108) log should be exactly there, otherwise check **idea.log.path** property in `IDEA_home/bin/idea.properties` file to find out if the default log location path is changed.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40998061
comment on: http://stackoverflow.com/q/26153069
score: 0
type: Comment
type: QuestionComment
has text: Not very easily, no, and you're going to end up with blurry results. If you want to go ahead anyway, think about it as having a grid of colors superimposing a finer grid, and looking at the results of that finer grid. You will have to take a weighted average of 2 or 4 pixels for at least some of the pixels.

http://stackoverflow.com/comment/40908268
comment on: http://stackoverflow.com/q/26104193
score: 3
type: QuestionComment
type: Comment
has text: We don't really have enough context to tell, to be honest - aside from anything else, it depends on what you mean by "At what point is `Collections2.transform(...)` evaluated" - if you've got actions within that transformation, it may well be that `transform` is executed, but that it returns a value which will execute the individual actions later on.

opengl-es-2.0
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/26074297
tags question: http://stackoverflow.com/q/26184989
type: Tag

http://stackoverflow.com/a/26150173
downvote count: 0
answers question: http://stackoverflow.com/q/26149945
type: Answer
has comment: http://stackoverflow.com/comment/63003006
upvote count: 6
has comment: http://stackoverflow.com/comment/40993924
score: 6
has comment: http://stackoverflow.com/comment/78673439
has body: You may never receive an answer, since message delivery is not 100% guaranteed. As such, waiting indefinitely isn't a good approach -- you could well end up waiting forever. You probably want some level of timeout (perhaps a long one, if it suits), and then a fallback case where you re-send your request as necessary. This would be the more robust way of handling this situation.

http://stackoverflow.com/q/26155043
has comment: http://stackoverflow.com/comment/41031276
has comment: http://stackoverflow.com/comment/41031650
has comment: http://stackoverflow.com/comment/41132703
answer count: 0
has comment: http://stackoverflow.com/comment/41001382
tagged with: java
has comment: http://stackoverflow.com/comment/41001399
upvote count: 1
type: Question
downvote count: 0
tagged with: jar
has body: I have an application as jar file (that includes a bunch of classes.) Within the running of the application I want to create a new Jar file as an output. I can do this no problem if I get the individual classes from the current jar as a resource, write them to disk as respective classes, then when I create the new jar file read them all in and create the new JAR. However, I don't think this is smart nor efficient... and that I'm probably overlooking something really obvious... I'm hoping I can simply copy the resource over in memory without writing the files out again that I need. Today I do this: File[] list = new File { new File("Class1.class"); new File("Class2.class"); Manifest m = new Manifest(); m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); m.getMainAttributes().put(Attributes.Name.MAIN_CLASS, main_class); JarOutputStream target = new JarOutputStream(new FileOutputStream(fout), manifest); for(int n=0;n&lt;list.length;n++) { add(list,target) } target.close(); The Function add is per below: private static void add(File source, JarOutputStream target) throws IOException { BufferedInputStream in = null; try { JarEntry entry = new JarEntry(source.getPath().replace("\\", "/")); entry.setTime(source.lastModified()); target.putNextEntry(entry); in = new BufferedInputStream(new FileInputStream(source)); byte[] buffer = new byte[1024]; while (true) { int count = in.read(buffer); if(count == -1) break; target.write(buffer, 0, count); } target.closeEntry(); } finally { if (in != null) in.close(); } } Now this all works fine... but it relies on the fact that I'm reading the relevant class files from the disk. What I want to do is read the relevant class files from a resource jar file... AND THEN write the class files I want back out to a completely new jar file. Ideally what I want to do is this: Within the main application: InputStream[] stream = new InputStream[] { MyClass.class.getResourceAsStream("Class1.class"), MyClass.class.getResourceAsStream(…
has comment: http://stackoverflow.com/comment/41002373
score: 1
favorite count: 0
has title: Programmatically copy class files from within a jar to another jar
has comment: http://stackoverflow.com/comment/41031203
has comment: http://stackoverflow.com/comment/41001631
type: UnansweredQuestion

http://stackoverflow.com/q/26045244
score: 0
has answer: http://stackoverflow.com/a/26061109
has title: How to store the images and display the same on the screen using struts?
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26045536
has body: I want to store the images and display the same on the screen using struts. Is it better to store the images in database or on the file system? I have more than 10,000 images.
tagged with: java
tagged with: struts
type: Question
answer count: 2
tagged with: jsp
favorite count: 0

http://stackoverflow.com/comment/40883329
has text: Can you add the exception stack trace (printStackTrace of Exception object), so the line throwing NullPointerException can be identified?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26090262

http://stackoverflow.com/q/26035813
accepted answer: http://stackoverflow.com/a/26036707
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
has body: I've two tables, Organization and OrganizationReferent (that has a column as foreign key) as follows: By using Hibernate as ORM (in a JPA-compliant project), I've obtained entities ad shown here. I should manage CRUD operations by using Java EE 6-based Data Access Objects (DAOs). Both OrganizationDAO and OrganizationReferentDAO extends a GenericDAO Implementation that provides a create method as follows: @Override public EntityClass create(EntityClass entity) throws IllegalStateException, PersistenceException, ConstraintViolationException { entityManager.persist(entity); entityManager.flush(); return entity; } Now, I defined a Wrapper class with the aim to manage CRUD operations that involve the two defined tables: @Inject private OrganizationDAO organizationDAO; @Inject private OrganizationReferentDAO organizationReferentDAO; public final Organization createOrganization(final Organization organization) throws AlreadyExistsException, BadRequestException, DALException { assert(organization != null); organizationDAO.create(organization); }, public final OrganizationReferent createOrganizationReferent(final Long organizationId, final OrganizationReferent organizationReferent) throws ConstraintViolationException, AlreadyExistsException, BadRequestException, DALException { assert(organizationId != null); assert(organizationReferent != null); try { organizationReferent.setOrganization(organizationDAO.findById(organizationId)); organizationReferentDAO.create(organizationReferent); } catch (NotFoundException e) { throw new ConstraintViolationException(); } } Is this approach right or should I use something different? For the given cardinalities, should I force creations or edit the schema (for instance, changing from (1,*) to (0,*))?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26036707
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has title: CRUD operations by managing foreign key dependencies with Hibernate
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/41022354
has text: Strange this time I am getting TLE for long as well
comment on: http://stackoverflow.com/a/26166149
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40817437
has text: Can you explain what the return type of `retrieveAllCarType` is?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26054580
score: 0

http://stackoverflow.com/a/26112065
type: Answer
answers question: http://stackoverflow.com/q/26111826
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/40922861
has comment: http://stackoverflow.com/comment/40922940
score: 4
has body: You can't change the state of a UI element that is part of a displayed scene graph from a background thread. In Java 8, this throws an exception. In earlier versions of JavaFX, it may throw an exception or may fail silently. To fix this, either wrap the calls that update the scene graph in Platform.runLater(...): import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class UpdateLabelRegularly extends Application { @Override public void start(Stage primaryStage) { Label label = new Label(); VBox root = new VBox(); root.getChildren().add(label); ScheduledExecutorService exec = Executors.newScheduledThreadPool(5, r -&gt; { Thread t = new Thread(r); t.setDaemon(true); return t ; }); AtomicInteger count = new AtomicInteger(); Runnable task = () -&gt; { System.out.println("Hello world!"); Platform.runLater(() -&gt; label.setText("Count: "+count.incrementAndGet())); System.out.println("Hello again"); }; exec.scheduleAtFixedRate(task, 1, 1, TimeUnit.SECONDS); Scene scene = new Scene(root, 250, 75); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } Or use the javafx.concurrent.ScheduledService class: import java.util.concurrent.atomic.AtomicInteger; import javafx.application.Application; import javafx.concurrent.ScheduledService; import javafx.concurrent.Task; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.Duration; public class UpdateLabelRegularly extends Application { @Override public void start(Stage primaryStage) { Label label = new Label(); VBox root = new VBox(); root.getChildren().add(labe…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40922907
accepted answer of: http://stackoverflow.com/q/26111826
has comment: http://stackoverflow.com/comment/40923082
has comment: http://stackoverflow.com/comment/40922848

http://stackoverflow.com/comment/40797613
has text: Fair enough. Given your second code, I could delete `this.` and get the first one (my second question aka Weaker statement). Would that always work?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26043680
type: Comment

http://stackoverflow.com/comment/40903721
has text: My earlier comment mostly stands - you may have an older version of the jar on your Maven compile classpath which needs to be excluded. Do a mvn dependency:tree and see what is in there and what is transitively added to the Maven dependencies.
comment on: http://stackoverflow.com/q/26100947
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26161005
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41012482
has body: There are functions like rawQuery in which you can use the select clause and infact many more such functions. Go through the SQLiteDatabase class documentation properly.
answers question: http://stackoverflow.com/q/26160364

http://stackoverflow.com/a/26095173
downvote count: 0
has comment: http://stackoverflow.com/comment/40892659
has comment: http://stackoverflow.com/comment/40892438
score: 2
type: AcceptedAnswer
has body: You are trying to add the same TableRow again and again a Table. Which is causing exception: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. You should create a new TableRow in a loop itself Code snippet: Cursor cursor = dataBase.select("SELECT * FROM " + TABLE_NAME_PRODUCTS); while (cursor.moveToNext()){ TableRow tr = new TableRow(this); //set width and height using layout params tl.addView(tr); } Hope it helps.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40893921
has comment: http://stackoverflow.com/comment/40892986
has comment: http://stackoverflow.com/comment/40892632
has comment: http://stackoverflow.com/comment/40892402
answers question: http://stackoverflow.com/q/26095104
accepted answer of: http://stackoverflow.com/q/26095104

http://stackoverflow.com/a/26066080
downvote count: 0
has body: Try this: private static int greatestnum = '0'; public static void main(String[] args){ Scanner r = new Scanner(args[0]); String s = r.next().trim(); char c[] = s.toCharArray(); for ( int i = 0 ; i &lt; c.length ; i++ ) { if ( c[i] &gt; greatestnum ) { greatestnum = c[i]; } } System.out.println(greatestnum-48); } Explanation: The string is a sequence of characters Every character has a code ('0', ..., '9' are stored in this order => '0' &lt; '9' ) If you want to get back the number, you need to remove 48 from that char code
has comment: http://stackoverflow.com/comment/40839372
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26065805
upvote count: 1

http://stackoverflow.com/q/26113119
type: Question
has answer: http://stackoverflow.com/a/26113396
has comment: http://stackoverflow.com/comment/40924592
has comment: http://stackoverflow.com/comment/40924543
score: 0
answer count: 2
has title: How to iterate two List objects with enhanced for loops
has comment: http://stackoverflow.com/comment/40924284
possible better answer: http://stackoverflow.com/a/26113165
has answer: http://stackoverflow.com/a/26113165
has comment: http://stackoverflow.com/comment/40924481
has comment: http://stackoverflow.com/comment/40924276
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26113396
has comment: http://stackoverflow.com/comment/40924496
has comment: http://stackoverflow.com/comment/40924631
tagged with: java
tagged with: javafx
has body: I'm trying to iterate though two lists using for loops, but I get as many times iterations as the number of items in each lists. List&lt;String&gt; l = new ArrayList(); l.add("C:/Users/Public/Pictures/Sample Pictures/Koala.jpg"); l.add("E:/IMG_1241.mp4"); Image[] images = new Image[l.size()]; ImageView[] pics = new ImageView[l.size()]; for (final String imageResource : l) { for (int i = 0; i &lt; l.size(); i++) { With the above the program produces final 4 items. If List&lt;String&gt; l had four items, then 16, ie 4 items iterated 4 times, if three 9 items. I was thinkin a for loop like so for (int i = 0, int iL; int iL &lt; l.size(), i &lt; l.size(); iL++, i++) {, but I'm not sure how work it out. Please help. The full program looks something like so: public class TilePaneExample { public javafx.scene.layout.TilePane listItems() { List&lt;String&gt; l = new ArrayList(); l.add("C:/Users/Public/Music/Sample Music/Maid with the Flaxen Hair.mp3"); l.add("C:/Users/Public/Videos/Sample Videos/Wildlife.wmv"); l.add("C:/Users/Public/Pictures/Sample Pictures/Koala.jpg"); l.add("C:/Users/Public/Pictures/Sample Pictures/Desert.jpg"); // Pane javafx.scene.layout.TilePane tilePane = new javafx.scene.layout.TilePane(); tilePane.setHgap(2); tilePane.setVgap(2); tilePane.setMinWidth(250); Image[] images = new Image[l.size()]; ImageView[] pics = new ImageView[l.size()]; for (final String imageResource : l) { for (int i = 0; i &lt; l.size(); i++) { final String imageResourceItem = l.get(i); images[i] = new Image("file:" + "C:/Users/Public/Pictures/Sample Pictures/Lighthouse.jpg"); pics[i] = new ImageView(images[i]); pics[i].setFitWidth(22); pics[i].setPreserveRatio(true); pics[i].setSmooth(true); pics[i].setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { File f = new File(imageResourceItem); String absolutePath = f.getAbsolutePath(); if (imageResource.startsWith("file:")) { absolutePath = absolutePath.replace("\\standAloneDev\\j…
has comment: http://stackoverflow.com/comment/40924674
tagged with: loops

http://stackoverflow.com/comment/40969494
type: Comment
comment on: http://stackoverflow.com/a/26121938
has text: `sessionFactory` in your DAO layer is injected by Spring only?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41029917
comment on: http://stackoverflow.com/a/26169130
score: 0
type: AnswerComment
type: Comment
has text: @iAmMortos Ah, I didn't notice that. Yep, just a plain bad edit.

http://stackoverflow.com/comment/40886002
type: QuestionComment
has text: I'm not sure I understand you, but I have this line in my radio button: android:onClick="handleClickOne", does this mean I registered the click handler on the radio button?
comment on: http://stackoverflow.com/q/26091652
score: 0
type: Comment

http://stackoverflow.com/comment/40926718
comment on: http://stackoverflow.com/q/26113553
has text: @Test public void TCTwoStringCompare() { String str1 = "Kommunstyrelsens ordförande Kommunstyrelsens ordförande"; String str2 = "Kommunstyrelsens ordförande Kommunstyrelsens"; System.out.println(str1.contains(str2)); } //This is working
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26104891
answers question: http://stackoverflow.com/q/26104786
upvote count: 0
score: -1
type: Answer
has body: If you already added jar file into classpath and if it doesn't work I would try below on command prompt java -classpath example.jar;
downvote count: 1

http://stackoverflow.com/comment/41056233
comment on: http://stackoverflow.com/a/26177048
has text: thanks for feedback. makes sense. i will make changes accordingly.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40866282
comment on: http://stackoverflow.com/a/26080830
type: Comment
has text: Got it, put a <= in the second if statement.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42562029
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26979389
has text: Right - it's less readable than other solutions but it has the advantage that it doesn't modify an outside variable what is generally very important when you want to use parallel streams - think of race conditions.
score: 1

http://stackoverflow.com/a/26044395
score: 2
accepted answer of: http://stackoverflow.com/q/26039862
upvote count: 2
has body: It sounds like you want to dynamically inject your rowcallbackHandler because your making the object every time you execute the SQL. As a general best practice Spring dependency injection should really only be used on singleton-like objects (ie Services, DAO, etc..). That is callback like objects should not need or use dependency injection. Instead you need to wire your surrounding singleton-like object (@Service,@Controller,@Repository ... etc) with what your callbackhandler needs and then access the dependencies through constructor or regular-closure-like-lexical scoping (I forgot what its called in Java). I don't know what your skill level is in Java but it sounds like you might not know about anonymous classes. Here is an example using anonymous classes. @Service public MyService { @Autowired JdbcTemplate template; @Autowired Something something; public void doSomething() { template.query("select * from something", new RowCallbackHandler() { public void processRow(ResultSet rs) { System.out.println(something); //actually do something } }); } } That being said you can auto inject objects with new Blah() but it requires @Configurable AspectJ magic (don't do this unless you know what your doing).
has comment: http://stackoverflow.com/comment/40801385
answers question: http://stackoverflow.com/q/26039862
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26184988
has body: I agree with rolfl -> in both cases CME should be thrown... Most probable answer: addAll() is a first invocation, it throws Exception, and second piece of code is simply never reached -> you have forgotten to comment first part out and therefore think that add()-part is exception-free code ;)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26184532

http://stackoverflow.com/comment/40905141
comment on: http://stackoverflow.com/a/26101154
has text: @Alboz I found I'm misunderstandingly voted down your answer (something about SO FAC I misunderstood) , if you please edit any minor thing in it so that I can remove my downvote –
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/83950091
comment on: http://stackoverflow.com/a/26127981
type: Comment
score: 1
has text: FYI: Never call `getInstance` on every call, instead do it once at init and cache the value. `getInstance` can be _really_ slow because it does SPI related stuff
type: AnswerComment

http://stackoverflow.com/q/26149131
tagged with: soap-client
type: UnansweredQuestion
tagged with: soap
has answer: http://stackoverflow.com/a/26167579
has title: SOAP prefix soapenv has been already bound to http://
score: 0
tagged with: java
tagged with: jax-ws
type: Question
has body: I'm trying to add a custom namespace declaration to a SOAP request, more specifically: env.addNamespaceDeclaration("soapenv", "http://www.w3.org/2003/05/soap-envelope"); I'm doing this inside a SOAP Message Handler and according to the specs of the webservice I use, this namespace declaration is absolutely required. However as it seems, the jax-ws library always attempts to add this soapenv namespace declaration before sending the message and then fails like this: Exception in thread "main" javax.xml.ws.WebServiceException: javax.xml.stream.XMLStreamException: prefix soapenv has been already bound to http://www.w3.org/2003/05/soap-envelope. Rebinding it to http://schemas.xmlsoap.org/soap/envelope/ is an error at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:101) at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:267) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:196) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:163) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135) at com.sun.proxy.$Proxy32.getAccountBalance(Unknown Source) at XXXX.ClientTest.getAccountData(ClientTest.java:60) at XXXX.ClientTest.&lt;init&g…
answer count: 1

http://stackoverflow.com/a/28750973
downvote count: 0
has body: I had this weird error, too. I did a search in my jars in the web server's (tomcat) webapps/myapp/WEB-INF/lib and the class was there -- and only once. It went away when I looked at another project at my job and used the same jackson jars. Originally, I had the following: jackson-core-2.4.3.jar jackson-databind-2.4.3.jar I removed these and added the following (packaged into my WEB-INF/lib): jackson-mapper-asl-1.9.13.jar jackson-datatype-jsr310-2.5.0.jar jackson-datatype-joda-2.5.0.jar jackson-databind-2.5.0.jar jackson-core-2.5.0.jar jackson-annotations-2.5.0.jar I'm running this on Tomcat 7 on windows; using Java 1.6 (for compiling and runtime in Tomcat) servlet.xml: &lt;beans:bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" &gt; &lt;/beans:bean&gt; &lt;beans:bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; &lt;beans:property name="messageConverters"&gt; &lt;beans:list&gt; &lt;beans:ref bean="jacksonMessageConverter" /&gt; &lt;/beans:list&gt; &lt;/beans:property&gt; &lt;/beans:bean&gt; In case it helps, I run the following shell from cygwin for searching for jats JAR="C:/java/Java/jdk1.7.0_71/bin/jar.exe" srchdir="c:/appservers/apache-tomcat-7.0.57/webapps/my-web/WEB-INF/lib" echo "SEARCH FOLDER: $srchdir" find $srchdir -print | grep '\.jar$' | while read f do $JAR tf $f | grep 'MappingJackson2HttpMessageConverter\.class' &gt;/dev/null 2&gt;&amp;1 [ $? -eq 0 ] &amp;&amp; echo "==&gt; $f" &amp;&amp; $JAR tf $f | grep MappingJackson2HttpMessageConverter\.class done
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26140993
score: 3

http://stackoverflow.com/comment/40973207
type: QuestionComment
has text: can you do this line : System.out.println(databaseconn.arrayListHere()); right at the start, and tell us what the value is?
comment on: http://stackoverflow.com/q/26140044
score: 0
type: Comment

http://stackoverflow.com/a/26193945
has body: It stands for "Least Upper Bound" and is formally defined in §4.10.4. Least Upper Bound: The least upper bound, or "lub", of a set of reference types is a shared supertype that is more specific than any other shared supertype (that is, no other shared supertype is a subtype of the least upper bound).
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26193918
answers question: http://stackoverflow.com/q/26193918
type: Answer

http://stackoverflow.com/q/26095881
has answer: http://stackoverflow.com/a/60603196
has answer: http://stackoverflow.com/a/26096574
has answer: http://stackoverflow.com/a/46489590
has title: No found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
answer count: 19
downvote count: 1
has answer: http://stackoverflow.com/a/65137777
has answer: http://stackoverflow.com/a/71150819
has answer: http://stackoverflow.com/a/77934968
has answer: http://stackoverflow.com/a/62140330
favorite count: 0
has answer: http://stackoverflow.com/a/53611584
score: 102
has answer: http://stackoverflow.com/a/67285525
upvote count: 103
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/73034504
has body: I am trying to write a SOAP service using Spring, however I receive a Dependency Injection issue. I'm having problems using @Autowired through the Service like this: public interface UserDao { User getUser(String username); } Implementation for Dao as below: @Controller("userDao") public class UserDaoImpl implements UserDao { private static Log log = LogFactory.getLog(UserDaoImpl.class); @Autowired @Qualifier("sessionFactory") private LocalSessionFactoryBean sessionFactory; @Override public User getUser(String username) { Session session = sessionFactory.getObject().openSession(); // Criteria query = session.createCriteria(Student.class); Query query = session .createQuery("from User where username = :username"); query.setParameter("username", username); try { System.out.println("\n Load Student by ID query is running..."); /* * query.add(Restrictions.like("id", "%" + id + "%", * MatchMode.ANYWHERE)); return (Student) query.list(); */ return (User) query.uniqueResult(); } catch (Exception e) { // TODO: handle exception log.info(e.toString()); } finally { session.close(); } return null; } } and public interface UserBo { User loadUser(String username); } and public class UserBoImpl implements UserBo { @Autowired private UserDao userDao; @Override public User loadUser(String username) { // TODO Auto-generated method stub return userDao.getUser(username); } } @WebService @Component public class UserService { @Autowired private UserBo userBo; @WebMethod(operationName = "say") public String sayHello(String name) { return ("Hello Java to " + name); } @WebMethod(operationName = "getUser") public User getUser(String username) { return userBo.loadUser(username); } } The below is xml mapping file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core" xmlns:wss="http://jax…
tagged with: soap
has answer: http://stackoverflow.com/a/77141512
tagged with: web-services
tagged with: spring
has comment: http://stackoverflow.com/comment/40894213
has comment: http://stackoverflow.com/comment/40894061
has answer: http://stackoverflow.com/a/26096450
has comment: http://stackoverflow.com/comment/40894322
has answer: http://stackoverflow.com/a/44457496
has answer: http://stackoverflow.com/a/50133748
has answer: http://stackoverflow.com/a/26096034
has answer: http://stackoverflow.com/a/69196375
tagged with: java
has comment: http://stackoverflow.com/comment/53326649
has answer: http://stackoverflow.com/a/58077253
has answer: http://stackoverflow.com/a/45138655
has answer: http://stackoverflow.com/a/77813881
has answer: http://stackoverflow.com/a/26097053
type: Question
has comment: http://stackoverflow.com/comment/40893763

http://stackoverflow.com/comment/40926302
has text: Might be best to set this answer as accepted so that other people can see this is the possible solution.
comment on: http://stackoverflow.com/a/26114035
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41028054
comment on: http://stackoverflow.com/q/26167968
has text: @Joseph82 I tried to run the code without thread sync and everything works. the problem must be in how I set the sync
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40996909
comment on: http://stackoverflow.com/a/26135023
type: AnswerComment
score: 0
has text: That works! Thankyou. The only test that wouldn't work with your answer was when a word to be removed didn't appear in the String. This made the first letter get missed out when outputting to the String since the count is 0 and start is 0. I fixed this by putting an IF after the main loop to check whether both start and end = 0, if they didi I just returned 'word'.
type: Comment

http://stackoverflow.com/comment/40898452
has text: I agree with Marko. Another case that the regex doesn't handle is decimals (e.g. "20.0"). You could code a regex to handle this, but what do you gain?
comment on: http://stackoverflow.com/q/26098604
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40814628
comment on: http://stackoverflow.com/a/26053010
type: AnswerComment
score: 0
type: Comment
has text: Did you forget "String" inside <> here : `List<String> aa = new ArrayList<>(Arrays.asList(values));`

http://stackoverflow.com/comment/41072981
comment on: http://stackoverflow.com/q/26193797
type: Comment
type: QuestionComment
has text: What is an "outer this pointer?"
score: 1

http://stackoverflow.com/comment/43684944
has text: Hey David, sorry for the late reply but thanks for your answer!
comment on: http://stackoverflow.com/a/26105765
score: 0
type: AnswerComment
type: Comment

jdialog
type: Tag
tags question: http://stackoverflow.com/q/26045261
tag name: jdialog
tags question: http://stackoverflow.com/q/26162178
tags question: http://stackoverflow.com/q/26097260
tags question: http://stackoverflow.com/q/26096978

setter
tags question: http://stackoverflow.com/q/26113992
tags question: http://stackoverflow.com/q/26070920
type: Tag
tags question: http://stackoverflow.com/q/26094052
tag name: setter

http://stackoverflow.com/comment/41068309
has text: I don't have any such non standard configuration in maven, nor have I made any changes to the mvn script. I had imported the project earlier from the eclipse file. Moreover, the thing is I was working with this project in IntelliJ from past 3-4 weeks and there were no issues and the program was successfully getting compiled. Another thing, I have my project on the server. When I created a local copy of the project, except for the package Rserve, IntelliJ could recognize all the other external packages.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26190889
type: QuestionComment

http://stackoverflow.com/q/26106013
has comment: http://stackoverflow.com/comment/40913850
has comment: http://stackoverflow.com/comment/40912308
tagged with: android
has comment: http://stackoverflow.com/comment/40913811
has comment: http://stackoverflow.com/comment/40915656
has comment: http://stackoverflow.com/comment/40912211
has body: I want to concatenate the data of two String arrays into third, but every time I use this code to concatenate the arrays my App stops working and shutdown: ArrayList&lt;String&gt; SnoTitles3; SnoTitles3 = new ArrayList&lt;String&gt;(); SnoTitles3.addAll(Arrays.asList(SnoTitles2)); SnoTitles3.addAll(Arrays.asList(SnoTitles1)); String [] concatedArgs = SnoTitles3.toArray( new String[SnoTitles1.length +SnoTitles2.length]); I have read in one of the Stackoverflow question that the Arrays SnoTitles1 and SnoTitles2 needed to be declared as final in order to concatenate them into the third one, but I cannot use final keyword with those two arrays because the size of these arrays is undefined initially but the size and the data inside these arrays is declared before the concatenation. The data and the size of these two arrays are fetched from the XML, but everything is done before the concatenation part. One more thing, the app works fine when I remove above lines of code/ Logcat output: 09-29 18:16:55.327: E/SocketStream(333): readFully was waiting for 403440 bytes, got 49152 09-29 18:16:55.327: E/SocketStream(333): readFully was waiting for 354288 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 305136 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 255984 bytes, got 16384 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 239600 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 190448 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 141296 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 92144 bytes, got 5524 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 86620 bytes, got 49152 09-29 18:16:55.331: E/SocketStream(333): readFully was waiting for 37468 bytes, got 32768 09-29 18:16:55.367: E/Trace(1028): error opening trace file: No such file or directory (2) 09-29 18…
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/26106266
type: Question
has comment: http://stackoverflow.com/comment/40915874
score: 3
has comment: http://stackoverflow.com/comment/40911754
has comment: http://stackoverflow.com/comment/40911907
tagged with: java
has comment: http://stackoverflow.com/comment/40912167
has comment: http://stackoverflow.com/comment/40912222
has comment: http://stackoverflow.com/comment/40912135
accepted answer: http://stackoverflow.com/a/26106266
has comment: http://stackoverflow.com/comment/40914249
has title: Android: Couldn't be able to Concatenate two Arrays
tagged with: arrays
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26045490
has body: You can use Platform.exit() instead of stop() primaryStage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() { public void handle(WindowEvent e){ System.out.println("test"); try { Platform.exit(); } catch (Exception e1) { e1.printStackTrace(); } } }); Take a look at the JavaFX Application life cycle
has comment: http://stackoverflow.com/comment/40801512
has comment: http://stackoverflow.com/comment/40801375
has comment: http://stackoverflow.com/comment/40801881
answers question: http://stackoverflow.com/q/26044418
has comment: http://stackoverflow.com/comment/40801781
has comment: http://stackoverflow.com/comment/40802594
has comment: http://stackoverflow.com/comment/40802029
score: 0
has comment: http://stackoverflow.com/comment/40801990
has comment: http://stackoverflow.com/comment/40802296
has comment: http://stackoverflow.com/comment/40802448
type: Answer

http://stackoverflow.com/a/26129518
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40954799
has comment: http://stackoverflow.com/comment/40954761
type: Answer
has comment: http://stackoverflow.com/comment/40994851
score: 3
upvote count: 3
has body: Your regex is basically fine, but in Java you need to escape the \b: "((?:[a-zA-Z'-]+[^a-zA-Z'-]+){0,5}\\b)needle(\\b(?:[^a-zA-Z'-]+[a-zA-Z'-]+){0,5})"
has comment: http://stackoverflow.com/comment/40954936
accepted answer of: http://stackoverflow.com/q/26129384
answers question: http://stackoverflow.com/q/26129384
has comment: http://stackoverflow.com/comment/40955110

http://stackoverflow.com/comment/41005581
type: Comment
has text: did you add the mysql connector library to your library files?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26157397

http://stackoverflow.com/comment/40802507
type: Comment
type: QuestionComment
has text: You are assigning an int to a char. Instead, assign an arbitrary character, like '0', ' ', etc. Also, no operator is assigned to operator, so the program won't do anything meaningful with it. Does your method take any operands? Edit: you should research your question before posting it to Stack Overflow if you don't want it to be downvoted into oblivion.
comment on: http://stackoverflow.com/q/26045839
score: 0

http://stackoverflow.com/a/35196207
type: Answer
score: 0
has body: This works, but have to re-import all the project from the workspace, as we are deleting the metadata.
answers question: http://stackoverflow.com/q/26073572

http://stackoverflow.com/comment/41031203
type: QuestionComment
type: Comment
has text: @MadProgrammer that's pretty much what I want to do. I'm trying to do this without writing the unzipped resource to the filesystem. I only want to write the new Jar. So, unless there is another way, I want my "add" function above to take an InputStream array of the resources.
comment on: http://stackoverflow.com/q/26155043
score: 0

http://stackoverflow.com/a/26085512
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26085454
has body: Math.random() will only return numbers in range 0..1. You could scale this by multipling by range and adding on minimum. Or use java.util.Random(), this has a handy method nextInt() which will return between 0 and &lt; value. So you need to go 0&lt;= value &lt; 5 to have values 0, 1, 2, 3, 4 import java.util.Random; public class RandomTest { public static void main(String[] args) { Random random = new Random(); for (int i = 1; i &lt;= 10; i++) { int value = 16 + random.nextInt(5); System.out.println(value); } } }
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26085454
upvote count: 2

http://stackoverflow.com/comment/41058545
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26185602
has text: Thanks! Gotcha, makes sense to me. :)
type: Comment

http://stackoverflow.com/q/26150646
favorite count: 0
has answer: http://stackoverflow.com/a/26155394
has title: Simple TCP connection program, what am I looking at, and how can I fix it?
type: UnansweredQuestion
tagged with: tcp
has answer: http://stackoverflow.com/a/26150666
tagged with: java
type: Question
answer count: 2
has body: I am currently creating a simple client that requests the Time from a host, and prints whatever the response is. I am very confused as to what I am looking at, as the output is something I have never seen before. Here is my client code, import java.io.*; import java.net.*; import java.util.*; /* * * Time tcp client */ public class TimeTcp { public final static int TIME_PORT = 37; public final static int SIZE = 1024; public static void main(String[] args) throws IOException { if(args.length &lt; 1) { System.out.println("usage: java TimeTcp host"); System.exit(1); } String host = args[0]; Socket socket = new Socket(host, TIME_PORT); DataInputStream fromServer = new DataInputStream( socket.getInputStream()); byte[] read = new byte[SIZE]; fromServer.read(read); System.out.println(read.toString()); } } However, my output looks like this: [B@4e25154f Literally, that's all it prints. What am I doing wrong? Am I supposed to convert something? Thanks! EDIT: Thanks to kolossus for helping me figure out what I am looking at. However, What I am supposed to be printing out is the Time gotten from the Time server that I am calling from. I am trying to use the byte array to read in whatever the server sends back as the time, then read it into a single variable, then convert it into a value that can be used by Java (the Time server protocol sends 32 bit unsigned values, and Java doesn't support those) so that it can be printed back to the user that called the client. Is there a good way to do this?
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/26159453
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26159466
answer count: 2
has title: How to implement Azure Cloud Service's RoleEntryPoint.OnStop method in Java
has answer: http://stackoverflow.com/a/26160334
downvote count: 0
possible better answer: http://stackoverflow.com/a/26159466
has body: When Azure shuts down a Cloud Service instance (e.g. when the host OS reboots, or when autoscaling down), it triggers a Stop method, so applications have a chance to gracefully shutdown. I can find documentation how to do this in .NET: http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.onstop.aspx?cs-save-lang=1&amp;cs-lang=csharp#code-snippet-1 but I cannot find any documentation on how to do this from Java. How can I do this in Java?
tagged with: azure
score: 1
favorite count: 0
tagged with: azure-cloud-services
accepted answer: http://stackoverflow.com/a/26160334
type: AnsweredQuestion

http://stackoverflow.com/a/26092306
upvote count: 1
has body: In class Car, you have a constructor that has 4 parameters. However in the main class, you create a Car with 0 or 3 parameters. In other to run the code, you have to add 2 more constructor, one with 0 parameter, and one with 3 parameters. public Car() { } public Car(String b, int year, int price) { yearModel = year; brand = b; priceModel = price; }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26092179

http://stackoverflow.com/comment/40896659
has text: are you modifying any instance level / class level fields in your second method?. If it is modifying only *method-local* variables, then it is thread safe.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26097597
score: 0

http://stackoverflow.com/q/26047929
tagged with: enums
has answer: http://stackoverflow.com/a/26048031
possible better answer: http://stackoverflow.com/a/26048006
tagged with: java
has answer: http://stackoverflow.com/a/26048006
score: 4
accepted answer: http://stackoverflow.com/a/26048038
tagged with: switch-statement
type: Question
upvote count: 4
tagged with: java-7
has comment: http://stackoverflow.com/comment/40805784
has title: How to use enum class in switch case
downvote count: 0
has comment: http://stackoverflow.com/comment/40805903
favorite count: 0
has body: Am getting error - case expressions must be constant expressions , when am trying to use enum class in switch case statements : My enum class is, public enum TestEnumClass { TEST1("TEST1"), TEST2("TEST2"), TEST3("TEST3"); private String enumConstant; private TestEnumClass(String algoConstant) { this.enumConstant = algoConstant; } public String getEnumConstant() { return enumConstant; } } And am trying to use enum TestEnumClass as below in another class file, public class TestIndexOf { public static void main(String[] args) { String str = args[0]; switch(str){ case TestEnumClass.Test1.getEnumConstant() : System.out.println("test1"); break; case TestEnumClass.Test2.getEnumConstant() : System.out.println("test2"); break; } } } Its giving me compile time error : case expressions must be constant expressions Please suggest me, where am I going wrong.
answer count: 3
has comment: http://stackoverflow.com/comment/40805639
has answer: http://stackoverflow.com/a/26048038
tagged with: compiler-errors
type: AnsweredQuestion

http://stackoverflow.com/a/26097970
answers question: http://stackoverflow.com/q/26097953
has body: use &lt;a&gt; tag &amp; using QueryString pass the value of textbox to other JSP page. &lt;a href="pass.jsp" onclick="addTextBoxData(this)"&gt; &lt;script&gt; function addTextBoxData(e){ e.href = e.href + "?textbox=" + document.getElementById('textboxID').value; } &lt;/script&gt; you just need to pass reference of tag using this. then it ll append data ?textbox=textbox value so it ll be /pass.jsp?textbox=txt
downvote count: 0
has comment: http://stackoverflow.com/comment/40922644
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40907595
upvote count: 1

http://stackoverflow.com/q/26110716
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26110987
accepted answer: http://stackoverflow.com/a/26110987
tagged with: java
tagged with: look-and-feel
type: Question
score: 5
has title: Is there a way to get a look and feel of windows 8 metro on java desktop application?
tagged with: windows-8
upvote count: 5
linked to: http://stackoverflow.com/q/14589714
has body: I am really struggling to find a good answer to this question, as stated in the Title. I am currently developing an application that will be desktop only with no CSS or any internet parts at all. I would like it to look like the metro look of Windows 8. I'm not talking about the layout but the look and feel. I would especially like the buttons that are square and not rounded but all the other flat square look and feel too. The following link is the opposite of what I'm looking for, as a reference. About Metro GUI in desktop application This read was at least a little closer to a discussion on native look and feel and java. However it doesn't actually give any concrete ways to get for instance a square flat button: https://softwareengineering.stackexchange.com/questions/226521/why-is-it-hard-to-make-a-java-program-appear-native Currently I am using Eclipse but I'm not stuck on using that necessarily, but it wold be easiest. I have been looking into JavaFx but it doesn't seem to have square buttons or a metro feel at all from what I've read but maybe I'm missing something. Can any one point me in a good direction on how to make the look and feel simple?
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/41000178
type: AnswerComment
comment on: http://stackoverflow.com/a/26153806
type: Comment
has text: Hi Rishi Actually I AM FACING THE PROBLEM FROM THE STEP**("CLICKING ON COUNTRY AND SELECT THE UNITED STATES")** The country Xpath is //*[@id=j_id0:j_id21:reAssignCountryList'] and Class name is styled_select_small. pls help me to move forward. THANK U
score: 0

http://stackoverflow.com/comment/40998285
comment on: http://stackoverflow.com/a/26153307
type: Comment
has text: do you know whether there are any benchmarks between BigInteger and OpenBitSet and BitSet (or any other library) for performing logical OR?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26073828
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40853030
type: Answer
has body: Here is a copypaste of my very old simple Java Graphics+BufferStrategy gameloop test app. Animation loop draws few moving rectangles and fps counter. java -cp ./lib/test.jar GameLoop2 "fullscreen=false" "fps=60" "vsync=true" //http://www.javagaming.org/index.php/topic,19971.0.html //http://fivedots.coe.psu.ac.th/~ad/jg/ch1/ch1.pdf import java.util.*; import java.awt.Color; import java.awt.Frame; import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferStrategy; import java.awt.DisplayMode; // for full-screen mode public class GameLoop2 implements KeyListener { Frame mainFrame; private static final long NANO_IN_MILLI = 1000000L; // num of iterations with a sleep delay of 0ms before // game loop yields to other threads. private static final int NO_DELAYS_PER_YIELD = 16; // max num of renderings that can be skipped in one game loop, // game's internal state is updated but not rendered on screen. private static int MAX_RENDER_SKIPS = 5; private static int TARGET_FPS = 60; //private long prevStatsTime; private long gameStartTime; private long curRenderTime; private long rendersSkipped = 0L; private long period; // period between rendering in nanosecs long fps; long frameCounter; long lastFpsTime; Rectangle2D rect, rect2, rect3; /** * Create a new GameLoop that will use the specified GraphicsDevice. * * @param device */ public GameLoop2(Map&lt;String,String&gt; args, GraphicsDevice device) { try { if (args.containsKey("fps")) TARGET_FPS = Integer.parseInt(args.get("fps")); // Setup the frame GraphicsConfiguration gc = device.getDefaultConfiguration(); mainFrame = new Frame(gc); //mainFrame.setUndecorated(true); mainFrame.setIgnoreRepaint(true); mainFrame.setVisible(true); mainFrame.setSize(640, 480); //mainFrame.setLocationRelativeTo(); mainFram…
has comment: http://stackoverflow.com/comment/40852949
downvote count: 0
answers question: http://stackoverflow.com/q/26073621

http://stackoverflow.com/comment/40804564
has text: Because it looked like all the Poisson data I looked at was doubles, I'm really not sure how this works.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26046889

http://stackoverflow.com/a/26052920
upvote count: 1
answers question: http://stackoverflow.com/q/26052826
downvote count: 0
type: Answer
has body: As long as the Interface is properly implemented, writing a remove method that throws an Exception is completely legal. So, no you won't know until it breaks... That is when Javadoc comes handy.
score: 1

http://stackoverflow.com/comment/40922786
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/26112250
has text: I don't even think this compiles.

http://stackoverflow.com/q/26035707
has answer: http://stackoverflow.com/a/26036092
tagged with: arraylist
score: 0
tagged with: while-loop
answer count: 1
has body: I am trying to use scanner to read in several lines of input at a time. I reckon that there is something wrong with either the way I use the loop, or the way I read in information. Nothing was stored in the output array. I commented my question in the code. Can someone please help? Thank you! Scanner c = new Scanner (System.in); while (c.hasNextLine()){ ArrayList &lt;Integer&gt; record= new ArrayList &lt;Integer&gt; (); // next time the while loop runs, I expect the list record to be initialized again String numbers = c.nextLine(); int n = Integer.parseInt(numbers); for (int i=0; i&lt;n; i++){ String info = c.nextLine();//then read the following n lines use for loop int length = info.length(); //get the length of each line record.add(length); } putRecordinArray(record);//some other function to process each record(a block of several lines processed each time by the while loop) } //here I tried to print out the array A generated by other function, but nothing was stored. }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40787447
has title: java- use scanner to read in and process one piece of information at a time
tagged with: java
tagged with: system.in
tagged with: loops
type: Question

http://stackoverflow.com/a/28489739
has body: Manifest-Version: 1.0 ... Dependencies: org.hibernate, org.hibernate.envers
accepted answer of: http://stackoverflow.com/q/26045312
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26045312
score: 0
type: Answer

http://stackoverflow.com/q/26058317
type: Question
has comment: http://stackoverflow.com/comment/40824453
tagged with: android
score: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40824959
type: UnansweredQuestion
has title: Cancel or Interrupt runOnUiThread(Runnable) [Android]
has comment: http://stackoverflow.com/comment/40825907
has body: At the core, my Android application consists of navigating between panels that fetch and display content. Each panel calls fetchContent on a background thread, and then after the content is fetched, fetchContent calls runOnUiThread(displayContent) , to display the content. When the user switches panels, an event called panelSwitch is called. If the user switches panels before the content is fetched, then panelSwitch cancels/interrupts fetchContent, which in turn handles the interruption by not calling displayContent. However, I was thinking that if there is stuff already happening on the UI thread when the user switches panels, then panelSwitch is pushed to the back of the event queue. Then, if the background thread finishes fetching the content before panelSwitch reaches the front of the queue, then runOnUiThread(displayContent) will push displayContent to the end of the event queue, after panelSwitch. This means that the UI will switch panels and then the content from the previous panel will be displayed, which is wrong. Is there a way to cancel/interrupt displayContent like I do with fetchContent?
answer count: 0

http://stackoverflow.com/q/26156523
accepted answer: http://stackoverflow.com/a/26156657
has title: Is writeObject() not necessary using the Serialization Proxy Pattern?
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/26156657
type: Question
has body: I am using the Serialization Proxy Pattern for a bunch of my classes and recently added FindBugs to my build process, and now I am wondering whether FindBugs is correct... This is the class in question: public class Block implements Serializable { private static final long serialVersionUID = 584958030434385L; private final float confidence; private final Rectangle boundingBox; private final Rectangle baseline; private final BufferedImage binaryImage; private final List&lt;Paragraph&gt; paragraphs; private TessResult parentTessResult; private Block(final float confidence, final Rectangle boundingBox, final Rectangle baseline, final BufferedImage binaryImage, final List&lt;Paragraph&gt; paragraphs) { this.confidence = confidence; this.boundingBox = Objects.requireNonNull(boundingBox, "boundingBox"); this.baseline = Objects.requireNonNull(baseline, "baseline"); this.binaryImage = binaryImage; this.paragraphs = Objects.requireNonNull(paragraphs, "paragraphs"); } void setParentTessResult(final TessResult parentTessResult) { this.parentTessResult = Objects.requireNonNull(parentTessResult, "parentTessResult"); } public float getConfidence() { return confidence; } public Rectangle getBoundingBox() { return boundingBox; } public Rectangle getBaseline() { return baseline; } public BufferedImage getBinaryImage() { return binaryImage; } public List&lt;Paragraph&gt; getParagraphs() { return paragraphs; } public TessResult getParentTessResult() { return parentTessResult; } public static class BlockBuilder { private final float confidence; private final Rectangle boundingBox; private final Rectangle baseline; private final BufferedImage binaryImage; private final List&lt;Paragraph&gt; paragraphs = new ArrayList&lt;&gt;(); public BlockBuilder(final float confidence, final Rectangle boundingBox, final Rectangle baseline, final BufferedImage binaryImage) { this.confidence = confidence; this.boundingBox = boundingBox; this.baseline = baseline; this.binaryImage = binaryImage; } public …
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/40870513
comment on: http://stackoverflow.com/q/26083139
has text: Ya it should.. but sadly im unable to find a way to do that.. as everything is connected in one way.. which means.. A would for example have 2 connected vertices.. but F (the last one in line) would have 0, as they are connected to him, not the way around.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26037831
has answer: http://stackoverflow.com/a/26037996
has answer: http://stackoverflow.com/a/26037980
score: 0
has answer: http://stackoverflow.com/a/26037953
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26037978
has comment: http://stackoverflow.com/comment/40786388
tagged with: java
has answer: http://stackoverflow.com/a/26037979
answer count: 6
tagged with: loops
has body: Here's my Java Code: public class DVD { public static void main(String[] args) { DVD newdvd1 = new DVD(); newdvd1.setPlayit("The song is playing \n"); newdvd1.setArtist("Eva Cassidy"); newdvd1.setTitle("Songbird"); newdvd1.setGenre("Blues"); System.out.println(newdvd1.getPlayit()); System.out.println(newdvd1); DVD newdvd2 = new DVD(); newdvd2.setPlayit("The next song is playing \n"); newdvd2.setArtist("an unknown artist"); newdvd2.setTitle("new song"); System.out.println(newdvd2.getPlayit()); System.out.println(newdvd2); } private String artist; private String title; private String genre; private String playit; public String getPlayit() { return playit; } public void setPlayit(String playit) { this.playit = playit; } public String getArtist() { return artist; } public void setArtist(String artist) { this.artist = artist; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public String toString () { return ("The artist is called " + artist + " who is a "+ genre + " singer" + " and this song is called " + title + ".\n"); } } what it outputs is: The song is playing The artist is called Eva Cassidy who is a Blues singer and this song is called Songbird. The next song is playing The artist is called an unknown artist who is a null singer and this song is called new song. What i'm asking is, in the second song, how do i leave out 'null singer' as I don't want to display the second songs genre?
type: Question
has title: How to leave out a null value in a loop in Java
has answer: http://stackoverflow.com/a/26038001

http://stackoverflow.com/q/26090262
favorite count: 0
has comment: http://stackoverflow.com/comment/66789352
has comment: http://stackoverflow.com/comment/40883329
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
tagged with: java
has title: Array throws NullPointerException in Java
score: -1
has answer: http://stackoverflow.com/a/26090362
tagged with: methods
has comment: http://stackoverflow.com/comment/40883243
has comment: http://stackoverflow.com/comment/40883343
type: Question
answer count: 2
tagged with: null
upvote count: 0
tagged with: arrays
linked to: http://stackoverflow.com/q/30021160
has comment: http://stackoverflow.com/comment/40883257
possible better answer: http://stackoverflow.com/a/26090309
tagged with: nullpointerexception
has body: I have the following little problem... I have this code that uses the method OpenFile() of one class ReadData to read a .txt file and also I have another class ArraysTZones used to create an object that stores 3 arrays (data1,data2,data3) and 3 integers (total1,total2,total3) returned by the method OpenFile(). The problem is that when I try to display each array (data1,data2,data3) using the method getArray() of ArrayTZones it stops and displays the error NullPointerException. Anyone knows how could I fix this? public static void main (String args[]) throws IOException { String fileName = ".//data.txt"; int[] def = new int[180]; try { ReadData file = new ReadData(fileName); ArraysTZones summaryatz = new ArraysTZones(); summaryatz = file.OpenFile(); for (int i = 0; i &lt; 180; i++) System.out.print (summaryatz.getArray1()[i] + " "); System.out.println (""); System.out.println (summaryatz.getTotal1()); for (int i = 0; i &lt; 180; i++) System.out.print (summaryatz.getArray2()[i] + " "); System.out.println (""); System.out.println (summaryatz.getTotal2()); for (int i = 0; i &lt; 180; i++) System.out.print (summaryatz.getArray3()[i] + " "); System.out.println (""); System.out.println (summaryatz.getTotal3()); } catch (IOException e) { System.out.println(e.getMessage()); } } Heres OpenFile() public ArraysTZones OpenFile() throws IOException { FileReader reader = new FileReader(path); BufferedReader textReader = new BufferedReader(reader); int numberOfTimeZones = 3; int[] data1 = new int[180]; int[] data2 = new int[180]; int[] data3 = new int[180]; int total1 = 0; int total2 = 0; int total3 = 0; ArraysTZones atz = new ArraysTZones(); for (int i = 0; i &lt; numberOfTimeZones; i++){ if (i == 0) { String firstTimeZone = textReader.readLine(); String[] val = firstTimeZone.split ("\\s+"); for (int u = 0; u &lt; val.length; u++) { int stats = (int)(Math.ceil(Math.abs(Double.parseDouble(val[u])))); total1 += stats; data1[u] = stats; } total1= total1/180; atz.setTotal1(total1); at…
has comment: http://stackoverflow.com/comment/66790490
has comment: http://stackoverflow.com/comment/40883395
has answer: http://stackoverflow.com/a/26090309
accepted answer: http://stackoverflow.com/a/26090362
has comment: http://stackoverflow.com/comment/40883264

http://stackoverflow.com/comment/40830595
type: Comment
comment on: http://stackoverflow.com/a/26061396
has text: Dont mind ignorance, but I am not really sure what a byte code is. So ill look at that first
score: 0
type: AnswerComment

http://stackoverflow.com/a/26184897
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41058632
has body: Personally, I prefer classes like that being singletons. First, like you mentioned, it's easier to handle IOExceptions from within your code instead of having to deal with them being thrown at seemingly random times and failing the classloader. Second, I really prefer singletons as they are still instances - and as such they're easier to replace when you're testing. The simple java version of this principle could look like this: public class MyProductionClass { protected DataHolder getDataHolder() { return DataHolder.getInstance(); } public int addOneToDataHolder() { return getDataHolder.getIntData() + 1; } } Now, assume I want to test the business logic of addOneToDataHolder(). All I have to do is mock away the getDataHolder() method: @RunWith(MockitoJUnitRunner.class) public class MyProductionClassTest { @Mock private DataHolder dh; private MyProductionClass prod; @Before public void setUp() { MyProductionClass prod = spy(new MyProductionClass()); doReturn(dh).when(prod).getDataHolder(); } @Test public void testAddOneToDataHolder() { when(getDataHolder.getIntData()).thenReturn(1); assertEquals(2, prod.addOneToDataHolder()); } } Of course, with any CDI framework, this wold look even cleaner.
upvote count: 2
answers question: http://stackoverflow.com/q/26184754
type: Answer

http://stackoverflow.com/comment/41022595
has text: So what should I use Instead?. BufferedReader?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26166149

http://stackoverflow.com/comment/41064080
comment on: http://stackoverflow.com/a/26188435
type: Comment
has text: Ok, I missed it in `onCreate()`. I thought you were referring to where it is done in `onClick()`
type: AnswerComment
score: 0

http://stackoverflow.com/q/26051880
has body: I have a dynamic web app (java and tomcat 7) In a servlet AsyncContext asyncContext = request.startAsync(request,response); Connection con = (Connection) getServletContext().getAttribute("DBConnection"); asyncContext.start(new BackgroundTask(newFile, user.getEmail(), configDoc, con, user.getId())); response.sendRedirect("/fit/home"); But sendRedirect don't work? How can I fix it?
has comment: http://stackoverflow.com/comment/41935742
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40852904
type: UnansweredQuestion
tagged with: servlet-3.0
has comment: http://stackoverflow.com/comment/40812703
answer count: 0
has comment: http://stackoverflow.com/comment/40812676
has comment: http://stackoverflow.com/comment/40813704
type: Question
has title: sendRedirect don't work after AsyncContext

http://stackoverflow.com/comment/40812716
score: 0
type: AnswerComment
has text: Thanks, but I'm looking for the recursive solution. Its not so much the conceptualization, but the implementation that I don't understand
type: Comment
comment on: http://stackoverflow.com/a/26051835

http://stackoverflow.com/q/26059330
has body: I have a java form like now in the same JSP i need to set this file attribute a have a file ,but not by browsing but by simply adding the path or something like this. I need to make this automated any ways to achieve this ??
tagged with: java
tagged with: forms
has comment: http://stackoverflow.com/comment/40826398
type: Question
has comment: http://stackoverflow.com/comment/40827303
has comment: http://stackoverflow.com/comment/40837363
has comment: http://stackoverflow.com/comment/40827234
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/40827170
has comment: http://stackoverflow.com/comment/40827378
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40826728
has title: how to set a file in a fileInput in an HTML form
has comment: http://stackoverflow.com/comment/40828740

http://stackoverflow.com/q/26052064
has comment: http://stackoverflow.com/comment/40813376
tagged with: database
has comment: http://stackoverflow.com/comment/40813252
tagged with: jtable
answer count: 1
downvote count: 0
score: 1
has title: JTable is not appending data from database
favorite count: 0
has answer: http://stackoverflow.com/a/26052571
tagged with: jdbc
linked to: http://stackoverflow.com/q/6592468
has comment: http://stackoverflow.com/comment/40813079
has comment: http://stackoverflow.com/comment/40813341
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26052571
tagged with: swing
has comment: http://stackoverflow.com/comment/40813060
has comment: http://stackoverflow.com/comment/40813118
type: Question
has body: I have a project set up with with an embedded derby jdbc and a jtable, however when I try to append data from my database to my jtable through resultset and adding the results from the resultset to a string[] and adding it to my tablemodel the result display is blank. This is my database resultset: ResultSet res = statement.executeQuery("SELECT * FROM VAULT"); while (res.next()) { String [] row = {res.getString("Expenses"), res.getString("ExpensesType"), res.getString("PaymentType"), res.getString("Amount"), res.getString("Date")}; System.out.print(res.getString("Expenses")); System.out.print(res.getString("ExpensesType")); System.out.print(res.getString("PaymentType")); System.out.print(res.getString("Amount")); System.out.print(res.getString("Date")); GUI.tableModel.addRow(row); GUI.tableModel.fireTableDataChanged(); } res.close(); This is my table code: table = new JTable(tableModel); table.setBackground(Color.GRAY); table.setFillsViewportHeight(true); JTableHeader header = table.getTableHeader(); header.setBackground(Color.DARK_GRAY); header.setForeground(Color.LIGHT_GRAY); scrollPane.setViewportView(table); tableModel.addColumn("Expenses"); tableModel.addColumn("Expense Type"); tableModel.addColumn("Payment Type"); tableModel.addColumn("Amount"); tableModel.addColumn("Date");
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40813000

http://stackoverflow.com/a/26060037
has comment: http://stackoverflow.com/comment/40827295
answers question: http://stackoverflow.com/q/26059849
has comment: http://stackoverflow.com/comment/40827485
has body: Simply create another iterator int count = 0; while(iter1.hasNext()){ count++; char char1 = iter1.next().charValue(); Iterator&lt;Character&gt; iter2 = list.iterator(); //Skip first count elements for(int j; j&lt;count; j++){ iter2.next(); } while (iter2.hasNext()){ char char2 = iter2.next().charValue(); System.out.print("("+char1+", "+char2+") "); } } You can have several of them simultaneously.
score: 0
type: Answer

http://stackoverflow.com/comment/40898154
comment on: http://stackoverflow.com/q/26098604
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [Does java have a int.tryparse that doesn't throw an exception for bad data?](http://stackoverflow.com/questions/8391979/does-java-have-a-int-tryparse-that-doesnt-throw-an-exception-for-bad-data)

http://stackoverflow.com/comment/40891815
has text: @Zany Of course because the actual time doesn't fit in an int. It means that you can't convert timestamp into an int.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26094841

http://stackoverflow.com/q/26183655
has comment: http://stackoverflow.com/comment/41055588
has body: I am trying to pull out records based on some comparison between two timstamps. here is my supposed code, but it is not working: @Query("SELECT n FROM table1 n WHERE n.status IN ('FAILED') AND :currentDate- n.updatedDate &gt; n.interval/24*60*60") List&lt;Entity&gt; findAllSuchEntities(@Param("currentDate") DateTime currentDate); The error message is : org.h2.jdbc.JdbcSQLException: Unknown data type: "?"; SQL statement. In comparison, following query can pass compilation: @Query("SELECT n FROM table1 n WHERE n.status IN ('FAILED') AND :currentDate &gt; n.updatedDate") List&lt;Entity&gt; findAllSuchEntities(@Param("currentDate") DateTime currentDate);
has comment: http://stackoverflow.com/comment/41055375
has title: How to write query to compare difference between two timestamps with a timeinterval
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26184176
tagged with: timestamp
tagged with: java
score: -1
downvote count: 1
type: Question
upvote count: 0
tagged with: jpa
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26174832
type: Question
tagged with: jframe
score: 0
answer count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/26174892
tagged with: java
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/26174956
has answer: http://stackoverflow.com/a/26174956
has body: For some reason I can't get the BorderLayout to set the way it's supposed to. Just would like to know where I'm going wrong. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColorFactory extends JFrame { final int width = 500; final int height = 300; private JPanel buttonPanel; private JPanel radioButtonPanel; private JLabel msgChangeColor; public ColorFactory() { setTitle("Color Factory"); setSize(width, height); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); createTopPanel(); add(buttonPanel, BorderLayout.NORTH); createBottomPanel(); add(radioButtonPanel, BorderLayout.SOUTH); msgChangeColor = new JLabel("Top buttons change the panel color and bottom radio buttons change the text color."); add(msgChangeColor, BorderLayout.CENTER); pack(); } private void createTopPanel() { buttonPanel = new JPanel(); setLayout(new FlowLayout()); JButton redButton = new JButton("Red"); redButton.setBackground(Color.RED); redButton.addActionListener(new ButtonListener()); redButton.setActionCommand("R"); JButton orangeButton = new JButton("Orange"); orangeButton.setBackground(Color.ORANGE); orangeButton.addActionListener(new ButtonListener()); orangeButton.setActionCommand("O"); JButton yellowButton = new JButton("Yellow"); yellowButton.setBackground(Color.YELLOW); yellowButton.addActionListener(new ButtonListener()); yellowButton.setActionCommand("Y"); buttonPanel.add(redButton); buttonPanel.add(orangeButton); buttonPanel.add(yellowButton); } private void createBottomPanel() { radioButtonPanel = new JPanel(); setLayout(new FlowLayout()); JRadioButton greenRadioButton = new JRadioButton("Green"); greenRadioButton.setBackground(Color.GREEN); greenRadioButton.addActionListener(new RadioButtonListener()); greenRadioButton.setActionCommand("G"); JButton blueRadioButton = new JButton("Blue"); blueRadioButton.setBackground(Color.BLUE); blueRadioButton.addActionListener(new RadioButtonListener()); blueRadioButton.setActionCommand(…
tagged with: layout-manager
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26174892
has title: BorderLayout not working JFrame

http://stackoverflow.com/comment/58881823
score: 0
has text: @Baz should the setEnabled(false) also help with not stealing focus from inside the same application from where the new shell is launched?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26120123

unsupported-class-version
type: Tag
tags question: http://stackoverflow.com/q/26181347
tag name: unsupported-class-version

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/26178488
tags question: http://stackoverflow.com/q/26165433
type: Tag
tags question: http://stackoverflow.com/q/26086468

http://stackoverflow.com/q/26056268
favorite count: 0
tagged with: nullpointerexception
has body: I run robolectric unit test on my android project. My environment is : robolectric 2.3 and the version of android.jar is 19 When I start an activity in my test case, I get the nullPointetException. After tracing my code, I find it is caused by sendOrderBroadcast. since ShadowContextWrapper doesn't implement sendOrderBroadcast(...). this.activity = Robolectric.buildActivity(myActivity.class).create().get(); To solve the problem, I implement the function in my contextWrapper shadow by extending ShadowContextWrapper as following. @Implements(ContextWrapper.class) public class myShadowContextWrapper extends ShadowContextWrapper { @Implementation public void sendOrderedBroadcast( Intent intent, String receiverPermissions ){ getApplicationContext().sendBroadcast(intent); } @Implementation public void sendOrderedBroadcast (Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) { getApplicationContext().sendBroadcast(intent); } } I got another error message. java.lang.RuntimeException: java.lang.IllegalArgumentException: attempted to invoke public void com.example.myShadowContextWrapper.sendOrderedBroadcast (android.content.Intent,java.lang.String,android.content.BroadcastReceiver,android.os.Handler,int,java.lang.String,android.os.Bundle) on instance of class org.robolectric.shadows.ShadowApplication, but ShadowApplication doesn't extend myShadowContextWrapper It seems robolectric doesn't replace shadowContextWrapper to myShadowContextWrapper so shadowApplication still inherits to shadowContextWrapper. I also try to implement "myShadowApplication" and extend my myShadowContextWrapper, but error message shows that myShadowApplication can't be convert to ShadowApplication. It is impossible to let inherit ShadowApplication and myShadowContextWrapper in the mean time in Java .
tagged with: android
has comment: http://stackoverflow.com/comment/46153704
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: robolectric
has title: Can I create my customized shadowContextWrapper in robolectric?
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/40972377
comment on: http://stackoverflow.com/a/26124066
score: 0
type: AnswerComment
has text: I'm as mystified as you are.
type: Comment

http://stackoverflow.com/comment/40886711
comment on: http://stackoverflow.com/q/26092061
score: 0
has text: average(); takes two parameters, whom you're not passing to it. average(double, int);
type: Comment
type: QuestionComment

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/26063730

http://stackoverflow.com/q/26169465
has comment: http://stackoverflow.com/comment/41033049
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/26169718
answer count: 3
type: UnansweredQuestion
has body: I want to use the variables of Objects in a List&lt;Object&gt;. Example: I have the Student class public class Student { private int dni; private String name, ..getters and setter.. } and I have a list of student that is already filled. Example: List&lt;Student&gt; My questions is, how can I get the dni and name of a Student?
upvote count: 0
has answer: http://stackoverflow.com/a/26169647
has title: Get element from List<Object>
type: Question
score: -2
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/26169480
has comment: http://stackoverflow.com/comment/41028318

http://stackoverflow.com/comment/41005635
type: Comment
type: QuestionComment
has text: try Rectangle2D.Double(0, 0, 500, 500) and adjust it from there by trial and error. However it will be difficult if your pages all come from different sources. Footers aren't always the same.
comment on: http://stackoverflow.com/q/26143942
score: 0

http://stackoverflow.com/comment/40914247
type: QuestionComment
type: Comment
has text: @PeterLawry I am interpreting the instructions, which explicitly exclude file, as my definition =.=
score: 0
comment on: http://stackoverflow.com/q/26107202

http://stackoverflow.com/comment/40900037
comment on: http://stackoverflow.com/q/26095711
score: 0
type: Comment
type: QuestionComment
has text: check your dependencies, it seems that it starts yelling with that eror when there are dependencies conflicting. You might have different version of the same dependency.

http://stackoverflow.com/comment/40865285
type: QuestionComment
comment on: http://stackoverflow.com/q/26080493
has text: Please spell out your *goal*.
score: 0
type: Comment

http://stackoverflow.com/a/26119504
upvote count: 1
has body: I try the following code, and it's working fine now:) org.jboss.security.SecurityContextAssociation.getSecurityContext().getSubjectInfo().setAuthenticatedSubject(ctx.getSubject()); Thanks
downvote count: 0
answers question: http://stackoverflow.com/q/26118287
type: Answer
score: 1

http://stackoverflow.com/a/26099605
upvote count: 1
has body: You have two choices: Let the server sort the results before returning them to the user. Give the client the capability to sort the results on the client side without having to make another web service call.
score: 1
has comment: http://stackoverflow.com/comment/40900283
has comment: http://stackoverflow.com/comment/40900450
downvote count: 0
answers question: http://stackoverflow.com/q/26099535
has comment: http://stackoverflow.com/comment/40900569
has comment: http://stackoverflow.com/comment/40900381
type: Answer
has comment: http://stackoverflow.com/comment/40900261
has comment: http://stackoverflow.com/comment/40902214

http://stackoverflow.com/comment/40942246
has text: Not exactly, this is a code I have to modify and the first time I come across apache OPI.
score: 0
comment on: http://stackoverflow.com/q/26108859
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41063003
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26160084
has text: either they're lying or they're installing VERY old versions of java (i believe pre- 1.6). Simple as that. Maybe some non-oracle installers might also give you a faulty setup, of course oracle-java is best java

http://stackoverflow.com/comment/41066372
comment on: http://stackoverflow.com/a/26189367
type: AnswerComment
type: Comment
has text: And this let me work without problems? I restored my system, thinking that my Eclipse will be back to normality (but not happens).
score: 0

http://stackoverflow.com/q/26142656
type: Question
score: 5
downvote count: 0
has body: In Java, I need to find a way to store some data locally so that it is available between reboots. Simple things, such as window location/size. I know that such information is usually stored in C:\Users\&lt;username&gt;\AppData on Windows (accessed by typing %APPDATA% in the address bar of Windows Explorer), but I have no idea where it is stored on Mac OS X. (As a side note, I still don't understand the structure of that %APPDATA% folder on Windows, with its \Roaming, \Local, \LocalLow, etc. subfolders.) Surely there is some way for information like window location to be stored in these areas depending on the OS. Perhaps there is even an library already pre-built for doing these relatively ubiquitous tasks?
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26143348
linked to: http://stackoverflow.com/q/6885961
tagged with: storage
accepted answer: http://stackoverflow.com/a/26143348
tagged with: swing
possible better answer: http://stackoverflow.com/a/26142883
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26142883
upvote count: 5
has title: Accessing platform-specific application data area
tagged with: java
has answer: http://stackoverflow.com/a/26143715

http://stackoverflow.com/q/26116012
type: AnsweredQuestion
tagged with: java
has body: i have this code compiled in jdk 1.6, it works in one computer but shows error in another one public static void rellenarLinea(final StringBuffer psLinea, final ResultSet rs, final int plNumberOfColumns, final JDateEdu poDateEdu, final ResultSetMetaData rsmd) throws java.sql.SQLException { rellenarLinea(psLinea, rs, plNumberOfColumns, poDateEdu, rsmd, false); } /** * rellena psLinea, en funciona de la fila actual del ResultSet * @param psLinea buffer de la libea * @param rs resulset posicionado * @param plNumberOfColumns numero de columnas * @param poDateEdu Objeto dateEdu instanciado(da igual el valor) * @throws SQLException excepcion */ public static void rellenarLinea(final StringBuffer psLinea, final ResultSet rs, final int plNumberOfColumns, final JDateEdu poDateEdu, final ResultSetMetaData rsmd, boolean pbSiempreBorrarEspaciosFinal) throws java.sql.SQLException { Object loValor; Class loClase; int lTipo = -1; Calendar c = Calendar.getInstance(); //se crea la linea psLinea.setLength(0); for (int i = 1; i &lt;= plNumberOfColumns; i++) { loValor = rs.getObject(i); lTipo = rsmd.getColumnType(i); //comprobamos si es nulo if (loValor != null){ //para formatear correctamente la fecha loClase = loValor.getClass(); if((loClase == java.sql.Date.class) || (loClase == java.util.Date.class) || (loClase == java.sql.Time.class) || (loClase == java.sql.Timestamp.class)){ //anadimos ano,mes,dia if ((loClase == java.sql.Date.class) || (loClase == java.util.Date.class) || (loClase == java.sql.Timestamp.class)){ c.setTime((java.util.Date)loValor); poDateEdu.setDate(c); } //anadimos hora,minuto,segundo if(loClase == java.sql.Time.class){ c.setTime((java.sql.Time)loValor); } if(loClase == java.sql.Timestamp.class){ c.setTime((java.sql.Timestamp)loValor); } poDateEdu.setHora(c.get(c.HOUR_OF_DAY)); poDateEdu.setMinuto(c.get(c.MINUTE)); poDateEdu.setSegundo(c.get(c.SECOND)); psLinea.append(poDateEdu.toString()); }else if (loClase == Boolean.class){ if(((Boolean)loValor).booleanValue()…
type: Question
has title: Bad operand types for binary operator '=='
answer count: 1
tagged with: class
score: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/26116381
accepted answer: http://stackoverflow.com/a/26116381

http://stackoverflow.com/q/26169249
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/26172868
has body: Here's my code: public class ScoreFragment extends Fragment { public static final String TAG ="ScoreFragment"; @Override public void onAttach(Activity activity) { super.onAttach(activity); Log.d(TAG, "onAttach"); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(savedInstanceState==null) { Log.d(TAG,"onCreate FIRST TIME"); } else { Log.d(TAG,"onCreate SUBSEQUENT TIME"); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater,container,savedInstanceState); final View v = inflater.inflate(R.layout.score_collection, container, false); final TextView sliderText = (TextView) v.findViewById(R.id.score_number); sliderText.setTextSize(48); //TODO: Find solution to find known bug in Android /* ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); actionBar.hide();*/ SeekBar seekbar = (SeekBar) v.findViewById(R.id.seekBar); seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { sliderText.setText("" + progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); Log.d(TAG,"onCreateView"); return inflater.inflate(R.layout.score_collection, container, false); } The seekBar is displayed but it does not increment or show any text in my view. Here's how I set it up in my view (inside a RelativeLayout): &lt;SeekBar android:layout_width="300sp" android:layout_height="wrap_content" android:id="@+id/seekBar" android:progress="0" android:max="10" android:minHeight="30sp" android:maxHeight="30sp" android:layout_below="@+id/score_number" android:layout_centerHorizontal="true"/&gt; It actually worked before I placed it into Fragment, so I think it has to do with it being inside a Fragment but I'm not entirely sure. It's suppose to increme…
tagged with: android-seekbar
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/26172868
type: Question
has title: SeekBar does not show text in Fragment

http://stackoverflow.com/comment/40995581
type: Comment
has text: Look at `json_decode()` [documentation](http://php.net/manual/en/function.json-decode.php). The second parameter determines whether to return associative array. This should work `$entity['variable1']`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26149725

http://stackoverflow.com/comment/41060771
has text: @Pink, You know which level each file is at when you write the code.
type: AnswerComment
comment on: http://stackoverflow.com/a/26186292
score: 0
type: Comment

http://stackoverflow.com/a/28560324
answers question: http://stackoverflow.com/q/26161535
type: Answer
has body: Do it with Style templates. If SDK &lt; Jelly Bean use style with ActionBar.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26161535

http://stackoverflow.com/q/26102783
tagged with: java
tagged with: special-characters
type: Question
has answer: http://stackoverflow.com/a/26103109
answer count: 1
has comment: http://stackoverflow.com/comment/40905826
score: 0
has comment: http://stackoverflow.com/comment/40905875
has comment: http://stackoverflow.com/comment/40905810
tagged with: string
tagged with: character
accepted answer: http://stackoverflow.com/a/26103109
has body: I have a question: I have two strings in Java Code: 1) hello 2) 01234 I want to implement a code that knows how to recognize that the string "01234" consists of only numbers or special characters (such as . , * , ? or others) and that the string "hello" consists of only string characters. How Can I implement it?
has comment: http://stackoverflow.com/comment/40905848
has title: To recognize the numbers and special characters in a string Java
type: AnsweredQuestion
tagged with: numbers

http://stackoverflow.com/q/26059003
has answer: http://stackoverflow.com/a/26060549
upvote count: 3
has answer: http://stackoverflow.com/a/26062449
tagged with: java
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/26060771
tagged with: junit4
has comment: http://stackoverflow.com/comment/40826135
has comment: http://stackoverflow.com/comment/40831038
has answer: http://stackoverflow.com/a/26060771
has title: JUnit testing System.err.print()
accepted answer: http://stackoverflow.com/a/26060549
linked to: http://stackoverflow.com/q/15175175
answer count: 3
has body: I have a simple array class with some methods such as Add(int n), AddAt(int n, int index), etc. the addAt method calls another method from super class public void addAt(int n, int index) { if (checkIndex(index, size + 1)){ ... } } that checks if the inserted index is not out-bounded, if so the super class method prints an error message to console. how should I test that if the message is printed? I am using JUnit4.12-beta
tagged with: junit
downvote count: 0
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/41069761
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26191791
has text: I think the text file gets read from top to bottom until checkUsername == null. Then when i try and read it again checkUsername still equals null so then it breaks the loop.

http://stackoverflow.com/q/26046545
upvote count: 2
tagged with: android
has body: I know that a PendingIntent doesn't implement the Serielizeable interface. But if I create a POJO and add that intent as a member of my object, and letting that POJO implement serializeable, will that work? This is what I think: Intent intent = new Intent(this, someClass.class); PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0); POJO myPOJO = new POJO(); myPojo.setIntent(pi); ... serialize the POJO etc, as explained above. Will that POJO still be serializeable, and after deserialization, will I be able to fetch the PendingIntent with myPOJO.getIntent(); ? Sorry if it's obvious. thankful for any help. Marcus
accepted answer: http://stackoverflow.com/a/26046785
has comment: http://stackoverflow.com/comment/40803793
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40803138
has answer: http://stackoverflow.com/a/26046785
has title: Android serialize a PendingIntent
downvote count: 0
answer count: 1
favorite count: 0
tagged with: serialization

http://stackoverflow.com/a/26162881
has comment: http://stackoverflow.com/comment/41015963
type: Answer
answers question: http://stackoverflow.com/q/26162378
has body: I guess you want output in the following way (in the same line): Folder &gt; file1, file2, ... instead of (in new lines): Folder File1 File2 If that's the case, did you know you have System.out.print() that does not print a new line at the end? Try tweaking it, to insert the required separators (like commas and angular bracket). Also since you ARE using StringBuilder, it has an append() method that you can use. However, I see no reason for using StringBuilder for str instead of using it for test.
score: 0

http://stackoverflow.com/q/26108312
has body: I am trying to execute a java class file from php using the exec method. However, i get the following error. I have set chmod 777 to the java class file so i suppose permission is not an issue. For some reason it is not able to find it ? I can run the java class file from the terminal using the java command without any problem Error: Error: Could not find or load main class .var.www.redbutton.readBashScript.class &lt;?php exec('java /var/www/redbutton/readBashScript.class'); ?&gt; and &lt;?php exec('java /var/www/redbutton/readBashScript'); ?&gt;
tagged with: php
type: AnsweredQuestion
has title: Unable to execute java class file from php exec method?
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26108371
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26108371

http://stackoverflow.com/a/26064879
type: Answer
has body: String[] dayToString = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } later int day = ...; String strDay = dayToString(day);
answers question: http://stackoverflow.com/q/26064766
score: 0

http://stackoverflow.com/a/26283217
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26097895
type: Answer
has comment: http://stackoverflow.com/comment/41242234
has body: I think the reason your leftmost ToolBar is empty is a layout issue. In my code below, I had a similar "empty" ToolBar problem when I did not have any buttons located outside the custom ToolBar but still in the main ToolBar. Adding in the "foo" and "bar" buttons fixed the layout issue, but I could not figure out the right calls to layout() or pack() to fix it. I think this may be related to the bug here. I took a swing at creating a similar ToolBar and built around the "RCP Mail Template" plugin-project that you can create from the "New Plug-in Project" wizard. To address your first two concerns, I created 3 packages in the example RCP bundle (I called my project "com.bar.foo"): com.bar.foo.actions - Contains classes that extend ContributionControl and wrap Combo and Text widgets. These have nothing to do with the data model and just worry about creating widgets. com.bar.foo.model - Contains the data model. I just made up a simple model here with an IP, mask, gateway, and one or two helpful methods. com.bar.foo.toolBar - These classes are plugged up to the main UI ToolBar via the org.eclipse.ui.menus extension point. They link the data model to the ContributionControls in the first package. The most important class here is ToolBarContribution, which effectively centralizes all of your listeners. This makes it easier for you to link the listeners for the widgets to the same model. Here's the source for the ToolBarContribution (note that it addresses your first two concerns because it hooks up the listeners to the model and provides its own ToolBar to the UI): package com.bar.foo.toolBar; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import …
upvote count: 2

http://stackoverflow.com/a/26081222
type: Answer
has body: Initialize the Integers the following way then you will get the difference as @5gon12eder said The Integer s i and j are constructed (via auto boxing) from integer literals from the range –128 to 127 which are guaranteed to be pooled by the JVM so the same object (see flyweight pattern ) is used for them. Hence, they compare equal by object references. try this code to initialize your integers Integer i = new Integer(10); Integer j = new Integer(10);
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26081037
answers question: http://stackoverflow.com/q/26081037
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40782096
type: Comment
comment on: http://stackoverflow.com/q/26034834
score: 0
has text: What is `selectChild()`? Also what is the output you get with this implementation?
type: QuestionComment

http://stackoverflow.com/q/26145032
answer count: 1
downvote count: 0
has title: Display Characters in Java
score: 1
has body: How do I get java to read and all of the characters from a word of any length? I know that I have to use the .charAt(x) method, but how can I get the characters from a word of any length (eg: 2 or more letters) Also: how would I then get it to build this word up slowly again, as in display the letters slowly building up the letter (i am aware i need to use System.out.println()) eg: if my word was sugar, java would display: s then: su then: sug then: suga then: sugar Thank You
has comment: http://stackoverflow.com/comment/40982671
favorite count: 0
has answer: http://stackoverflow.com/a/26145100
tagged with: character
type: UnansweredQuestion
upvote count: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/41051029
has text: Thanks dude, How about if I want to store every initials in array ,
comment on: http://stackoverflow.com/a/26181033
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26102085
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26101996
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26101996
has body: Change dd-MM-YYYY to dd-MM-yyyy Because your format String is incorrect, per the SimpleDateFormat Javadoc, Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 1996; 96 Y Week year Year 2009; 09

http://stackoverflow.com/a/26176384
type: Answer
has comment: http://stackoverflow.com/comment/41043819
answers question: http://stackoverflow.com/q/26176290
has body: Well my advice is to print the whole array (I guess you store it in an array) in a log.d and see if it is there. Thats is always a tip by the way to clear your mind up when you are in a situation and don't know how to fix it.
score: 0
has comment: http://stackoverflow.com/comment/41045648

http://stackoverflow.com/comment/41062647
type: QuestionComment
has text: It's very unclear? what do you want to achieve?
comment on: http://stackoverflow.com/q/26187676
score: 2
type: Comment

http://stackoverflow.com/q/26138487
has body: I have a runtime exception that I have created in my project, and I want to make sure that it is caught in one of my classes, so that the whole program doesn't explode when it occurs (i.e. if anyone deletes the try/catch statement I want to know by having something in the build or static analysis tools fail). Unfortunately, as java doesn't enforce me to have the try/catch statement for this unchecked exception, there is no way to enforce it on compile time. (I cannot change my exception to be a checked exception). I am wondering if there is any way to enforce a try/catch statement in a specific class, probably with the use of the checkstyle/pmd/findbugs custom rules. (check that a specific method in a specific class has a try catch statement for my runtime exception). Thanks.
tagged with: runtimeexception
answer count: 2
has answer: http://stackoverflow.com/a/26149493
downvote count: 0
tagged with: findbugs
favorite count: 0
possible better answer: http://stackoverflow.com/a/26144501
tagged with: checkstyle
accepted answer: http://stackoverflow.com/a/26149493
has answer: http://stackoverflow.com/a/26144501
upvote count: 1
has title: static analysis custom rule to enforce unchecked exception handling
type: Question
type: AnsweredQuestion
tagged with: pmd
score: 1
tagged with: java

http://stackoverflow.com/a/26155747
score: 2
has comment: http://stackoverflow.com/comment/41002983
downvote count: 0
has comment: http://stackoverflow.com/comment/41003949
has comment: http://stackoverflow.com/comment/41002611
has comment: http://stackoverflow.com/comment/41003691
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26155701
has body: If you use new Thread each time, the two calls create two different threads; they don't act on the same thread. The interrupt() method does not stop the thread. Rather, it tells the thread to take a look at any interrupt flags that may also have been set, such as a shutdown flag. The thread itself must contain code to check for interrupts and to check for flags such as shutdown flags.

http://stackoverflow.com/a/26183487
type: Answer
has comment: http://stackoverflow.com/comment/41126120
accepted answer of: http://stackoverflow.com/q/26183287
upvote count: 1
has comment: http://stackoverflow.com/comment/41074891
score: 1
has body: I guess you're getting things a bit wrong with synchronization : ArrayList is a list implemented without synchronization A synchronized method means that only 1 Thread at a time can access the method, but the variables inside your function are not synchronized at all What you want, is to have your list temporary synchronized. You could do something like that : @Override public void paintComponent(Graphics g) { synchronized(paintList) { for(Object gO:paintList) { g.drawImage( gO.getObjImage(), gO.getXLoc(), gO.getYLoc(), outer.getTransparent(), null); } } } and in the code adding objects yo your list do somewhat the same. EDIT from here : If you want to remove all the concurrency problems between the add thread and the paint Thread, here's how you could do : in the method to add images : public synchronized void addImage(...) { Something newImage = ..... List&lt;Something&gt; newPaintList = new ArrayList&lt;&gt;(paintList.size() + 1); newPaintList.addAll(paintList); newPaintList.add(newImage); paintList = newPaintList; } And in the paint method, remove the synchronization part. @Override public void paintComponent(Graphics g) { for(Object gO:paintList) { g.drawImage( gO.getObjImage(), gO.getXLoc(), gO.getYLoc(), outer.getTransparent(), null); } } With this, you won't have any concurrency between the reads and the writes, since the only operation done on paintList is reads. The addImage should be synchronized to avoid two different Threads adding images at the same time, which could make one addImage ignored.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26183287

http://stackoverflow.com/q/26174241
answer count: 1
downvote count: 0
has title: Operations timeout in Hibernate
has answer: http://stackoverflow.com/a/26174561
accepted answer: http://stackoverflow.com/a/26174561
favorite count: 0
type: AnsweredQuestion
tagged with: connection-pooling
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41037561
has body: Learning hibernate..please go easy :) This is my main class i am using to perform operations depending on users choice : package hibernate_tut_emp; import java.util.Iterator; import java.util.List; import java.util.Scanner; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; public class MyOps { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); System.out.print(" 1 Insert \n 2 Delete \n 3 Update \n 4 Select \n Enter a choice : "); int choice = scnr.nextInt(); SessionFactory sesfact = HibernateUtil.getSessionFactory(); Session session = sesfact.openSession(); session.beginTransaction(); Employee emp = new Employee(); switch (choice) { case 1: //insert System.out.print("Enter a name : "); String name = scnr.next(); System.out.print("Enter a surname : "); String surname = scnr.next(); emp.setName(name); emp.setSurname(surname); session.save(emp); session.getTransaction().commit(); break; case 2://delete System.out.print("Enter a name to delete : "); String delname = scnr.next(); Query delQuery = session.getNamedQuery("DeleteByName"); delQuery.setParameter("name", delname); delQuery.executeUpdate(); session.getTransaction().commit(); break; case 3: //update System.out.print("Enter a name to update : "); String upname = scnr.next(); System.out.print("Enter a surname to update : "); String surn_name = scnr.next(); Query q = session.getNamedQuery("UpdateSurnameOfName"); q.setParameter("name", upname); q.setParameter("surname", surn_name); q.executeUpdate(); session.getTransaction().commit(); break; case 4: System.out.print("Enter a name to show details : "); String sh_name = scnr.next(); session = sesfact.getCurrentSession(); session.beginTransaction(); Query s_q = session.getNamedQuery("GetDetailsByName"); s_q.setParameter("name", sh_name); List list = s_q.list(); Iterator it = list.iterator(); while(it.hasNext()){ Employee employee = (Employee)it.next(); System.out.println(employee.getId()+" "+emplo…
tagged with: java
tagged with: hibernate
tagged with: timeout
has comment: http://stackoverflow.com/comment/41037372

http://stackoverflow.com/comment/40985846
has text: Ok let's say you can find the answer in that thread, well explained, even if the question is different :).
comment on: http://stackoverflow.com/q/26146371
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26201933
score: 0
has comment: http://stackoverflow.com/comment/41266118
has comment: http://stackoverflow.com/comment/41189912
type: Answer
has body: Dump is a shell command, in theory you could instantiate and run it yourself. It uses the SubgraphExporter from the Cypher module, Neo4j is OSS you can find it on GitHub In general it should be easier for you to run a cypher query against the database yourself and then with the results recreate the data you're interested in. Something like this should help you: https://github.com/neo4j-contrib/developer-resources/blob/gh-pages/examples/java/jdbc/src/main/java/example/jdbc/movies/MovieService.java#L58
has comment: http://stackoverflow.com/comment/41145966
answers question: http://stackoverflow.com/q/26175969

http://stackoverflow.com/q/26125300
score: 0
has comment: http://stackoverflow.com/comment/41021030
tagged with: java
has comment: http://stackoverflow.com/comment/40983178
tagged with: ant
type: UnansweredQuestion
has title: Report Detail JUnit Task isn't right
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40983388
tagged with: junit
tagged with: sikuli
type: Question
has comment: http://stackoverflow.com/comment/40946705
answer count: 0
has body: I'm working with Eclipse, JUnit, Sikuli, Ant and Ubuntu. I created a JUnit task for running a suite test and generated the report in html. In the console one of the five test cases shows this error: [junit] [error] Region.waitVanish: seems that imagefile could not be found on disk On purposed, I changed the image file name for doing wrong, and the tests show no failures. [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 780,548 sec The problem is that generated report isn't show me the right result, because at log in console, first, junit shows me an error and second, the final result shows me that everything passed right. Is that more clear now or that line I showed is not considered an error?? Anyone could help me with this? Any ideas? Thanks so much. Build.xml code: <property environment="env"/> <property name="ECLIPSE_HOME" value="../../Eclipse/eclipse"/> <property name="sourceDir" value="src"/> <property name="reportsDir" value="reports"/> <property name="buildDir" value="bin"/> <property name="target" value="1.5"/> <property name="source" value="1.5"/> <pathelement location="${ECLIPSE_HOME}/plugins/org.junit_4.11.0.v201303080030/junit.jar"/> <pathelement location="${ECLIPSE_HOME}/plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/> <pathelement location="${ECLIPSE_HOME}/plugins/org.apache.ant.source_1.8.4.v201303080030.jar"/> <pathelement location="${buildDir}"/> <pathelement location="../../Sikuli/sikuli-java.jar"/> <delete dir="${buildDir}" includes="**/*.class" /> <delete dir="${reportsDir}" /> <delete file="ReportsConsole.doc"/> <mkdir dir="${reportsDir}"/> <mkdir dir="${reportsDir}/html"/> <mkdir dir="${buildDir}"/> <touch file="ReportsConsole.doc"/> <patternset includes="jdtCompilerAdapter.jar"/> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <antcall target="build"/> <pathelement location="${buildDir}"/> <formatter type="xml" usefile="true"/> <include name="**/*TestSuite01*"/> <include name="TEST-*.xml"/> <re…

http://stackoverflow.com/comment/40833202
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26062907
score: 0
has text: That's a weird error... Can you print the exact stack-trace? findColumn documentation says: SQLException - if the ResultSet object does not contain a column labeled columnLabel, a database access error occurs or this method is called on a closed result set @ares: That should make no difference - and it is inefficient.

http://stackoverflow.com/a/26184446
answers question: http://stackoverflow.com/q/26184274
type: Answer
accepted answer of: http://stackoverflow.com/q/26184274
upvote count: 4
downvote count: 0
has body: Consider: Using a BoxLayout for the overall GUI Creating a middle JPanel that uses GridBagLayout to hold the two buttons. Then adding to the outer BoxLayout-using JPanel one JScrollPane, the middle JPanel, and the other JScrollPane. The key to all this is to try to visualize what the layout managers should be doing, and then nesting your JPanels, each with their own layout manager to get your goal to work. For example, this GUI can be produced by this code: import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.*; public class LayoutEg extends JPanel { private static final long serialVersionUID = 1L; private static final int ROWS = 30; private static final int COLS = 30; private static final int GBC_GAP = 10; private JTextArea textArea1 = new JTextArea(ROWS, COLS); private JTextArea textArea2 = new JTextArea(ROWS, COLS); private JButton encryptButton = new JButton("Encrypt"); private JButton decryptButton = new JButton("Decrypt"); public LayoutEg() { JPanel centerPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridheight = 1; gbc.gridwidth = 1; gbc.insets = new Insets(GBC_GAP, GBC_GAP, GBC_GAP, GBC_GAP); // setting the weightx and weighty of 0 is what forces the buttons // in the center to bunch together gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 0; centerPanel.add(encryptButton, gbc); gbc.gridy = 1; centerPanel.add(decryptButton, gbc); setBorder(BorderFactory.createEmptyBorder(GBC_GAP, GBC_GAP, GBC_GAP, GBC_GAP)); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(new JScrollPane(textArea1)); add(centerPanel); add(new JScrollPane(textArea2)); } private static void createAndShowGui() { JFrame frame = new JFrame("Layout Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new LayoutEg()); frame.pack(); frame.setLocationRela…
type: AcceptedAnswer
score: 4

http://stackoverflow.com/a/26156481
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You probably did not provide all required jars on the classpath when starting the junit test. You need to make sure that the postgresql driver jar is also on the classpath during the run of your test. Depends on what IDE you use, or if you are running it on command line you have to add it to the -cp parameter (this is actually what the IDE will do for you).
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26156418
answers question: http://stackoverflow.com/q/26156418
has comment: http://stackoverflow.com/comment/41004123

http://stackoverflow.com/comment/40820406
type: AnswerComment
type: Comment
has text: yeah it will get original parameters as we defined in the source
comment on: http://stackoverflow.com/a/26056262
score: 0

http://stackoverflow.com/comment/40900275
type: Comment
comment on: http://stackoverflow.com/a/26099582
has text: The question is that where should I keep them?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26088221
tagged with: junit
answer count: 0
has body: Suppose I have a method I want to test, without a return statement: public void func(){ // some computing // call another method: anotherFunc(par); } Is it possible to change this method to this: public boolean func(){ // some computing // call another method: anotherFunc(par); return true; } If this method completes successfully, it returns true, otherwise false, to that a test would fail.
has comment: http://stackoverflow.com/comment/40879402
type: Question
has comment: http://stackoverflow.com/comment/40879309
has title: Boolean method for testing
linked to: http://stackoverflow.com/q/21219942
score: 0
duplicate of: http://stackoverflow.com/q/21219942
tagged with: testing
has comment: http://stackoverflow.com/comment/40879298
tagged with: java
has comment: http://stackoverflow.com/comment/40879357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40879369
has comment: http://stackoverflow.com/comment/40879415

http://stackoverflow.com/comment/40872956
type: QuestionComment
comment on: http://stackoverflow.com/q/26084761
type: Comment
has text: What does "it does not work" mean? If your Java process is correctly reading from stdin and writing to stdout, then it should work.
score: 0

http://stackoverflow.com/q/26132735
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40960293
has comment: http://stackoverflow.com/comment/40960455
linked to: http://stackoverflow.com/q/1021324
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/1021324
has body: import java.util.*; public class LeapYear { public static void main (String[]args) { Scanner scan= new Scanner (System.in); System.out.println("Please enter in the year"); int year=scan.nextInt(); if (year % 4 ==0) { { if (year % 100 ==0); else System.out.println("The year,"+year+",is a leap year!"); } if(year % 400==0) System.out.println("The year, "+year+",is a leap year!"); } else System.out.println("The year, "+year+",is not a leap year!"); } } Hey everyone! Above is my code for a leap year program- It seems to work well, except whenever I enter a number such as 3000 or 300, the JVM just stops and shuts the terminal window. Could someone please guide as to why it's not accepting these numbers (Also, please forgive me that my code is not formatted properly- I'm new and trying to do the best I can) NOTE: It is displaying all the right answers when I test 1900, 1996, 2004, 164, and 204 as years. It will simply not accept 300 or 3000. Thanks Again!
has title: Leap Year Program
has answer: http://stackoverflow.com/a/26132805
tagged with: leap-year
accepted answer: http://stackoverflow.com/a/26132840
type: Question
has answer: http://stackoverflow.com/a/26132840
has comment: http://stackoverflow.com/comment/76321512
possible better answer: http://stackoverflow.com/a/26132756
answer count: 3
has answer: http://stackoverflow.com/a/26132756

http://stackoverflow.com/a/26086033
has comment: http://stackoverflow.com/comment/40876142
has body: Write a small wrapper which starts the application. The simplest way to do this would be to create a shell wrapper: #!/bin/sh java ... But it's likely that that won't work on a server installation. See below. Change the owner and group of the wrapper to a user and group which have permission to read the jar files: $ chown user:group wrapper Change the permissions of the wrapper to make it world-executable, and setuid (so that it will run as the owner of the wrapper, set in the previous step): $ chmod a+rx,og-w,u+s wrapper Then the wrapper will be run as the indicated user, without giving anybody additional privileges over the executable or its support files. I strongly recommend not making the owner of the wrapper root. Use some user created for this purpose, which you control but which does not have root access. In case your system doesn't honour the setuid bit for interpreters (that is, scripts with a shebang (#!) line), here's a simple C wrapper which should work. You'll have to modify it as indicated below and then compile it: cc -Wall -o wrapper wrapper.c (-o wrapper means "the binary to produce will be called wrapper.) Substitute whatever name you like, and put the wrapper file in a place where it can be found, such as /usr/local/bin/wrapper. It's hard to give precise instructions without knowing anything about your system configuration. Good luck. I have no idea how you run your application, but you'll have to insert the command line into the following code, replacing java with the actual command used, and /path/to/java with the output of which java (again, use the actual command name if it isn't "java"). The arguments in the command line get inserted instead of arg1, arg2, etc. Don't use extra quotes; just the characters which form the command-line. #include &lt;stdio.h&gt; #include &lt;unistd.h&gt; int main() { execl("/path/to/java", "java", "arg1", "arg2", /* ... */ (char*)0); /* If we get here, the exec didn't work */ perror("Failed to execute /path/to/ja…
downvote count: 0
has comment: http://stackoverflow.com/comment/106963317
type: Answer
has comment: http://stackoverflow.com/comment/40876192
has comment: http://stackoverflow.com/comment/40876024
upvote count: 1
has comment: http://stackoverflow.com/comment/40875381
answers question: http://stackoverflow.com/q/26085748
score: 1

http://stackoverflow.com/comment/40913487
score: 0
comment on: http://stackoverflow.com/q/26105928
type: Comment
type: QuestionComment
has text: Not a solution, but here’s a workaround: [Azul Systems](http://www.azulsystems.com) just announced and shipped a build of OpenJDK for both Java 6 & 7 & 8 including support for Docker. This free and open-source product is called [Zulu](http://www.azulsystems.com/products/zulu). They offer [commercial support](http://www.azulsystems.com/products/zulu/support-packages) as well. To quote: `The only commercialized multi-platform build of OpenJDK: Free, 100% open source Java for Windows, Linux (including Docker), Mac OS X and the Cloud`. I've not used it yet, but it sparked my interest in Docker.

http://stackoverflow.com/comment/40919080
has text: You might need to elaborate why two maps is _not_ an acceptable solution. Without further details, encapsulating two such maps in a new class is how I'd naively solve that problem.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26109997

http://stackoverflow.com/comment/40911313
score: 1
has text: This exception says this feature is not supported by database or driver.
comment on: http://stackoverflow.com/q/26105618
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26139725
tagged with: bounded-wildcard
tagged with: arrays
has answer: http://stackoverflow.com/a/26141039
tagged with: wildcard
favorite count: 0
has body: Why is this code valid ArrayList&lt;?&gt;[] arr = new ArrayList&lt;?&gt;[2]; but the following two are not? ArrayList&lt;? extends Object&gt;[] arr = new ArrayList&lt;? extends Object&gt;[2]; ArrayList&lt;? super Object&gt;[] arr = new ArrayList&lt;? super Object&gt;[2]; The two last rows generate the compile error; error: generic array creation. Please clarify difference. update On the other hand ArrayList&lt;?&gt;[] arr = new ArrayList&lt;?&gt;[2]; compiles good but ArrayList&lt;?&gt; arr = new ArrayList&lt;?&gt;(); not.
type: Question
score: 9
tagged with: generics
answer count: 2
has answer: http://stackoverflow.com/a/26158919
downvote count: 1
tagged with: java
has title: difference between creation unbounded and bounded wild card type array?
type: UnansweredQuestion
upvote count: 10

http://stackoverflow.com/q/26128977
favorite count: 0
has answer: http://stackoverflow.com/a/26130097
accepted answer: http://stackoverflow.com/a/26130097
type: AnsweredQuestion
has body: Does StandardTokenizer remove punctuation (in Lucene 4.1) Im just trying to move back to StandardTokenizer from my own old custom implemenation because the newer version seems to have much better support for Asian languages However this code except fails on incrementToken() implying that the !!! are removed from output, yet looking at the jflex classes I cant see anything to indicate punctuation is removed, is it removed and if so can i prevent its removal ? Tokenizer tokenizer = new StandardTokenizer(LuceneVersion.LUCENE_VERSION, new StringReader("!!!")); assertNotNull(tokenizer); tokenizer.reset(); assertTrue(tokenizer.incrementToken());
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Does StandardTokenizer remove punctuation (in Lucene 4.1)
upvote count: 1
answer count: 1
tagged with: lucene

http://stackoverflow.com/comment/40865530
type: QuestionComment
comment on: http://stackoverflow.com/q/26080680
score: 1
has text: Yes, if you also give `Observer` a no-argument constructor.
type: Comment

http://stackoverflow.com/a/26183041
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26182982
has body: BigDecimal is probably your best bet for exact decimal representations. BigDecimal value = new BigDecimal("5555998.558"); It's immutable, so every operation you do to it will result in you creating a new BigDecimal instance, but its precision is also likely what you need.
score: 5
upvote count: 5

http://stackoverflow.com/comment/40916450
type: Comment
comment on: http://stackoverflow.com/a/26108468
has text: There's a few cases that are being missed, i.e. 1, 2, 4, 5 from what I can tell. That's where things get messy.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26175399
has comment: http://stackoverflow.com/comment/41039288
score: 5
answers question: http://stackoverflow.com/q/26175326
type: Answer
upvote count: 5
downvote count: 0
has body: (`UUID`, `username`, `name`, `race`, `tribe`, `gender`, age`, `desc`, `channel Missing quotes on age?

http://stackoverflow.com/q/26168064
tagged with: performance
has comment: http://stackoverflow.com/comment/41025884
tagged with: java
score: 0
has body: I want to know why the running time of my code is fluctuating. The (below) code is to output the hash value of a file. (8MB) Firstly, the code takes a little time to return the result. But now it takes a long time to return and sometimes it takes a little time like first time. I don't know the real running time of the code is fast or slow. I found out that it takes long time in hashSum.update(buffer, 0, unitsize); I cannot find the reason. The code is as follows import java.io.FileNotFoundException; import java.io.RandomAccessFile; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Test { public static byte[] extractFileHashSHA256(String filename) throws Exception { byte[] partialHash = null; int buff = 16384; try { RandomAccessFile file = new RandomAccessFile(filename, "r"); MessageDigest hashSum = MessageDigest.getInstance("SHA-256"); byte[] buffer = new byte[buff]; long read = 0; // calculate the hash of the hole file for the test long offset = file.length(); int unitsize; while (read &lt; offset) { unitsize = (int) (((offset - read) &gt;= buff) ? buff : (offset - read)); file.read(buffer, 0, unitsize); hashSum.update(buffer, 0, unitsize); read += unitsize; } file.close(); partialHash = new byte[hashSum.getDigestLength()]; partialHash = hashSum.digest(); } catch (FileNotFoundException e) { e.printStackTrace(); } return partialHash; } public static void main(String[] args) throws Exception { String output = new java.math.BigInteger(extractFileHashSHA256("a.pdf")).toString(16); System.out.println(output); return ; } } I hope your helpful comment. Thanks in advance.
tagged with: hash
tagged with: time
has title: the running time of the code to return hash value
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/41025802
has comment: http://stackoverflow.com/comment/41025937

http://stackoverflow.com/q/26056310
tagged with: jetty
has title: Connection pool exhausted error in Jetty Server
has comment: http://stackoverflow.com/comment/40820445
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40834883
has body: I am getting Connection pool exhausted - try increasing 'maxPoolSize' and/or 'borrowConnectionTimeout on the DataSourceBean when I'm executing a test for 300 Vusers. can anyone tell me how exactly this errors occurs I mean for what reasons and how can we solve this...?? Do I need to increase the maxpoolsize of app.properties file ? or can anyone explain what is a connection pool ? as I'm not a tester I don't have much knowledge on db side. Waiting for your Response/answers Thank You
answer count: 0
type: UnansweredQuestion